Change property of QInputDialog button
Hi, I have this problem. I have application where I use QInputDialog for passwords. What I want is to disable Ok button until user inputs at least 4 numbers into dialog. Is there some way to do it? I can retrieve length of input by reacting on signal textValueChanged(QString), but how to change property of QInputDialog button? Is it even possible? :(
Re: Change property of QInputDialog button
Quote:
Originally Posted by
Raadush
Hi, I have this problem. I have application where I use QInputDialog for passwords. What I want is to disable Ok button until user inputs at least 4 numbers into dialog. Is there some way to do it? I can retrieve length of input by reacting on signal textValueChanged(QString), but how to change property of QInputDialog button? Is it even possible? :(
i think you cant enable/disable the standard buttons from qinputdialog.
Why you doesn't make a QWidget with QLineEdit field and implent your own qpushbutton? then you can check the length of the qlineedit and enable/disable the qpushbutton.
i think that is the better way to handle this.
Re: Change property of QInputDialog button
Well, you can access the buttons:
Code:
d.show();
QList<QDialogButtonBox*> l = d.findChildren<QDialogButtonBox*>();
if (!l.isEmpty())
but you shouldn't. Better code your own dialog.