QComboBox: add two new signals textHighlighted() and textActivated()

To avoid overloaded signals for highlighted() and activated() add two
new signals textHighlighted()/textActivated() and deprecate the old
QString overloads.

[ChangeLog][QtWidgets][QComboBox] Two new signals textHighlighted() and
textActivated() were added to replace highlighted()/activated() QString
overloads

Change-Id: I62df7e606b335b5c756315a800654d7d0de442bd
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
bb10
Christian Ehrlicher 2019-02-05 20:30:43 +01:00
parent 656ce9fa9d
commit bdf1c4f671
2 changed files with 15 additions and 3 deletions

View File

@ -1364,7 +1364,10 @@ void QComboBoxPrivate::emitActivated(const QModelIndex &index)
return;
QString text(itemText(index));
emit q->activated(index.row());
emit q->textActivated(text);
#if QT_DEPRECATED_SINCE(5, 15)
emit q->activated(text);
#endif
}
void QComboBoxPrivate::_q_emitHighlighted(const QModelIndex &index)
@ -1374,7 +1377,10 @@ void QComboBoxPrivate::_q_emitHighlighted(const QModelIndex &index)
return;
QString text(itemText(index));
emit q->highlighted(index.row());
emit q->textHighlighted(text);
#if QT_DEPRECATED_SINCE(5, 15)
emit q->highlighted(text);
#endif
}
void QComboBoxPrivate::_q_emitCurrentIndexChanged(const QModelIndex &index)

View File

@ -220,15 +220,21 @@ public Q_SLOTS:
Q_SIGNALS:
void editTextChanged(const QString &);
void activated(int index);
void activated(const QString &);
void textActivated(const QString &);
void highlighted(int index);
void highlighted(const QString &);
void textHighlighted(const QString &);
void currentIndexChanged(int index);
void currentTextChanged(const QString &);
#if QT_DEPRECATED_SINCE(5, 13)
QT_DEPRECATED_X("Use currentTextChanged() instead")
void currentIndexChanged(const QString &);
#endif
void currentTextChanged(const QString &);
#if QT_DEPRECATED_SINCE(5, 15)
QT_DEPRECATED_X("Use textActivated() instead")
void activated(const QString &);
QT_DEPRECATED_X("Use textHighlighted() instead")
void highlighted(const QString &);
#endif
protected:
void focusInEvent(QFocusEvent *e) override;