QComboBox: remove currentIndexChanged(const QString&)

Fixes: QTBUG-81913
Task-number: QTBUG-81845
Change-Id: I8f24b858ce4e35b495440001d7734cc8f169cd5f
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Vitaly Fanaskov 2020-02-05 16:09:21 +01:00 committed by Shawn Rutledge
parent 181bece09a
commit 3703a28511
18 changed files with 27 additions and 63 deletions

View File

@ -57,7 +57,7 @@ CertificateInfo::CertificateInfo(QWidget *parent)
form = new Ui_CertificateInfo;
form->setupUi(this);
connect(form->certificationPathView, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(form->certificationPathView, &QComboBox::currentIndexChanged,
this, &CertificateInfo::updateCertificateInfo);
}

View File

@ -87,7 +87,7 @@ InformationWindow::InformationWindow(int id, QSqlRelationalTableModel *items,
connect(descriptionEditor, &QTextEdit::textChanged, [=]() {
enableButtons();
});
connect(imageFileEditor, QOverload<int>::of(&QComboBox::currentIndexChanged), [=]() {
connect(imageFileEditor, &QComboBox::currentIndexChanged, [=]() {
enableButtons();
});

View File

@ -283,7 +283,7 @@ QGroupBox* MainWindow::createArtistGroupBox()
artistView->setModel(model->relationModel(2));
artistView->setModelColumn(1);
connect(artistView, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(artistView, &QComboBox::currentIndexChanged,
this, &MainWindow::changeArtist);
QGroupBox *box = new QGroupBox(tr("Artist"));

View File

@ -80,7 +80,7 @@ Window::Window()
connect(showMessageButton, &QAbstractButton::clicked, this, &Window::showMessage);
connect(showIconCheckBox, &QAbstractButton::toggled, trayIcon, &QSystemTrayIcon::setVisible);
connect(iconComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(iconComboBox, &QComboBox::currentIndexChanged,
this, &Window::setIcon);
connect(trayIcon, &QSystemTrayIcon::messageClicked, this, &Window::messageClicked);
connect(trayIcon, &QSystemTrayIcon::activated, this, &Window::iconActivated);

View File

@ -89,9 +89,9 @@ Window::Window()
connect(filterPatternLineEdit, &QLineEdit::textChanged,
this, &Window::filterRegExpChanged);
connect(filterSyntaxComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(filterSyntaxComboBox, &QComboBox::currentIndexChanged,
this, &Window::filterRegExpChanged);
connect(filterColumnComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(filterColumnComboBox, &QComboBox::currentIndexChanged,
this, &Window::filterColumnChanged);
connect(filterCaseSensitivityCheckBox, &QAbstractButton::toggled,
this, &Window::filterRegExpChanged);

View File

@ -155,7 +155,7 @@ void Dialog::createOptionsGroupBox()
buttonsOrientationComboBox->addItem(tr("Vertical"), Qt::Vertical);
connect(buttonsOrientationComboBox,
QOverload<int>::of(&QComboBox::currentIndexChanged),
&QComboBox::currentIndexChanged,
this,
&Dialog::buttonsOrientationChanged);

View File

@ -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<int>::of(&QComboBox::currentIndexChanged),
connect(syntaxComboBox, &QComboBox::currentIndexChanged,
this, &RegExpDialog::refresh);
patternComboBox->addItem(tr("[A-Za-z_]+([A-Za-z_0-9]*)"));

View File

@ -225,7 +225,7 @@ RegularExpressionDialog::RegularExpressionDialog(QWidget *parent)
connect(offsetSpinBox, &QSpinBox::valueChanged,
this, &RegularExpressionDialog::refresh);
connect(matchTypeComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(matchTypeComboBox, &QComboBox::currentIndexChanged,
this, &RegularExpressionDialog::refresh);
connect(anchoredMatchOptionCheckBox, &QCheckBox::toggled, this, &RegularExpressionDialog::refresh);

View File

@ -313,19 +313,19 @@ void Window::createGeneralOptionsGroupBox()
verticalHeaderLabel->setBuddy(verticalHeaderCombo);
//! [11]
connect(localeCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(localeCombo, &QComboBox::currentIndexChanged,
this, &Window::localeChanged);
connect(firstDayCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(firstDayCombo, &QComboBox::currentIndexChanged,
this, &Window::firstDayChanged);
connect(selectionModeCombo, QOverload<int>::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<int>::of(&QComboBox::currentIndexChanged),
connect(horizontalHeaderCombo, &QComboBox::currentIndexChanged,
this, &Window::horizontalHeaderChanged);
connect(verticalHeaderCombo, QOverload<int>::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<int>::of(&QComboBox::currentIndexChanged),
connect(weekdayColorCombo, &QComboBox::currentIndexChanged,
this, &Window::weekdayFormatChanged);
connect(weekdayColorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(weekdayColorCombo, &QComboBox::currentIndexChanged,
this, &Window::reformatCalendarPage);
connect(weekendColorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(weekendColorCombo, &QComboBox::currentIndexChanged,
this, &Window::weekendFormatChanged);
connect(weekendColorCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(weekendColorCombo, &QComboBox::currentIndexChanged,
this, &Window::reformatCalendarPage);
connect(headerTextFormatCombo, QOverload<int>::of(&QComboBox::currentIndexChanged),
connect(headerTextFormatCombo, &QComboBox::currentIndexChanged,
this, &Window::reformatHeaders);
connect(firstFridayCheckBox, &QCheckBox::toggled,
this, &Window::reformatCalendarPage);

View File

@ -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<int>::of(&QComboBox::currentIndexChanged),
connect(filterCombo, &QComboBox::currentIndexChanged,
this, &MainWindow::filterChanged);
QLabel *fontLabel = new QLabel(tr("Font:"));

View File

@ -276,7 +276,7 @@ QPageSetupWidget::QPageSetupWidget(QWidget *parent)
connect(m_ui.unitCombo, &QComboBox::activated, this, &QPageSetupWidget::unitChanged);
connect(m_ui.pageSizeCombo, QOverload<int>::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<int>::of(&QComboBox::currentIndexChanged), this, &QPageSetupWidget::pagesPerSheetChanged);
connect(m_ui.pagesPerSheetCombo, &QComboBox::currentIndexChanged, this, &QPageSetupWidget::pagesPerSheetChanged);
}
// Init the Units combo box

View File

@ -487,7 +487,7 @@ bool QPrintPropertiesDialog::createAdvancedOptionsWidget()
if (choicesCb->count() > 1) {
connect(choicesCb, QOverload<int>::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();

View File

@ -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<int>::of(&QComboBox::currentIndexChanged), this, &QCupsJobWidget::toggleJobHoldTime);
connect(m_ui.jobHoldComboBox, &QComboBox::currentIndexChanged, this, &QCupsJobWidget::toggleJobHoldTime);
QCUPSSupport::JobHoldUntilWithTime jobHoldWithTime;

View File

@ -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)));
}
}

View File

@ -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)

View File

@ -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 &);

View File

@ -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()),

View File

@ -2763,7 +2763,7 @@ void tst_QComboBox::resetModel()
};
QComboBox cb;
StringListModel model({"1", "2"});
QSignalSpy spy(&cb, QOverload<int, const QString &>::of(&QComboBox::currentIndexChanged));
QSignalSpy spy(&cb, &QComboBox::currentIndexChanged);
QCOMPARE(spy.count(), 0);
QCOMPARE(cb.currentIndex(), -1); //no selection