diff options
author | Vitaly Fanaskov <vitaly.fanaskov@qt.io> | 2020-02-05 10:53:19 +0100 |
---|---|---|
committer | Vitaly Fanaskov <vitaly.fanaskov@qt.io> | 2020-02-11 10:37:10 +0100 |
commit | 11dc7b35c8c3957bd19087a5e3ae7cfc4f1a3343 (patch) | |
tree | 085d4730b93683229e7db306084171a0ceb7007b /src/widgets | |
parent | e541a3f099798e2258116d3c031b35274d789783 (diff) |
QComboBox: deprecate currentIndexChanged(const QString&)
Task-number: QTBUG-81845
Change-Id: Ia0ff5321423a5d3d4853bd425dd7236926f16047
Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de>
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/widgets/qcombobox.cpp | 19 | ||||
-rw-r--r-- | src/widgets/widgets/qcombobox.h | 5 |
2 files changed, 22 insertions, 2 deletions
diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index bc9d01ac38..8c05c6de7a 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -959,6 +959,8 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const 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 */ /*! @@ -968,6 +970,18 @@ QStyleOptionComboBox QComboBoxPrivateContainer::comboStyleOption() const 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 + + 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. The item's \a text is also passed. */ /*! @@ -1452,13 +1466,14 @@ 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) +#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) emit q->currentTextChanged(text); diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index 4f89d7f542..1f6e2fcdb3 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -230,8 +230,13 @@ 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 &); #if QT_DEPRECATED_SINCE(5, 15) QT_DEPRECATED_VERSION_X(5, 15, "Use textActivated() instead") |