在Designer中,选择OK或Cancel按钮.然后打开属性编辑器并向下滚动到该QDialogButtonBox部分.然后,您可以展开该standardButtons项目以查看可用的各种按钮.centerButtons酒店还提供其他物业,如酒店.
但是,设计师几乎无法控制按钮框.
在代码中,您可以执行许多其他操作,例如更改"标准按钮"上显示的文本.从文档:
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);
Run Code Online (Sandbox Code Playgroud)
只要在设计器中为按钮框指定名称,就可以在代码中设置这些属性.