Button enable signal does not work.
Solved
General and Desktop
-
Hi, I don't know what went wrong.
- I set the default of the button to false.
findButton->setEnabled(false);
- I connected as below.
connect(lineEdit, SIGNAL(textChanged(const QString &)), this, SLOT(enableFindButton(const Qstring &)));
3.I defined enableFindButton like this.
void FindDialog::enableFindButton(const QString &text){ findButton->setEnabled(!text.isEmpty()); }
But, It is not work.
What did I do wrong?
Thanks.
-
@Kycho said in Button enable signal does not work.:
connect(lineEdit, SIGNAL(textChanged(const QString &)),
this, SLOT(enableFindButton(const Qstring &)));There is a typo (Qstring). You will also get a warning at runtime about this error.
To avoid this completely I suggest to use the new signal/slot syntax:connect(lineEdit, &QLineEdit::textChanged, this, &FindDialog::enableFindButton);
-
@Christian-Ehrlicher Thank you.
I've fixed the issue.