summaryrefslogtreecommitdiffstats
path: root/examples/widgets/widgets/icons
diff options
context:
space:
mode:
authorVitaly Fanaskov <vitaly.fanaskov@qt.io>2020-01-31 15:20:41 +0100
committerVitaly Fanaskov <vitaly.fanaskov@qt.io>2020-02-02 02:05:49 +0100
commit0b325602b13e2af21e888fc2243541e528cbb4b8 (patch)
treef6adadc8625b2938e49a9e1d4fa7a52a9c513643 /examples/widgets/widgets/icons
parent511cb760ee1a35ee1adbb253f5d3f0c16bb91df5 (diff)
QButtonGroup: remove deprecated signals
Task-number: QTBUG-80906 Change-Id: I6f697b0a070ba4c401117fe7cdf02429b47d9a11 Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Diffstat (limited to 'examples/widgets/widgets/icons')
-rw-r--r--examples/widgets/widgets/icons/mainwindow.cpp11
-rw-r--r--examples/widgets/widgets/icons/mainwindow.h3
2 files changed, 8 insertions, 6 deletions
diff --git a/examples/widgets/widgets/icons/mainwindow.cpp b/examples/widgets/widgets/icons/mainwindow.cpp
index 4f990f7320..928470b054 100644
--- a/examples/widgets/widgets/icons/mainwindow.cpp
+++ b/examples/widgets/widgets/icons/mainwindow.cpp
@@ -172,15 +172,16 @@ void MainWindow::changeStyle(bool checked)
//! [4]
//! [5]
-void MainWindow::changeSize(int id, bool checked)
+void MainWindow::changeSize(QAbstractButton *button, bool checked)
{
if (!checked)
return;
- const bool other = id == int(OtherSize);
+ const int index = sizeButtonGroup->id(button);
+ const bool other = index == int(OtherSize);
const int extent = other
? otherSpinBox->value()
- : QApplication::style()->pixelMetric(static_cast<QStyle::PixelMetric>(id));
+ : QApplication::style()->pixelMetric(static_cast<QStyle::PixelMetric>(index));
previewArea->setSize(QSize(extent, extent));
otherSpinBox->setEnabled(other);
@@ -188,7 +189,7 @@ void MainWindow::changeSize(int id, bool checked)
void MainWindow::triggerChangeSize()
{
- changeSize(sizeButtonGroup->checkedId(), true);
+ changeSize(sizeButtonGroup->checkedButton(), true);
}
//! [5]
@@ -372,7 +373,7 @@ QWidget *MainWindow::createIconSizeGroupBox()
sizeButtonGroup = new QButtonGroup(this);
sizeButtonGroup->setExclusive(true);
- connect(sizeButtonGroup, QOverload<int, bool>::of(&QButtonGroup::buttonToggled),
+ connect(sizeButtonGroup, &QButtonGroup::buttonToggled,
this, &MainWindow::changeSize);
QRadioButton *smallRadioButton = new QRadioButton;
diff --git a/examples/widgets/widgets/icons/mainwindow.h b/examples/widgets/widgets/icons/mainwindow.h
index c67d828cab..9250711ecc 100644
--- a/examples/widgets/widgets/icons/mainwindow.h
+++ b/examples/widgets/widgets/icons/mainwindow.h
@@ -62,6 +62,7 @@ class QActionGroup;
class QLabel;
class QButtonGroup;
class QTableWidget;
+class QAbstractButton;
QT_END_NAMESPACE
class IconPreviewArea;
class IconSizeSpinBox;
@@ -81,7 +82,7 @@ public:
private slots:
void about();
void changeStyle(bool checked);
- void changeSize(int, bool);
+ void changeSize(QAbstractButton *button, bool);
void triggerChangeSize();
void changeIcon();
void addSampleImages();