Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QComboBox, how to detect user edits
I have got an editable QComboBox and wish to detect when the text changes due to a user edits (i.e. when the user types) , but I do not want a signal when the text is changed from code. Is there a way to do that?
Bonnie last edited by
QLineEdit::textEdited(const QString &text)signal of
JonB last edited by
As @Bonnie has said. Note the docs difference between https://doc.qt.io/qt-5/qlineedit.html#textChanged versus https://doc.qt.io/qt-5/qlineedit.html#textEdited, which is what you are asking about.
The problem is that I cannot input the QComboBox's QLineEdit::textEdited to connect. What I think I need is:
connect(m_combo_name, &QComboBox::QLineEdit::textEdited, this, &MyWidget::slot_handle_text);
But "&QComboBox::QLineEdit::textEdited" is not valid syntax. Neither is "&QComboBox::textEdited". So what is the correct syntax here?
Bonnie last edited by Bonnie
@Buller I expected a developer would figure this out with these enough information...fine...
connect(m_combo_name->lineEdit(), &QLineEdit::textEdited, this, &MyWidget::slot_handle_text);
m_combo_name->lineEdit() works. Thanks.