How to create your own, received QComboBox class, something like:
class MyComboBox : public QComboBox { Q_OBJECT private: QString _oldText; public: MyComboBox(QWidget *parent=0) : QComboBox(parent), _oldText() { connect(this,SIGNAL(editTextChanged(const QString&)), this, SLOT(myTextChangedSlot(const QString&))); connect(this,SIGNAL(currentIndexChanged(const QString&)), this, SLOT(myTextChangedSlot(const QString&))); } private slots: myTextChangedSlot(const QString &newText) { emit myTextChangedSignal(_oldText, newText); _oldText = newText; } signals: myTextChangedSignal(const QString &oldText, const QString &newText); };
And then just connect to myTextChangedSignal instead, which now additionally provides old combo text.
I hope this helps.
source share