SPEEDO define added - being disabled as default setting

This commit is contained in:
Uwe Rathmann 2018-04-10 17:11:42 +02:00
parent 7e0521fe54
commit aaab3832fc
4 changed files with 21 additions and 21 deletions

View File

@ -58,5 +58,5 @@ void ButtonBar::addIndicator( const char* name )
QSizeF ButtonBar::contentsSizeHint() const QSizeF ButtonBar::contentsSizeHint() const
{ {
return { -1, 20 }; return QSizeF( -1, 20 );
} }

View File

@ -13,8 +13,9 @@
#include <QDate> #include <QDate>
#include <QImage> #include <QImage>
MainWindow::MainWindow() : #define SPEEDO 0
m_layout( nullptr )
MainWindow::MainWindow()
{ {
const QImage image( QStringLiteral( ":/images/background.jpg" ) ); const QImage image( QStringLiteral( ":/images/background.jpg" ) );
@ -22,27 +23,27 @@ MainWindow::MainWindow() :
backgroundImage->setGraphic( QskGraphic::fromImage( image ) ); backgroundImage->setGraphic( QskGraphic::fromImage( image ) );
backgroundImage->setFillMode( QskGraphicLabel::Stretch ); backgroundImage->setFillMode( QskGraphicLabel::Stretch );
m_layout = new QskLinearBox( Qt::Vertical, contentItem() );
auto header = headerBar(); auto header = headerBar();
auto content = mainContent(); auto content = mainContent();
auto footer = footerBar(); auto footer = footerBar();
m_layout->addItem( header ); auto layout = new QskLinearBox( Qt::Vertical, contentItem() );
m_layout->setStretchFactor( header, 1 );
m_layout->addItem( content ); layout->addItem( header );
m_layout->setStretchFactor( content, 10 ); layout->setStretchFactor( header, 1 );
m_layout->addItem( footer ); layout->addItem( content );
m_layout->setStretchFactor( footer, 1 ); layout->setStretchFactor( content, 10 );
layout->addItem( footer );
layout->setStretchFactor( footer, 1 );
setAutoLayoutChildren( true ); setAutoLayoutChildren( true );
} }
QQuickItem* MainWindow::headerBar() const QQuickItem* MainWindow::headerBar() const
{ {
auto* header = new ButtonBar( m_layout ); auto* header = new ButtonBar();
header->addIndicator( "bluetooth" ); header->addIndicator( "bluetooth" );
header->addIndicator( "location" ); header->addIndicator( "location" );
header->addIndicator( "phone" ); header->addIndicator( "phone" );
@ -58,13 +59,16 @@ QQuickItem* MainWindow::headerBar() const
QQuickItem* MainWindow::mainContent() const QQuickItem* MainWindow::mainContent() const
{ {
return new SpeedometerDisplay( m_layout ); #if SPEEDO
//return new SoundControl(); ### return new SpeedometerDisplay();
#else
return new SoundControl();
#endif
} }
QQuickItem* MainWindow::footerBar() const QQuickItem* MainWindow::footerBar() const
{ {
auto* footer = new ButtonBar( m_layout ); auto* footer = new ButtonBar();
footer->addIndicator( "cloud" ); footer->addIndicator( "cloud" );
footer->addIndicator( "man" ); footer->addIndicator( "man" );

View File

@ -3,8 +3,6 @@
#include <QskWindow.h> #include <QskWindow.h>
class QskLinearBox;
class QQuickItem; class QQuickItem;
class MainWindow : public QskWindow class MainWindow : public QskWindow
@ -16,8 +14,6 @@ private:
QQuickItem* headerBar() const; QQuickItem* headerBar() const;
QQuickItem* mainContent() const; QQuickItem* mainContent() const;
QQuickItem* footerBar() const; QQuickItem* footerBar() const;
QskLinearBox* m_layout;
}; };
#endif #endif

View File

@ -16,8 +16,8 @@ int main( int argc, char** argv )
auto skinFactory = new SkinFactory(); auto skinFactory = new SkinFactory();
qskSkinManager->setPluginPaths( QStringList() ); // no plugins qskSkinManager->setPluginPaths( QStringList() ); // no plugins
qskSkinManager->registerFactory( QStringLiteral( "SampleSkinFactory" ), qskSkinManager->registerFactory(
skinFactory ); QStringLiteral( "SampleSkinFactory" ), skinFactory );
QGuiApplication app( argc, argv ); QGuiApplication app( argc, argv );