Unsolved 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?
-
Use
QLineEdit::textEdited(const QString &text)
signal ofQComboBox::lineEdit()
. -
@Buller
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. -
@Buller said in QComboBox, how to detect user edits:
QComboBox
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? -
@Buller
editTextChanged probably -
@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);
-
@Bonnie said in QComboBox, how to detect user edits:
m_combo_name->lineEdit()
m_combo_name->lineEdit() works. Thanks.