gpt4 book ai didi

c++ - 如何更改 Qt Designer 中按钮框内按钮的属性?

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:22:57 25 4
gpt4 key购买 nike

我在网上查了很久都没有。有谁知道如何访问按钮框中的按钮(使用“右按钮对话框”模板创建)?

最佳答案

在 Designer 中,选择 OKCancel 按钮。然后打开属性编辑器并向下滚动到 QDialogButtonBox部分。然后您可以展开 standardButtons 项以查看可用的各种按钮。其他属性,例如 centerButtons属性,也可用。

但是,设计器让您对按钮框的控制非常少。

在代码中,您可以做很多其他事情,例如更改出现在“标准按钮”上的文本。来自documentation :

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);

只要在设计器中给按钮框起个名字,就可以在代码中设置这些属性。

关于c++ - 如何更改 Qt Designer 中按钮框内按钮的属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2671323/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com