From 0e82e1bd237fe295e0e30ec3613afd95142f3941 Mon Sep 17 00:00:00 2001 From: Christian Ehrlicher Date: Fri, 1 Feb 2019 22:39:43 +0100 Subject: 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 Reviewed-by: Richard Moe Gustavsen --- src/widgets/widgets/qcombobox.cpp | 9 +++++++++ src/widgets/widgets/qcombobox.h | 3 +++ 2 files changed, 12 insertions(+) (limited to 'src/widgets') diff --git a/src/widgets/widgets/qcombobox.cpp b/src/widgets/widgets/qcombobox.cpp index 2c478f364d..f3e6bd80f4 100644 --- a/src/widgets/widgets/qcombobox.cpp +++ b/src/widgets/widgets/qcombobox.cpp @@ -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); diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index 542a3bd3b9..64fbebb3c5 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -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: -- cgit v1.2.3