diff options
Diffstat (limited to 'examples/widgets/widgets/styles')
-rw-r--r-- | examples/widgets/widgets/styles/norwegianwoodstyle.cpp | 12 | ||||
-rw-r--r-- | examples/widgets/widgets/styles/widgetgallery.cpp | 36 | ||||
-rw-r--r-- | examples/widgets/widgets/styles/widgetgallery.h | 2 |
3 files changed, 25 insertions, 25 deletions
diff --git a/examples/widgets/widgets/styles/norwegianwoodstyle.cpp b/examples/widgets/widgets/styles/norwegianwoodstyle.cpp index 8aca91a686..1d7ef2637b 100644 --- a/examples/widgets/widgets/styles/norwegianwoodstyle.cpp +++ b/examples/widgets/widgets/styles/norwegianwoodstyle.cpp @@ -48,10 +48,10 @@ ** ****************************************************************************/ -#include <QtWidgets> - #include "norwegianwoodstyle.h" +#include <QtWidgets> + NorwegianWoodStyle::NorwegianWoodStyle() : QProxyStyle(QStyleFactory::create("windows")) { @@ -85,8 +85,8 @@ void NorwegianWoodStyle::polish(QPalette &palette) setTexture(palette, QPalette::Mid, midImage); setTexture(palette, QPalette::Window, backgroundImage); - QBrush brush = palette.background(); - brush.setColor(brush.color().dark()); + QBrush brush = palette.window(); + brush.setColor(brush.color().darker()); palette.setBrush(QPalette::Disabled, QPalette::WindowText, brush); palette.setBrush(QPalette::Disabled, QPalette::Text, brush); @@ -185,7 +185,7 @@ void NorwegianWoodStyle::drawPrimitive(PrimitiveElement element, qstyleoption_cast<const QStyleOptionButton *>(option); if (buttonOption && (buttonOption->features & QStyleOptionButton::Flat)) { - brush = option->palette.background(); + brush = option->palette.window(); darker = (option->state & (State_Sunken | State_On)); } else { if (option->state & (State_Sunken | State_On)) { @@ -261,7 +261,7 @@ void NorwegianWoodStyle::drawPrimitive(PrimitiveElement element, painter->setPen(bottomPen); painter->drawPath(roundRect); - painter->setPen(option->palette.foreground().color()); + painter->setPen(option->palette.windowText().color()); painter->setClipping(false); painter->drawPath(roundRect); diff --git a/examples/widgets/widgets/styles/widgetgallery.cpp b/examples/widgets/widgets/styles/widgetgallery.cpp index d44547d905..f0a0336a94 100644 --- a/examples/widgets/widgets/styles/widgetgallery.cpp +++ b/examples/widgets/widgets/styles/widgetgallery.cpp @@ -48,10 +48,10 @@ ** ****************************************************************************/ -#include <QtWidgets> - -#include "norwegianwoodstyle.h" #include "widgetgallery.h" +#include "norwegianwoodstyle.h" + +#include <QtWidgets> //! [0] WidgetGallery::WidgetGallery(QWidget *parent) @@ -79,19 +79,19 @@ WidgetGallery::WidgetGallery(QWidget *parent) //! [0] //! [1] - connect(styleComboBox, SIGNAL(activated(QString)), + connect(styleComboBox, QOverload<const QString &>::of(&QComboBox::activated), //! [1] //! [2] - this, SLOT(changeStyle(QString))); - connect(useStylePaletteCheckBox, SIGNAL(toggled(bool)), - this, SLOT(changePalette())); - connect(disableWidgetsCheckBox, SIGNAL(toggled(bool)), - topLeftGroupBox, SLOT(setDisabled(bool))); - connect(disableWidgetsCheckBox, SIGNAL(toggled(bool)), - topRightGroupBox, SLOT(setDisabled(bool))); - connect(disableWidgetsCheckBox, SIGNAL(toggled(bool)), - bottomLeftTabWidget, SLOT(setDisabled(bool))); - connect(disableWidgetsCheckBox, SIGNAL(toggled(bool)), - bottomRightGroupBox, SLOT(setDisabled(bool))); + this, &WidgetGallery::changeStyle); + connect(useStylePaletteCheckBox, &QCheckBox::toggled, + this, &WidgetGallery::changePalette); + connect(disableWidgetsCheckBox, &QCheckBox::toggled, + topLeftGroupBox, &QGroupBox::setDisabled); + connect(disableWidgetsCheckBox, &QCheckBox::toggled, + topRightGroupBox, &QGroupBox::setDisabled); + connect(disableWidgetsCheckBox, &QCheckBox::toggled, + bottomLeftTabWidget, &QGroupBox::setDisabled); + connect(disableWidgetsCheckBox, &QCheckBox::toggled, + bottomRightGroupBox, &QGroupBox::setDisabled); //! [2] //! [3] @@ -212,7 +212,7 @@ void WidgetGallery::createBottomLeftTabWidget() tableWidget = new QTableWidget(10, 10); QHBoxLayout *tab1hbox = new QHBoxLayout; - tab1hbox->setMargin(5); + tab1hbox->setContentsMargins(5,5, 5, 5); tab1hbox->addWidget(tableWidget); tab1->setLayout(tab1hbox); @@ -227,7 +227,7 @@ void WidgetGallery::createBottomLeftTabWidget() "How I wonder what you are!\n")); QHBoxLayout *tab2hbox = new QHBoxLayout; - tab2hbox->setMargin(5); + tab2hbox->setContentsMargins(5, 5, 5, 5); tab2hbox->addWidget(textEdit); tab2->setLayout(tab2hbox); @@ -279,7 +279,7 @@ void WidgetGallery::createProgressBar() progressBar->setValue(0); QTimer *timer = new QTimer(this); - connect(timer, SIGNAL(timeout()), this, SLOT(advanceProgressBar())); + connect(timer, &QTimer::timeout, this, &WidgetGallery::advanceProgressBar); timer->start(1000); } //! [13] diff --git a/examples/widgets/widgets/styles/widgetgallery.h b/examples/widgets/widgets/styles/widgetgallery.h index ec6edff536..9ee65c21c4 100644 --- a/examples/widgets/widgets/styles/widgetgallery.h +++ b/examples/widgets/widgets/styles/widgetgallery.h @@ -78,7 +78,7 @@ class WidgetGallery : public QDialog Q_OBJECT public: - WidgetGallery(QWidget *parent = 0); + WidgetGallery(QWidget *parent = nullptr); private slots: void changeStyle(const QString &styleName); |