mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 15:41:34 +08:00
Added new config flag HideSingleCentralWidgetTitleBar to enble a central single dock widget in the main dock container (dock manager) without titlebar
Added a test case for the new flag to MainWindow.cpp
This commit is contained in:
parent
12bb7b73e9
commit
a668fe2f73
@ -386,7 +386,6 @@ void MainWindowPrivate::createContent()
|
|||||||
// We create a calendar widget and clear all flags to prevent the dock area
|
// We create a calendar widget and clear all flags to prevent the dock area
|
||||||
// from closing
|
// from closing
|
||||||
DockWidget = createCalendarDockWidget(ViewMenu);
|
DockWidget = createCalendarDockWidget(ViewMenu);
|
||||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetClosable, false);
|
|
||||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetMovable, false);
|
DockWidget->setFeature(ads::CDockWidget::DockWidgetMovable, false);
|
||||||
DockWidget->setFeature(ads::CDockWidget::DockWidgetFloatable, false);
|
DockWidget->setFeature(ads::CDockWidget::DockWidgetFloatable, false);
|
||||||
DockWidget->setTabToolTip(QString("Tab ToolTip\nHodie est dies magna"));
|
DockWidget->setTabToolTip(QString("Tab ToolTip\nHodie est dies magna"));
|
||||||
@ -550,6 +549,11 @@ CMainWindow::CMainWindow(QWidget *parent) :
|
|||||||
// uncomment the following line if you want floating container to show active dock widget's icon instead of always showing application icon
|
// uncomment the following line if you want floating container to show active dock widget's icon instead of always showing application icon
|
||||||
//CDockManager::setConfigFlag(CDockManager::FloatingContainerHasWidgetIcon, true);
|
//CDockManager::setConfigFlag(CDockManager::FloatingContainerHasWidgetIcon, true);
|
||||||
|
|
||||||
|
// uncomment the following line if you want a central widget in the main dock container (the dock manager) without a titlebar
|
||||||
|
// If you enable this code, you can test it in the demo with the Calendar 0
|
||||||
|
// dock widget.
|
||||||
|
// CDockManager::setConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar, true);
|
||||||
|
|
||||||
// Now create the dock manager and its content
|
// Now create the dock manager and its content
|
||||||
d->DockManager = new CDockManager(this);
|
d->DockManager = new CDockManager(this);
|
||||||
|
|
||||||
|
@ -488,7 +488,7 @@ void CDockAreaWidget::hideAreaWithNoVisibleContent()
|
|||||||
|
|
||||||
//Hide empty floating widget
|
//Hide empty floating widget
|
||||||
CDockContainerWidget* Container = this->dockContainer();
|
CDockContainerWidget* Container = this->dockContainer();
|
||||||
if (!Container->isFloating())
|
if (!Container->isFloating() && !CDockManager::testConfigFlag(CDockManager::HideSingleCentralWidgetTitleBar))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -497,11 +497,14 @@ void CDockAreaWidget::hideAreaWithNoVisibleContent()
|
|||||||
auto TopLevelWidget = Container->topLevelDockWidget();
|
auto TopLevelWidget = Container->topLevelDockWidget();
|
||||||
auto FloatingWidget = Container->floatingWidget();
|
auto FloatingWidget = Container->floatingWidget();
|
||||||
if (TopLevelWidget)
|
if (TopLevelWidget)
|
||||||
|
{
|
||||||
|
if (FloatingWidget)
|
||||||
{
|
{
|
||||||
FloatingWidget->updateWindowTitle();
|
FloatingWidget->updateWindowTitle();
|
||||||
|
}
|
||||||
CDockWidget::emitTopLevelEventForWidget(TopLevelWidget, true);
|
CDockWidget::emitTopLevelEventForWidget(TopLevelWidget, true);
|
||||||
}
|
}
|
||||||
else if (Container->openedDockAreas().isEmpty())
|
else if (Container->openedDockAreas().isEmpty() && FloatingWidget)
|
||||||
{
|
{
|
||||||
FloatingWidget->hide();
|
FloatingWidget->hide();
|
||||||
}
|
}
|
||||||
@ -729,7 +732,9 @@ void CDockAreaWidget::updateTitleBarVisibility()
|
|||||||
|
|
||||||
if (d->TitleBar)
|
if (d->TitleBar)
|
||||||
{
|
{
|
||||||
d->TitleBar->setVisible(!Container->isFloating() || !Container->hasTopLevelDockWidget());
|
bool Hidden = Container->hasTopLevelDockWidget() && (Container->isFloating()
|
||||||
|
|| CDockManager::configFlags().testFlag(CDockManager::HideSingleCentralWidgetTitleBar));
|
||||||
|
d->TitleBar->setVisible(!Hidden);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -157,8 +157,10 @@ public:
|
|||||||
DockAreaHasTabsMenuButton = 0x8000, //!< If the flag is set each dock area has a tabs menu button
|
DockAreaHasTabsMenuButton = 0x8000, //!< If the flag is set each dock area has a tabs menu button
|
||||||
DockAreaHideDisabledButtons = 0x10000, //!< If the flag is set disabled dock area buttons will not appear on the tollbar at all (enabling them will bring them back)
|
DockAreaHideDisabledButtons = 0x10000, //!< If the flag is set disabled dock area buttons will not appear on the tollbar at all (enabling them will bring them back)
|
||||||
DockAreaDynamicTabsMenuButtonVisibility = 0x20000, //!< If the flag is set dock area will disable a tabs menu button when there is only one tab in the area
|
DockAreaDynamicTabsMenuButtonVisibility = 0x20000, //!< If the flag is set dock area will disable a tabs menu button when there is only one tab in the area
|
||||||
FloatingContainerHasWidgetTitle = 0x40000,
|
FloatingContainerHasWidgetTitle = 0x40000, //!< If set, the Floating Widget window title reflects the title of the current dock widget otherwise it displays application name as window title
|
||||||
FloatingContainerHasWidgetIcon = 0x80000,
|
FloatingContainerHasWidgetIcon = 0x80000, //!< If set, the Floating Widget icon reflects the icon of the current dock widget otherwise it displays application icon
|
||||||
|
HideSingleCentralWidgetTitleBar = 0x100000, //!< If there is only one single visible dock widget in the main dock container (the dock manager) and if this flag is set, then the titlebar of this dock widget will be hidden
|
||||||
|
//!< this only makes sense for non draggable and non floatable widgets and enables the creation of some kind of "central" widget
|
||||||
|
|
||||||
|
|
||||||
DefaultDockAreaButtons = DockAreaHasCloseButton
|
DefaultDockAreaButtons = DockAreaHasCloseButton
|
||||||
|
Loading…
Reference in New Issue
Block a user