diff --git a/examples/automotive/ButtonBar.cpp b/examples/automotive/ButtonBar.cpp index 5f9ba8fd..bd38182e 100644 --- a/examples/automotive/ButtonBar.cpp +++ b/examples/automotive/ButtonBar.cpp @@ -43,7 +43,7 @@ ButtonBar::ButtonBar( QQuickItem* parentItem ) void ButtonBar::addIndicator( const char* name ) { - auto* label = new IndicatorLabel( this ); + auto label = new IndicatorLabel( this ); /* The label should adjust vertically and be stretched horizontally diff --git a/examples/automotive/SkinFactory.h b/examples/automotive/SkinFactory.h index fd5437a2..98e48614 100644 --- a/examples/automotive/SkinFactory.h +++ b/examples/automotive/SkinFactory.h @@ -10,10 +10,10 @@ class SkinFactory : public QskSkinFactory public: enum GraphicRoles { - // to be visisble on a button + // to be visible on a button Button, - // to be visisble on header/footer + // to be visible on header/footer Indicator, // in contrast to the background pixmap diff --git a/examples/automotive/SoundControl.cpp b/examples/automotive/SoundControl.cpp index 60051dde..d6c832fa 100644 --- a/examples/automotive/SoundControl.cpp +++ b/examples/automotive/SoundControl.cpp @@ -210,7 +210,7 @@ class StackedControl final : public QskControl for ( int a = 0; a < children().count(); a++ ) { - QskControl* control = static_cast< QskControl* >( children().at( a ) ); + auto control = static_cast< QskControl* >( children().at( a ) ); if ( control->objectName() == "verticalBar" ) { @@ -250,7 +250,7 @@ class SectionTitleBar final : public QskLinearBox { setSpacing( 10 ); - auto* label = new QskTextLabel( title ); + auto label = new QskTextLabel( title ); label->setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed ); addItem( new QskSeparator() ); @@ -275,7 +275,7 @@ class SliderBox final : public QskLinearBox label->setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed ); m_numberLabel->setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed ); - auto* plusButton = new ControlButton( '+' ); + auto plusButton = new ControlButton( '+' ); auto minusButton = new ControlButton( '-' ); m_slider = new QskSlider( Qt::Vertical ); diff --git a/examples/colorswitch/Theme.cpp b/examples/colorswitch/Theme.cpp index cb2c9354..88f58048 100644 --- a/examples/colorswitch/Theme.cpp +++ b/examples/colorswitch/Theme.cpp @@ -79,11 +79,11 @@ void Theme::setSkin( const QString& skinName ) if ( skinName == qskSetup->skinName() ) return; - QskSkin* oldSkin = qskSetup->skin(); + auto oldSkin = qskSetup->skin(); if ( oldSkin->parent() == qskSetup ) oldSkin->setParent( nullptr ); // otherwise setSkin deletes it - QskSkin* newSkin = qskSetup->setSkin( skinName ); + auto newSkin = qskSetup->setSkin( skinName ); SkinTransition transition( m_accent ); diff --git a/examples/layouts/ButtonBox.cpp b/examples/layouts/ButtonBox.cpp index 5b8f3bc0..f247d6a3 100644 --- a/examples/layouts/ButtonBox.cpp +++ b/examples/layouts/ButtonBox.cpp @@ -16,8 +16,9 @@ ButtonBox::ButtonBox( QQuickItem* parent ) void ButtonBox::addButton( const QString& text, std::function< void() > func, bool autoRepeat ) { - QskPushButton* button = new QskPushButton( text ); + auto button = new QskPushButton( text ); button->setAutoRepeat( autoRepeat ); + QObject::connect( button, &QskPushButton::clicked, func ); addItem( button ); diff --git a/examples/layouts/DynamicConstraintsPage.cpp b/examples/layouts/DynamicConstraintsPage.cpp index 7ddba6af..7b2a7452 100644 --- a/examples/layouts/DynamicConstraintsPage.cpp +++ b/examples/layouts/DynamicConstraintsPage.cpp @@ -128,10 +128,11 @@ DynamicConstraintsPage::DynamicConstraintsPage( QQuickItem* parent ) setMargins( 10 ); setBackgroundColor( QskRgbValue::LightSteelBlue ); - Box* box = new Box(); + auto box = new Box(); - QskPushButton* button = new QskPushButton( "Flip" ); + auto button = new QskPushButton( "Flip" ); button->setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed ); + QObject::connect( button, &QskPushButton::clicked, box, &Box::flip ); addItem( button, Qt::AlignTop | Qt::AlignLeft ); diff --git a/examples/layouts/FlowLayoutPage.cpp b/examples/layouts/FlowLayoutPage.cpp index b0d1dd9d..1648ab3d 100644 --- a/examples/layouts/FlowLayoutPage.cpp +++ b/examples/layouts/FlowLayoutPage.cpp @@ -75,8 +75,9 @@ namespace private: void addRectangle( const char* colorName ) { - TestRectangle* rect = new TestRectangle( colorName ); + auto rect = new TestRectangle( colorName ); rect->setText( QString::number( itemCount() + 1 ) ); + addItem( rect, Qt::AlignCenter ); } }; @@ -88,9 +89,9 @@ FlowLayoutPage::FlowLayoutPage( QQuickItem* parent ) setMargins( 10 ); setBackgroundColor( QskRgbValue::LightSteelBlue ); - Box* box = new Box(); + auto box = new Box(); - ButtonBox* buttonBox = new ButtonBox(); + auto buttonBox = new ButtonBox(); buttonBox->addButton( "Flip", [ box ]() { box->transpose(); } ); buttonBox->addButton( "Mirror", [ box ]() { box->mirror(); } ); buttonBox->addButton( "Rotate", [ box ]() { box->rotate(); } ); diff --git a/examples/layouts/LinearLayoutPage.cpp b/examples/layouts/LinearLayoutPage.cpp index eb243360..60ff1c5e 100644 --- a/examples/layouts/LinearLayoutPage.cpp +++ b/examples/layouts/LinearLayoutPage.cpp @@ -72,7 +72,7 @@ namespace private: void addRectangle( const char* colorName ) { - TestRectangle* rect = new TestRectangle( colorName ); + auto rect = new TestRectangle( colorName ); rect->setText( QString::number( itemCount() + 1 ) ); addItem( rect, Qt::AlignCenter ); @@ -86,9 +86,9 @@ LinearLayoutPage::LinearLayoutPage( QQuickItem* parent ) setMargins( 10 ); setBackgroundColor( QskRgbValue::LightSteelBlue ); - Box* box = new Box(); + auto box = new Box(); - ButtonBox* buttonBox = new ButtonBox(); + auto buttonBox = new ButtonBox(); buttonBox->addButton( "Flip", [ box ]() { box->transpose(); } ); buttonBox->addButton( "Mirror", [ box ]() { box->mirror(); } ); buttonBox->addButton( "Rotate", [ box ]() { box->rotate(); } ); diff --git a/examples/layouts/StackLayoutPage.cpp b/examples/layouts/StackLayoutPage.cpp index 56cdc757..59d10f98 100644 --- a/examples/layouts/StackLayoutPage.cpp +++ b/examples/layouts/StackLayoutPage.cpp @@ -35,8 +35,7 @@ namespace for ( int i = 0; i < itemCount(); i += 2 ) { - QskControl* control = qobject_cast< QskControl* >( itemAtIndex( i ) ); - if ( control ) + if ( auto control = qobject_cast< QskControl* >( itemAtIndex( i ) ) ) control->setFixedSize( 200, 200 ); } } diff --git a/examples/layouts/main.cpp b/examples/layouts/main.cpp index 227c205c..89de7662 100644 --- a/examples/layouts/main.cpp +++ b/examples/layouts/main.cpp @@ -51,7 +51,7 @@ int main( int argc, char* argv[] ) SkinnyFont::init( &app ); SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts ); - QskTabView* tabView = new QskTabView(); + auto tabView = new QskTabView(); tabView->setMargins( 10 ); tabView->setOrientation( Qt::Horizontal ); tabView->addTab( "Grid Layout", new DummyLabel( "Grid Layout - TODO ..." ) ); @@ -59,7 +59,7 @@ int main( int argc, char* argv[] ) tabView->addTab( "Linear Layout", new LinearLayoutPage() ); int dynamicIndex = tabView->addTab( "Dynamic\nConstraints", new DynamicConstraintsPage() ); - QskTabButton* button = tabView->buttonAt( dynamicIndex ); + auto button = tabView->buttonAt( dynamicIndex ); QskTextOptions textOptions = button->textOptions(); textOptions.setWrapMode( QskTextOptions::WordWrap ); button->setTextOptions( textOptions ); diff --git a/examples/messagebox/main.cpp b/examples/messagebox/main.cpp index e7c50314..f5702319 100644 --- a/examples/messagebox/main.cpp +++ b/examples/messagebox/main.cpp @@ -131,7 +131,7 @@ int main( int argc, char* argv[] ) qskDialog->setPolicy( QskDialog::EmbeddedBox ); - ButtonBox* box = new ButtonBox(); + auto box = new ButtonBox(); /* To avoid losing the focus, when a message box is executed diff --git a/examples/sliders/SliderSkinlet.cpp b/examples/sliders/SliderSkinlet.cpp index 7931de66..517490f1 100644 --- a/examples/sliders/SliderSkinlet.cpp +++ b/examples/sliders/SliderSkinlet.cpp @@ -70,8 +70,7 @@ class HandleNode : public QSGGeometryNode if ( rect != m_rect || peakPos != m_peakPos ) { - QSGGeometry::Point2D* p = - reinterpret_cast< QSGGeometry::Point2D* >( m_geometry.vertexData() ); + auto p = reinterpret_cast< QSGGeometry::Point2D* >( m_geometry.vertexData() ); const qreal y0 = rect.y() + qskPeak; diff --git a/examples/sliders/main.cpp b/examples/sliders/main.cpp index 10f1d551..4de7e060 100644 --- a/examples/sliders/main.cpp +++ b/examples/sliders/main.cpp @@ -136,7 +136,7 @@ class SliderBox : public QskLinearBox for ( int i = 0; i < itemCount(); i++ ) { - if ( QskSlider* slider = qobject_cast< QskSlider* >( itemAtIndex( i ) ) ) + if ( auto slider = qobject_cast< QskSlider* >( itemAtIndex( i ) ) ) { slider->setObjectName( "Slider " + QString::number( i + 1 ) ); slider->setValue( slider->minimum() + @@ -156,7 +156,7 @@ class SliderBox : public QskLinearBox for ( int i = 0; i < itemCount(); i++ ) { - if ( QskSlider* slider = qobject_cast< QskSlider* >( itemAtIndex( i ) ) ) + if ( auto slider = qobject_cast< QskSlider* >( itemAtIndex( i ) ) ) { const Qt::Orientation orientation = inverted( slider->orientation() ); @@ -170,7 +170,7 @@ class SliderBox : public QskLinearBox slider->setVisible( orientation == Qt::Horizontal ); } } - else if ( QskSeparator* separator = qobject_cast< QskSeparator* >( itemAtIndex( i ) ) ) + else if ( auto separator = qobject_cast< QskSeparator* >( itemAtIndex( i ) ) ) { separator->setOrientation( inverted( separator->orientation() ) ); } @@ -195,24 +195,24 @@ int main( int argc, char* argv[] ) SkinnyFont::init( &app ); SkinnyShortcut::enable( SkinnyShortcut::AllShortcuts ); - QskPushButton* buttonFlip = new QskPushButton( "Flip" ); + auto buttonFlip = new QskPushButton( "Flip" ); buttonFlip->setSizePolicy( Qt::Horizontal, QskSizePolicy::Fixed ); buttonFlip->setFocus( true ); - SliderBox* sliderBox = new SliderBox(); + auto sliderBox = new SliderBox(); sliderBox->setBackgroundColor( QskRgbValue::PeachPuff ); QObject::connect( buttonFlip, &QskPushButton::clicked, sliderBox, &SliderBox::flip ); - QskLinearBox* mainBox = new QskLinearBox( Qt::Vertical ); + auto mainBox = new QskLinearBox( Qt::Vertical ); mainBox->setMargins( 10 ); mainBox->setSpacing( 10 ); mainBox->addItem( buttonFlip, Qt::AlignLeft ); mainBox->addItem( sliderBox ); mainBox->setStretchFactor( sliderBox, 10 ); - QskFocusIndicator* focusIndicator = new QskFocusIndicator(); + auto focusIndicator = new QskFocusIndicator(); focusIndicator->setObjectName( "FocusIndicator" ); QskWindow window;