How to refresh a widget

  • I have a QDialog with three QPushbuttons, yes, sureYes, no. Just want to play with Qt. I want to have the no button is the default each time when dialog shows. I called noBtn->setDefault(true) and then *this->update() *before I call show() to display the dialog. But it desn't work. which method I should call to make the noBtn always gain the focus when it shows?

  • The default button is the one actioned by pressing Enter (if an autoDefault button does not have focus), It does not necessarily have the focus. If you want that button to have the focus call noBtn->setFocus().

    No need to call update() at all (pointless before it is shown anyway),

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.