本文整理汇总了C++中QDockWidget::titleBarWidget方法的典型用法代码示例。如果您正苦于以下问题:C++ QDockWidget::titleBarWidget方法的具体用法?C++ QDockWidget::titleBarWidget怎么用?C++ QDockWidget::titleBarWidget使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QDockWidget
的用法示例。
在下文中一共展示了QDockWidget::titleBarWidget方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sender
void
Style::dockLocationChanged( Qt::DockWidgetArea /*area*/ )
{
QDockWidget *dock = carriedDock ? carriedDock : qobject_cast<QDockWidget*>( sender() );
if ( !dock )
return;
if ( dock->isFloating() || !Hacks::config.lockDocks )
{
if ( QWidget *title = dock->titleBarWidget() )
{
if ( title->objectName() == "bespin_docktitle_dummy" )
{
dock->setTitleBarWidget(0);
title->deleteLater();
}
else
title->show();
}
}
else
{
QWidget *title = dock->titleBarWidget();
if ( !title )
{
title = new QWidget;
title->setObjectName( "bespin_docktitle_dummy" );
dock->setTitleBarWidget( title );
}
if ( title->objectName() == "bespin_docktitle_dummy" )
dock->titleBarWidget()->hide();
}
}
示例2: slotShowTitleBars
void HideTitleBars::slotShowTitleBars(bool show)
{
QList <QDockWidget *> docks = pCore->window()->findChildren<QDockWidget *>();
for (int i = 0; i < docks.count(); ++i) {
QDockWidget* dock = docks.at(i);
QWidget *bar = dock->titleBarWidget();
if (show) {
if (dock->isFloating()) {
if (bar) {
dock->setTitleBarWidget(0);
delete bar;
}
continue;
}
#if (QT_VERSION >= QT_VERSION_CHECK(5, 6, 0))
// Since Qt 5.6 we only display title bar in non tabbed dockwidgets
QList <QDockWidget*> docked = pCore->window()->tabifiedDockWidgets(dock);
if (docked.isEmpty()) {
if (bar) {
dock->setTitleBarWidget(0);
delete bar;
}
continue;
} else {
bool hasVisibleDockSibling = false;
foreach(QDockWidget *sub, docked) {
if (sub->toggleViewAction()->isChecked()) {
// we have another docked widget, so tabs are visible and can be used instead of title bars
hasVisibleDockSibling = true;
break;
}
}
if (!hasVisibleDockSibling) {
if (bar) {
dock->setTitleBarWidget(0);
delete bar;
}
continue;
}
}
if (!bar) {
dock->setTitleBarWidget(new QWidget);
}
#else
if (bar) {
dock->setTitleBarWidget(0);
delete bar;
}
#endif
} else {
if (!dock->isFloating() && !bar) {
dock->setTitleBarWidget(new QWidget);
}
}
}