qt - How to change the caption of a button in a QDialogButtonBox? -
i have added qdialogbuttonbox button default cancel , ok buttons.
is there way change caption of these buttons? example, ok should become run.
you have slight coding in cpp file:
ui->buttonbox->button(qdialogbuttonbox::ok)->settext("run"); ui->buttonbox->button(qdialogbuttonbox::cancel)->settext("exit"); note may need include qpushbutton header:
#include <qpushbutton> update:
did not notice pyqt tag. i'm not familiar python (and pyqt in particular), think should job:
self.ui.buttonbox.button(qdialogbuttonbox.ok).settext("run") self.ui.buttonbox.button(qdialogbuttonbox.cancel).settext("cancel") also, pointed out kuba ober, changing text of standard buttons not best approach. correct way add custom buttons appropriate role.
self.ui.buttonbox.addbutton("run", qdialogbuttonbox.actionrole)
Comments
Post a Comment