Added new config flag DoubleClickUndocksWidget to configure if double clicking a DockWidget tab or titlebar undocks the widget
Some checks failed
linux-builds / build (ubuntu-20.04) (push) Has been cancelled
linux-builds / build_ubuntu_2204 (push) Has been cancelled

This commit is contained in:
Uwe Kindler 2024-12-12 15:38:29 +01:00
parent e2f611ea9a
commit 7245dced84
4 changed files with 11 additions and 2 deletions

View File

@ -37,6 +37,7 @@ CMainWindow::CMainWindow(QWidget *parent)
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaHasUndockButton, false );
ads::CDockManager::setConfigFlag( ads::CDockManager::DockAreaDynamicTabsMenuButtonVisibility, true );
ads::CDockManager::setConfigFlag( ads::CDockManager::DisableTabTextEliding, true );
ads::CDockManager::setConfigFlag( ads::CDockManager::DoubleClickUndocksWidget, false );
DockManager = new CDockManager(this);
// Set central widget

View File

@ -733,6 +733,11 @@ void CDockAreaTitleBar::mouseDoubleClickEvent(QMouseEvent *event)
return;
}
if (!CDockManager::testConfigFlag(CDockManager::DoubleClickUndocksWidget))
{
return;
}
d->makeAreaFloating(event->pos(), DraggingInactive);
}

View File

@ -215,6 +215,8 @@ public:
MiddleMouseButtonClosesTab = 0x2000000, //! If the flag is set, the user can use the mouse middle button to close the tab under the mouse
DisableTabTextEliding = 0x4000000, //! Set this flag to disable eliding of tab texts in dock area tabs
ShowTabTextOnlyForActiveTab =0x8000000, //! Set this flag to show label texts in dock area tabs only for active tabs
DoubleClickUndocksWidget = 0x10000000, //!< If the flag is set, a double click on a tab undocks the widget
DefaultDockAreaButtons = DockAreaHasCloseButton
| DockAreaHasUndockButton
@ -223,7 +225,8 @@ public:
DefaultBaseConfig = DefaultDockAreaButtons
| ActiveTabHasCloseButton
| XmlCompressionEnabled
| FloatingContainerHasWidgetTitle, ///< default base configuration settings
| FloatingContainerHasWidgetTitle
| DoubleClickUndocksWidget, ///< default base configuration settings
DefaultOpaqueConfig = DefaultBaseConfig
| OpaqueSplitterResize

View File

@ -699,7 +699,7 @@ QString CDockWidgetTab::text() const
//============================================================================
void CDockWidgetTab::mouseDoubleClickEvent(QMouseEvent *event)
{
if (event->button() == Qt::LeftButton)
if (event->button() == Qt::LeftButton && CDockManager::testConfigFlag(CDockManager::DoubleClickUndocksWidget))
{
// If this is the last dock area in a dock container it does not make
// sense to move it to a new floating widget and leave this one