QComboBox: deprecate signal currentIndexChanged(const QString &)

QComboBox has two overloaded signals currentIndexChanged(). This results
in a need to use QOverload<>::of or similar when using the new
signal/slot syntax.
Since there is already a signal 'currentTextChanged()' which is
emitted too, deprecate 'currentIndexChanged(const QString &)'.

Change-Id: Iadac8930de1721b042fa1daea097c8ab5378738e
Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Christian Ehrlicher 2019-02-01 22:39:43 +01:00
parent a7123de6c9
commit 0e82e1bd23
2 changed files with 12 additions and 0 deletions

View File

@ -895,14 +895,21 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const
currentIndex was reset.
*/
#if QT_DEPRECATED_SINCE(5, 13)
/*!
\fn void QComboBox::currentIndexChanged(const QString &text)
\since 4.1
\obsolete
Use currentTextChanged(const QString &) or currentIndexChanged(int)
instead.
This signal is sent whenever the currentIndex in the combobox
changes either through user interaction or programmatically. The
item's \a text is passed.
*/
#endif
/*!
\fn void QComboBox::currentTextChanged(const QString &text)
@ -1375,7 +1382,9 @@ void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)
Q_Q(QComboBox);
const QString text = itemText(index);
emit q->currentIndexChanged(index.row());
#if QT_DEPRECATED_SINCE(5, 13)
emit q->currentIndexChanged(text);
#endif
// signal lineEdit.textChanged already connected to signal currentTextChanged, so don't emit double here
if (!lineEdit)
emit q->currentTextChanged(text);

View File

@ -224,7 +224,10 @@ Q_SIGNALS:
void highlighted(int index);
void highlighted(const QString &);
void currentIndexChanged(int index);
#if QT_DEPRECATED_SINCE(5, 13)
QT_DEPRECATED_X("Use currentTextChanged() instead")
void currentIndexChanged(const QString &);
#endif
void currentTextChanged(const QString &);
protected: