本文整理汇总了C++中QAbstractButton::setObjectName方法的典型用法代码示例。如果您正苦于以下问题:C++ QAbstractButton::setObjectName方法的具体用法?C++ QAbstractButton::setObjectName怎么用?C++ QAbstractButton::setObjectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAbstractButton
的用法示例。
在下文中一共展示了QAbstractButton::setObjectName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
void QDockWidgetPrivate::init()
{
Q_Q(QDockWidget);
QDockWidgetLayout *layout = new QDockWidgetLayout(q);
layout->setSizeConstraint(QLayout::SetMinAndMaxSize);
QAbstractButton *button = new QDockWidgetTitleButton(q);
button->setObjectName(QLatin1String("qt_dockwidget_floatbutton"));
QObject::connect(button, SIGNAL(clicked()), q, SLOT(_q_toggleTopLevel()));
layout->setWidgetForRole(QDockWidgetLayout::FloatButton, button);
button = new QDockWidgetTitleButton(q);
button->setObjectName(QLatin1String("qt_dockwidget_closebutton"));
QObject::connect(button, SIGNAL(clicked()), q, SLOT(close()));
layout->setWidgetForRole(QDockWidgetLayout::CloseButton, button);
resizer = new QWidgetResizeHandler(q);
resizer->setMovingEnabled(false);
resizer->setActive(false);
#ifndef QT_NO_ACTION
toggleViewAction = new QAction(q);
toggleViewAction->setCheckable(true);
fixedWindowTitle = qt_setWindowTitle_helperHelper(q->windowTitle(), q);
toggleViewAction->setText(fixedWindowTitle);
QObject::connect(toggleViewAction, SIGNAL(triggered(bool)),
q, SLOT(_q_toggleView(bool)));
#endif
updateButtons();
}
示例2: View
CSVSettings::BooleanView::BooleanView (CSMSettings::Setting *setting,
Page *parent)
: View (setting, parent), mType(setting->type())
{
foreach (const QString &value, setting->declaredValues())
{
QAbstractButton *button = 0;
switch (mType)
{
case CSMSettings::Type_CheckBox: {
if(mButtons.empty()) // show only one for checkboxes
{
button = new QCheckBox (value, this);
button->setChecked (setting->defaultValues().at(0) == "true" ? true : false);
// special visual treatment option for checkboxes
if(setting->specialValueText() != "") {
Frame::setTitle("");
button->setText(setting->specialValueText());
}
}
}
break;
case CSMSettings::Type_RadioButton:
button = new QRadioButton (value, this);
break;
default:
break;
}
if(button && (mType != CSMSettings::Type_CheckBox || mButtons.empty()))
{
connect (button, SIGNAL (clicked (bool)),
this, SLOT (slotToggled (bool)));
button->setObjectName (value);
addWidget (button);
mButtons[value] = button;
}
}