From aaab3832fc6e63979eb00b535668671880ef8158 Mon Sep 17 00:00:00 2001 From: Uwe Rathmann Date: Tue, 10 Apr 2018 17:11:42 +0200 Subject: [PATCH] SPEEDO define added - being disabled as default setting --- examples/automotive/ButtonBar.cpp | 2 +- examples/automotive/MainWindow.cpp | 32 +++++++++++++++++------------- examples/automotive/MainWindow.h | 4 ---- examples/automotive/main.cpp | 4 ++-- 4 files changed, 21 insertions(+), 21 deletions(-) diff --git a/examples/automotive/ButtonBar.cpp b/examples/automotive/ButtonBar.cpp index 73a899ed..abc2a823 100644 --- a/examples/automotive/ButtonBar.cpp +++ b/examples/automotive/ButtonBar.cpp @@ -58,5 +58,5 @@ void ButtonBar::addIndicator( const char* name ) QSizeF ButtonBar::contentsSizeHint() const { - return { -1, 20 }; + return QSizeF( -1, 20 ); } diff --git a/examples/automotive/MainWindow.cpp b/examples/automotive/MainWindow.cpp index 0c108812..f648a107 100644 --- a/examples/automotive/MainWindow.cpp +++ b/examples/automotive/MainWindow.cpp @@ -13,8 +13,9 @@ #include #include -MainWindow::MainWindow() : - m_layout( nullptr ) +#define SPEEDO 0 + +MainWindow::MainWindow() { const QImage image( QStringLiteral( ":/images/background.jpg" ) ); @@ -22,27 +23,27 @@ MainWindow::MainWindow() : backgroundImage->setGraphic( QskGraphic::fromImage( image ) ); backgroundImage->setFillMode( QskGraphicLabel::Stretch ); - m_layout = new QskLinearBox( Qt::Vertical, contentItem() ); - auto header = headerBar(); auto content = mainContent(); auto footer = footerBar(); - m_layout->addItem( header ); - m_layout->setStretchFactor( header, 1 ); + auto layout = new QskLinearBox( Qt::Vertical, contentItem() ); - m_layout->addItem( content ); - m_layout->setStretchFactor( content, 10 ); + layout->addItem( header ); + layout->setStretchFactor( header, 1 ); - m_layout->addItem( footer ); - m_layout->setStretchFactor( footer, 1 ); + layout->addItem( content ); + layout->setStretchFactor( content, 10 ); + + layout->addItem( footer ); + layout->setStretchFactor( footer, 1 ); setAutoLayoutChildren( true ); } QQuickItem* MainWindow::headerBar() const { - auto* header = new ButtonBar( m_layout ); + auto* header = new ButtonBar(); header->addIndicator( "bluetooth" ); header->addIndicator( "location" ); header->addIndicator( "phone" ); @@ -58,13 +59,16 @@ QQuickItem* MainWindow::headerBar() const QQuickItem* MainWindow::mainContent() const { - return new SpeedometerDisplay( m_layout ); - //return new SoundControl(); ### +#if SPEEDO + return new SpeedometerDisplay(); +#else + return new SoundControl(); +#endif } QQuickItem* MainWindow::footerBar() const { - auto* footer = new ButtonBar( m_layout ); + auto* footer = new ButtonBar(); footer->addIndicator( "cloud" ); footer->addIndicator( "man" ); diff --git a/examples/automotive/MainWindow.h b/examples/automotive/MainWindow.h index 1b3d793b..de1166de 100644 --- a/examples/automotive/MainWindow.h +++ b/examples/automotive/MainWindow.h @@ -3,8 +3,6 @@ #include -class QskLinearBox; - class QQuickItem; class MainWindow : public QskWindow @@ -16,8 +14,6 @@ private: QQuickItem* headerBar() const; QQuickItem* mainContent() const; QQuickItem* footerBar() const; - - QskLinearBox* m_layout; }; #endif diff --git a/examples/automotive/main.cpp b/examples/automotive/main.cpp index 566cff41..bbdac2b3 100644 --- a/examples/automotive/main.cpp +++ b/examples/automotive/main.cpp @@ -16,8 +16,8 @@ int main( int argc, char** argv ) auto skinFactory = new SkinFactory(); qskSkinManager->setPluginPaths( QStringList() ); // no plugins - qskSkinManager->registerFactory( QStringLiteral( "SampleSkinFactory" ), - skinFactory ); + qskSkinManager->registerFactory( + QStringLiteral( "SampleSkinFactory" ), skinFactory ); QGuiApplication app( argc, argv );