本文整理汇总了C++中QDockWidgetLayout::setWidgetForRole方法的典型用法代码示例。如果您正苦于以下问题:C++ QDockWidgetLayout::setWidgetForRole方法的具体用法?C++ QDockWidgetLayout::setWidgetForRole怎么用?C++ QDockWidgetLayout::setWidgetForRole使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDockWidgetLayout
的用法示例。
在下文中一共展示了QDockWidgetLayout::setWidgetForRole方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: setTitleBarWidget
void QDockWidget::setTitleBarWidget(QWidget *widget)
{
Q_D(QDockWidget);
QDockWidgetLayout *layout
= qobject_cast<QDockWidgetLayout*>(this->layout());
layout->setWidgetForRole(QDockWidgetLayout::TitleBar, widget);
d->updateButtons();
if (isWindow()) {
//this ensures the native decoration is drawn
d->setWindowState(true /*floating*/, true /*unplug*/);
}
}
示例3: setWidget
/*!
Sets the widget for the dock widget to \a widget.
If the dock widget is visible when \a widget is added, you must
\l{QWidget::}{show()} it explicitly.
Note that you must add the layout of the \a widget before you call
this function; if not, the \a widget will not be visible.
\sa widget()
*/
void QDockWidget::setWidget(QWidget *widget)
{
QDockWidgetLayout *layout = qobject_cast<QDockWidgetLayout*>(this->layout());
layout->setWidgetForRole(QDockWidgetLayout::Content, widget);
}