From 0b325602b13e2af21e888fc2243541e528cbb4b8 Mon Sep 17 00:00:00 2001 From: Vitaly Fanaskov Date: Fri, 31 Jan 2020 15:20:41 +0100 Subject: QButtonGroup: remove deprecated signals Task-number: QTBUG-80906 Change-Id: I6f697b0a070ba4c401117fe7cdf02429b47d9a11 Reviewed-by: Christian Ehrlicher --- examples/widgets/widgets/icons/mainwindow.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'examples/widgets/widgets/icons/mainwindow.cpp') 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(id)); + : QApplication::style()->pixelMetric(static_cast(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::of(&QButtonGroup::buttonToggled), + connect(sizeButtonGroup, &QButtonGroup::buttonToggled, this, &MainWindow::changeSize); QRadioButton *smallRadioButton = new QRadioButton; -- cgit v1.2.3