本文整理汇总了C++中QDialogButtonBox::setSizePolicy方法的典型用法代码示例。如果您正苦于以下问题:C++ QDialogButtonBox::setSizePolicy方法的具体用法?C++ QDialogButtonBox::setSizePolicy怎么用?C++ QDialogButtonBox::setSizePolicy使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDialogButtonBox
的用法示例。
在下文中一共展示了QDialogButtonBox::setSizePolicy方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addParam
void EditParams::addParam(QWidget* parent, QGridLayout* layout, const ppk_proto_param* pparam)
{
if(!layout)
{
qDebug("EditParams::addParam: Tried to add a param to a NULL tab widget !\n");
return;
}
QAbstractFormField* field=abstractFormFieldFromParamProto(parent, pparam);
if(field)
{
field->setFieldName(QString::fromUtf8(pparam->name));
field->setHelpText(QString::fromUtf8(pparam->help_text));
int line=layout->rowCount();
QSizePolicy sizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
sizePolicy.setHorizontalStretch(0);
sizePolicy.setVerticalStretch(0);
field->widget()->setSizePolicy(sizePolicy);
field->widget()->setToolTip(QString::fromUtf8(pparam->help_text));
if(field->layout()!=NULL)
{
layout->addLayout(field->layout(), line, 1, 1, 1);
}
else
{
sizePolicy.setHeightForWidth(field->widget()->sizePolicy().hasHeightForWidth());
layout->addWidget(field->widget(), line, 1, 1, 1);
}
QLabel* nameParamLbl = new QLabel(createNameString(pparam), parent);
nameParamLbl->setToolTip(QString::fromUtf8(pparam->help_text));
nameParamLbl->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed);
layout->addWidget(nameParamLbl, line, 0, 1, 1);
QPushButton* helpParamBtn = new QPushButton(tr("?"), parent);
helpParamBtn->setObjectName(QString::fromUtf8("helpParamBtn"));
QSizePolicy sizePolicy1(QSizePolicy::Maximum, QSizePolicy::Fixed);
sizePolicy1.setHorizontalStretch(0);
sizePolicy1.setVerticalStretch(0);
sizePolicy1.setHeightForWidth(helpParamBtn->sizePolicy().hasHeightForWidth());
helpParamBtn->setSizePolicy(sizePolicy1);
helpParamBtn->setMaximumSize(QSize(40, 16777215));
helpParamBtn->setToolTip(QString::fromUtf8(pparam->help_text));
layout->addWidget(helpParamBtn, line, 2, 1, 1);
QDialogButtonBox* rstParamBtn = new QDialogButtonBox(parent);
rstParamBtn->setObjectName(QString::fromUtf8("rstParamBtn"));
sizePolicy1.setHeightForWidth(rstParamBtn->sizePolicy().hasHeightForWidth());
rstParamBtn->setSizePolicy(sizePolicy1);
rstParamBtn->setStandardButtons(QDialogButtonBox::Reset);
rstParamBtn->setToolTip(tr("Reset to the default value"));
layout->addWidget(rstParamBtn, line, 3, 1, 1);
//Add the field to the field vector
fields.push_back(field);
connect(helpParamBtn, SIGNAL(clicked()), field, SLOT(showHelpText()));
connect(rstParamBtn, SIGNAL(clicked(QAbstractButton*)), field, SLOT(reset()));
}
}