From 3703a28511bed9daea2af57409db150cb3ed1a23 Mon Sep 17 00:00:00 2001 From: Vitaly Fanaskov Date: Wed, 5 Feb 2020 16:09:21 +0100 Subject: QComboBox: remove currentIndexChanged(const QString&) Fixes: QTBUG-81913 Task-number: QTBUG-81845 Change-Id: I8f24b858ce4e35b495440001d7734cc8f169cd5f Reviewed-by: Shawn Rutledge --- .../network/securesocketclient/certificateinfo.cpp | 2 +- examples/sql/drilldown/informationwindow.cpp | 2 +- examples/sql/masterdetail/mainwindow.cpp | 2 +- examples/widgets/desktop/systray/window.cpp | 2 +- .../itemviews/basicsortfiltermodel/window.cpp | 4 +-- examples/widgets/layouts/dynamiclayouts/dialog.cpp | 2 +- examples/widgets/tools/regexp/regexpdialog.cpp | 2 +- .../regularexpression/regularexpressiondialog.cpp | 2 +- examples/widgets/widgets/calendarwidget/window.cpp | 20 +++++++-------- .../widgets/widgets/charactermap/mainwindow.cpp | 2 +- src/printsupport/dialogs/qpagesetupdialog_unix.cpp | 4 +-- src/printsupport/dialogs/qprintdialog_unix.cpp | 2 +- src/printsupport/widgets/qcupsjobwidget.cpp | 2 +- src/widgets/dialogs/qinputdialog.cpp | 2 +- src/widgets/widgets/qcombobox.cpp | 30 ---------------------- src/widgets/widgets/qcombobox.h | 6 ----- src/widgets/widgets/qfontcombobox.cpp | 2 +- .../widgets/widgets/qcombobox/tst_qcombobox.cpp | 2 +- 18 files changed, 27 insertions(+), 63 deletions(-) diff --git a/examples/network/securesocketclient/certificateinfo.cpp b/examples/network/securesocketclient/certificateinfo.cpp index 81429fc655..9d0a674efe 100644 --- a/examples/network/securesocketclient/certificateinfo.cpp +++ b/examples/network/securesocketclient/certificateinfo.cpp @@ -57,7 +57,7 @@ CertificateInfo::CertificateInfo(QWidget *parent) form = new Ui_CertificateInfo; form->setupUi(this); - connect(form->certificationPathView, QOverload::of(&QComboBox::currentIndexChanged), + connect(form->certificationPathView, &QComboBox::currentIndexChanged, this, &CertificateInfo::updateCertificateInfo); } diff --git a/examples/sql/drilldown/informationwindow.cpp b/examples/sql/drilldown/informationwindow.cpp index 0007432672..349416b553 100644 --- a/examples/sql/drilldown/informationwindow.cpp +++ b/examples/sql/drilldown/informationwindow.cpp @@ -87,7 +87,7 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *items, connect(descriptionEditor, &QTextEdit::textChanged, [=]() { enableButtons(); }); - connect(imageFileEditor, QOverload::of(&QComboBox::currentIndexChanged), [=]() { + connect(imageFileEditor, &QComboBox::currentIndexChanged, [=]() { enableButtons(); }); diff --git a/examples/sql/masterdetail/mainwindow.cpp b/examples/sql/masterdetail/mainwindow.cpp index 2ff9a10d91..11f123372c 100644 --- a/examples/sql/masterdetail/mainwindow.cpp +++ b/examples/sql/masterdetail/mainwindow.cpp @@ -283,7 +283,7 @@ QGroupBox* MainWindow::createArtistGroupBox() artistView->setModel(model->relationModel(2)); artistView->setModelColumn(1); - connect(artistView, QOverload::of(&QComboBox::currentIndexChanged), + connect(artistView, &QComboBox::currentIndexChanged, this, &MainWindow::changeArtist); QGroupBox *box = new QGroupBox(tr("Artist")); diff --git a/examples/widgets/desktop/systray/window.cpp b/examples/widgets/desktop/systray/window.cpp index e30166beac..3238e3bf31 100644 --- a/examples/widgets/desktop/systray/window.cpp +++ b/examples/widgets/desktop/systray/window.cpp @@ -80,7 +80,7 @@ Window::Window() connect(showMessageButton, &QAbstractButton::clicked, this, &Window::showMessage); connect(showIconCheckBox, &QAbstractButton::toggled, trayIcon, &QSystemTrayIcon::setVisible); - connect(iconComboBox, QOverload::of(&QComboBox::currentIndexChanged), + connect(iconComboBox, &QComboBox::currentIndexChanged, this, &Window::setIcon); connect(trayIcon, &QSystemTrayIcon::messageClicked, this, &Window::messageClicked); connect(trayIcon, &QSystemTrayIcon::activated, this, &Window::iconActivated); diff --git a/examples/widgets/itemviews/basicsortfiltermodel/window.cpp b/examples/widgets/itemviews/basicsortfiltermodel/window.cpp index b45ee47ee2..bfc9044724 100644 --- a/examples/widgets/itemviews/basicsortfiltermodel/window.cpp +++ b/examples/widgets/itemviews/basicsortfiltermodel/window.cpp @@ -89,9 +89,9 @@ Window::Window() connect(filterPatternLineEdit, &QLineEdit::textChanged, this, &Window::filterRegExpChanged); - connect(filterSyntaxComboBox, QOverload::of(&QComboBox::currentIndexChanged), + connect(filterSyntaxComboBox, &QComboBox::currentIndexChanged, this, &Window::filterRegExpChanged); - connect(filterColumnComboBox, QOverload::of(&QComboBox::currentIndexChanged), + connect(filterColumnComboBox, &QComboBox::currentIndexChanged, this, &Window::filterColumnChanged); connect(filterCaseSensitivityCheckBox, &QAbstractButton::toggled, this, &Window::filterRegExpChanged); diff --git a/examples/widgets/layouts/dynamiclayouts/dialog.cpp b/examples/widgets/layouts/dynamiclayouts/dialog.cpp index baf3b4cf1e..bd9baa9faf 100644 --- a/examples/widgets/layouts/dynamiclayouts/dialog.cpp +++ b/examples/widgets/layouts/dynamiclayouts/dialog.cpp @@ -155,7 +155,7 @@ void Dialog::createOptionsGroupBox() buttonsOrientationComboBox->addItem(tr("Vertical"), Qt::Vertical); connect(buttonsOrientationComboBox, - QOverload::of(&QComboBox::currentIndexChanged), + &QComboBox::currentIndexChanged, this, &Dialog::buttonsOrientationChanged); diff --git a/examples/widgets/tools/regexp/regexpdialog.cpp b/examples/widgets/tools/regexp/regexpdialog.cpp index bf61d09974..e70bb7a530 100644 --- a/examples/widgets/tools/regexp/regexpdialog.cpp +++ b/examples/widgets/tools/regexp/regexpdialog.cpp @@ -142,7 +142,7 @@ RegExpDialog::RegExpDialog(QWidget *parent) connect(caseSensitiveCheckBox, &QAbstractButton::toggled, this, &RegExpDialog::refresh); connect(minimalCheckBox, &QAbstractButton::toggled, this, &RegExpDialog::refresh); - connect(syntaxComboBox, QOverload::of(&QComboBox::currentIndexChanged), + connect(syntaxComboBox, &QComboBox::currentIndexChanged, this, &RegExpDialog::refresh); patternComboBox->addItem(tr("[A-Za-z_]+([A-Za-z_0-9]*)")); diff --git a/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp b/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp index 2f2e2f6ea7..ff83193152 100644 --- a/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp +++ b/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp @@ -225,7 +225,7 @@ RegularExpressionDialog::RegularExpressionDialog(QWidget *parent) connect(offsetSpinBox, &QSpinBox::valueChanged, this, &RegularExpressionDialog::refresh); - connect(matchTypeComboBox, QOverload::of(&QComboBox::currentIndexChanged), + connect(matchTypeComboBox, &QComboBox::currentIndexChanged, this, &RegularExpressionDialog::refresh); connect(anchoredMatchOptionCheckBox, &QCheckBox::toggled, this, &RegularExpressionDialog::refresh); diff --git a/examples/widgets/widgets/calendarwidget/window.cpp b/examples/widgets/widgets/calendarwidget/window.cpp index ae10223dd4..23010a6e1a 100644 --- a/examples/widgets/widgets/calendarwidget/window.cpp +++ b/examples/widgets/widgets/calendarwidget/window.cpp @@ -313,19 +313,19 @@ void Window::createGeneralOptionsGroupBox() verticalHeaderLabel->setBuddy(verticalHeaderCombo); //! [11] - connect(localeCombo, QOverload::of(&QComboBox::currentIndexChanged), + connect(localeCombo, &QComboBox::currentIndexChanged, this, &Window::localeChanged); - connect(firstDayCombo, QOverload::of(&QComboBox::currentIndexChanged), + connect(firstDayCombo, &QComboBox::currentIndexChanged, this, &Window::firstDayChanged); - connect(selectionModeCombo, QOverload::of(&QComboBox::currentIndexChanged), + connect(selectionModeCombo, &QComboBox::currentIndexChanged, this, &Window::selectionModeChanged); connect(gridCheckBox, &QCheckBox::toggled, calendar, &QCalendarWidget::setGridVisible); connect(navigationCheckBox, &QCheckBox::toggled, calendar, &QCalendarWidget::setNavigationBarVisible); - connect(horizontalHeaderCombo, QOverload::of(&QComboBox::currentIndexChanged), + connect(horizontalHeaderCombo, &QComboBox::currentIndexChanged, this, &Window::horizontalHeaderChanged); - connect(verticalHeaderCombo, QOverload::of(&QComboBox::currentIndexChanged), + connect(verticalHeaderCombo, &QComboBox::currentIndexChanged, this, &Window::verticalHeaderChanged); //! [11] @@ -446,15 +446,15 @@ void Window::createTextFormatsGroupBox() mayFirstCheckBox = new QCheckBox(tr("May &1 in red")); //! [17] //! [18] - connect(weekdayColorCombo, QOverload::of(&QComboBox::currentIndexChanged), + connect(weekdayColorCombo, &QComboBox::currentIndexChanged, this, &Window::weekdayFormatChanged); - connect(weekdayColorCombo, QOverload::of(&QComboBox::currentIndexChanged), + connect(weekdayColorCombo, &QComboBox::currentIndexChanged, this, &Window::reformatCalendarPage); - connect(weekendColorCombo, QOverload::of(&QComboBox::currentIndexChanged), + connect(weekendColorCombo, &QComboBox::currentIndexChanged, this, &Window::weekendFormatChanged); - connect(weekendColorCombo, QOverload::of(&QComboBox::currentIndexChanged), + connect(weekendColorCombo, &QComboBox::currentIndexChanged, this, &Window::reformatCalendarPage); - connect(headerTextFormatCombo, QOverload::of(&QComboBox::currentIndexChanged), + connect(headerTextFormatCombo, &QComboBox::currentIndexChanged, this, &Window::reformatHeaders); connect(firstFridayCheckBox, &QCheckBox::toggled, this, &Window::reformatCalendarPage); diff --git a/examples/widgets/widgets/charactermap/mainwindow.cpp b/examples/widgets/widgets/charactermap/mainwindow.cpp index 702b50156b..47f7001a34 100644 --- a/examples/widgets/widgets/charactermap/mainwindow.cpp +++ b/examples/widgets/widgets/charactermap/mainwindow.cpp @@ -90,7 +90,7 @@ MainWindow::MainWindow(QWidget *parent) filterCombo->addItem(tr("Monospaced"), QVariant::fromValue(QFontComboBox::MonospacedFonts)); filterCombo->addItem(tr("Proportional"), QVariant::fromValue(QFontComboBox::ProportionalFonts)); filterCombo->setCurrentIndex(0); - connect(filterCombo, QOverload::of(&QComboBox::currentIndexChanged), + connect(filterCombo, &QComboBox::currentIndexChanged, this, &MainWindow::filterChanged); QLabel *fontLabel = new QLabel(tr("Font:")); diff --git a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp index 185349af11..2b7c0ce6ec 100644 --- a/src/printsupport/dialogs/qpagesetupdialog_unix.cpp +++ b/src/printsupport/dialogs/qpagesetupdialog_unix.cpp @@ -276,7 +276,7 @@ QPageSetupWidget::QPageSetupWidget(QWidget *parent) connect(m_ui.unitCombo, &QComboBox::activated, this, &QPageSetupWidget::unitChanged); - connect(m_ui.pageSizeCombo, QOverload::of(&QComboBox::currentIndexChanged), this, &QPageSetupWidget::pageSizeChanged); + connect(m_ui.pageSizeCombo, &QComboBox::currentIndexChanged, this, &QPageSetupWidget::pageSizeChanged); connect(m_ui.pageWidth, &QDoubleSpinBox::valueChanged, this, &QPageSetupWidget::pageSizeChanged); connect(m_ui.pageHeight, &QDoubleSpinBox::valueChanged, this, &QPageSetupWidget::pageSizeChanged); @@ -288,7 +288,7 @@ QPageSetupWidget::QPageSetupWidget(QWidget *parent) connect(m_ui.portrait, &QRadioButton::clicked, this, &QPageSetupWidget::pageOrientationChanged); connect(m_ui.landscape, &QRadioButton::clicked, this, &QPageSetupWidget::pageOrientationChanged); - connect(m_ui.pagesPerSheetCombo, QOverload::of(&QComboBox::currentIndexChanged), this, &QPageSetupWidget::pagesPerSheetChanged); + connect(m_ui.pagesPerSheetCombo, &QComboBox::currentIndexChanged, this, &QPageSetupWidget::pagesPerSheetChanged); } // Init the Units combo box diff --git a/src/printsupport/dialogs/qprintdialog_unix.cpp b/src/printsupport/dialogs/qprintdialog_unix.cpp index bf77666c41..f3b47bcbd2 100644 --- a/src/printsupport/dialogs/qprintdialog_unix.cpp +++ b/src/printsupport/dialogs/qprintdialog_unix.cpp @@ -487,7 +487,7 @@ bool QPrintPropertiesDialog::createAdvancedOptionsWidget() if (choicesCb->count() > 1) { - connect(choicesCb, QOverload::of(&QComboBox::currentIndexChanged), this, setPpdOptionFromCombo); + connect(choicesCb, &QComboBox::currentIndexChanged, this, setPpdOptionFromCombo); // We need an extra label at the end to show the conflict warning QWidget *choicesCbWithLabel = new QWidget(); diff --git a/src/printsupport/widgets/qcupsjobwidget.cpp b/src/printsupport/widgets/qcupsjobwidget.cpp index 456ed9db19..6d9e7432bc 100644 --- a/src/printsupport/widgets/qcupsjobwidget.cpp +++ b/src/printsupport/widgets/qcupsjobwidget.cpp @@ -125,7 +125,7 @@ void QCupsJobWidget::initJobHold() m_ui.jobHoldComboBox->addItem(tr("Weekend (Saturday to Sunday)"), QVariant::fromValue(QCUPSSupport::Weekend)); m_ui.jobHoldComboBox->addItem(tr("Specific Time"), QVariant::fromValue(QCUPSSupport::SpecificTime)); - connect(m_ui.jobHoldComboBox, QOverload::of(&QComboBox::currentIndexChanged), this, &QCupsJobWidget::toggleJobHoldTime); + connect(m_ui.jobHoldComboBox, &QComboBox::currentIndexChanged, this, &QCupsJobWidget::toggleJobHoldTime); QCUPSSupport::JobHoldUntilWithTime jobHoldWithTime; diff --git a/src/widgets/dialogs/qinputdialog.cpp b/src/widgets/dialogs/qinputdialog.cpp index eeb0613d79..479e45ff56 100644 --- a/src/widgets/dialogs/qinputdialog.cpp +++ b/src/widgets/dialogs/qinputdialog.cpp @@ -300,7 +300,7 @@ void QInputDialogPrivate::ensureComboBox() comboBox->hide(); QObject::connect(comboBox, SIGNAL(editTextChanged(QString)), q, SLOT(_q_textChanged(QString))); - QObject::connect(comboBox, SIGNAL(currentIndexChanged(QString)), + QObject::connect(comboBox, SIGNAL(currentTextChanged(QString)), q, SLOT(_q_textChanged(QString))); } } diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 3cfa213245..9c1bd1e79a 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -932,29 +932,6 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const highlighted by the user. The item's \a text is passed. */ -/*! - \fn void QComboBox::currentIndexChanged(int index) - \since 4.1 - - This signal is sent whenever the currentIndex in the combobox - changes either through user interaction or programmatically. The - item's \a index is passed or -1 if the combobox becomes empty or the - currentIndex was reset. - - \obsolete Use currentIndexChanged(int index, const QString &text) instead -*/ - -/*! - \fn void QComboBox::currentIndexChanged(const QString &text) - \since 4.1 - - This signal is sent whenever the currentIndex in the combobox - changes either through user interaction or programmatically. The - item's \a text is passed. - - \obsolete Use currentIndexChanged(int index, const QString &text) instead -*/ - /*! \fn void QComboBox::currentIndexChanged(int index, const QString &text) \since 5.15 @@ -1435,13 +1412,6 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index) { Q_Q(QComboBox); const QString text = itemText(index); -#if QT_DEPRECATED_SINCE(5, 15) - QT_WARNING_PUSH - QT_WARNING_DISABLE_DEPRECATED - emit q->currentIndexChanged(index.row()); - emit q->currentIndexChanged(text); - QT_WARNING_POP -#endif emit q->currentIndexChanged(index.row(), text); // signal lineEdit.textChanged already connected to signal currentTextChanged, so don't emit double here if (!lineEdit) diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index 56386a4b8c..444c834e88 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -230,12 +230,6 @@ Q_SIGNALS: void textActivated(const QString &); void highlighted(int index); void textHighlighted(const QString &); -#if QT_DEPRECATED_SINCE(5, 15) - QT_DEPRECATED_VERSION_X_5_15("Use currentIndexChanged(int, const QString &) instead") - void currentIndexChanged(int index); - QT_DEPRECATED_VERSION_X_5_15("Use currentIndexChanged(int, const QString &) instead") - void currentIndexChanged(const QString &); -#endif void currentIndexChanged(int index, const QString &text); void currentTextChanged(const QString &); diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp index 4a99b0f962..cb665de889 100644 --- a/src/widgets/widgets/qfontcombobox.cpp +++ b/src/widgets/widgets/qfontcombobox.cpp @@ -427,7 +427,7 @@ QFontComboBox::QFontComboBox(QWidget *parent) lview->setUniformItemSizes(true); setWritingSystem(QFontDatabase::Any); - connect(this, SIGNAL(currentIndexChanged(QString)), + connect(this, SIGNAL(currentTextChanged(QString)), this, SLOT(_q_currentChanged(QString))); connect(qApp, SIGNAL(fontDatabaseChanged()), diff --git a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp index 6aca84e3cd..bd3c6d1f03 100644 --- a/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp +++ b/tests/auto/widgets/widgets/qcombobox/tst_qcombobox.cpp @@ -2763,7 +2763,7 @@ void tst_QComboBox::resetModel() }; QComboBox cb; StringListModel model({"1", "2"}); - QSignalSpy spy(&cb, QOverload::of(&QComboBox::currentIndexChanged)); + QSignalSpy spy(&cb, &QComboBox::currentIndexChanged); QCOMPARE(spy.count(), 0); QCOMPARE(cb.currentIndex(), -1); //no selection -- cgit v1.2.3