I create an instance of QDialog and on the left of \'x\' (close) button i have also \'?\' button. How I can disable that \'?\' ?
If you just want to disable the button, you can call setEnabled(bool)
, but I doubt that's what's being asked.
If you want to remove that button, see below:
QDialog
is intended to use a QDialogButtonBox
as the buttons that show up on the dialog. You can use accessors available in QDialogButtonBox in order to disable the buttons you don't want (as well as enable others).
For example (from the documentation linked to above):
findButton = new QPushButton(tr("&Find"));
findButton->setDefault(true);
moreButton = new QPushButton(tr("&More"));
moreButton->setCheckable(true);
moreButton->setAutoDefault(false);
buttonBox = new QDialogButtonBox(Qt::Vertical);
buttonBox->addButton(findButton, QDialogButtonBox::ActionRole);
buttonBox->addButton(moreButton, QDialogButtonBox::ActionRole);
If you're not aware of the button box, I'd guess that designer automatically added it for you and it should have a name that makes it accessible. There should also be properties (checkboxes) that you can check in order to control which buttons are accessible by default.