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