Removed support for opaque undocking

This commit is contained in:
Uwe Kindler 2023-01-20 11:50:34 +01:00
parent 624d21d001
commit 9c30169c42
4 changed files with 13 additions and 42 deletions

View File

@ -544,13 +544,7 @@ void MainWindowPrivate::createContent()
#ifdef Q_OS_WIN
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
// If opaque undocking is active, then undocking of widgets while
// active x widget is visible causes jerking while dragging a floating
// widget
if (!ads::CDockManager::testConfigFlag(ads::CDockManager::OpaqueUndocking))
{
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(), RighDockArea);
}
#endif
#endif

View File

@ -262,8 +262,7 @@ IFloatingWidget* DockAreaTitleBarPrivate::makeAreaFloating(const QPoint& Offset,
{
QSize Size = DockArea->size();
this->DragState = DragState;
bool CreateFloatingDockContainer = CDockManager::testConfigFlag(
CDockManager::OpaqueUndocking) || (DraggingFloatingWidget != DragState);
bool CreateFloatingDockContainer = (DraggingFloatingWidget != DragState);
CFloatingDockContainer* FloatingDockContainer = nullptr;
IFloatingWidget* FloatingWidget;
if (CreateFloatingDockContainer)
@ -589,10 +588,6 @@ void CDockAreaTitleBar::mouseReleaseEvent(QMouseEvent* ev)
if (ev->button() == Qt::LeftButton)
{
ADS_PRINT("CDockAreaTitleBar::mouseReleaseEvent");
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
{
releaseMouse();
}
ev->accept();
auto CurrentDragState = d->DragState;
d->DragStartMousePos = QPoint();
@ -637,11 +632,9 @@ void CDockAreaTitleBar::mouseMoveEvent(QMouseEvent* ev)
// If one single dock widget in this area is not floatable then the whole
// area is not floatable
// If we do non opaque undocking, then we can create the floating drag
// preview if the dock widget is movable
// We can create the floating drag preview if the dock widget is movable
auto Features = d->DockArea->features();
if (!Features.testFlag(CDockWidget::DockWidgetFloatable)
&& !(Features.testFlag(CDockWidget::DockWidgetMovable) && !CDockManager::testConfigFlag(CDockManager::OpaqueUndocking)))
if (!Features.testFlag(CDockWidget::DockWidgetFloatable) && !(Features.testFlag(CDockWidget::DockWidgetMovable)))
{
return;
}
@ -653,10 +646,6 @@ void CDockAreaTitleBar::mouseMoveEvent(QMouseEvent* ev)
d->startFloating(d->DragStartMousePos);
auto Overlay = d->DockArea->dockManager()->containerOverlay();
Overlay->setAllowedAreas(OuterDockAreas);
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
{
grabMouse();
}
}
return;

View File

@ -180,7 +180,6 @@ public:
TabCloseButtonIsToolButton = 0x0040,//! If enabled the tab close buttons will be QToolButtons instead of QPushButtons - disabled by default
AllTabsHaveCloseButton = 0x0080, //!< if this flag is set, then all tabs that are closable show a close button
RetainTabSizeWhenCloseButtonHidden = 0x0100, //!< if this flag is set, the space for the close button is reserved even if the close button is not visible
OpaqueUndocking = 0x0200,///< If enabled, the widgets are immediately undocked into floating widgets, if disabled, only a draw preview is undocked and the real undocking is deferred until the mouse is released
DragPreviewIsDynamic = 0x0400,///< If opaque undocking is disabled, this flag defines the behavior of the drag preview window, if this flag is enabled, the preview will be adjusted dynamically to the drop area
DragPreviewShowsContentPixmap = 0x0800,///< If opaque undocking is disabled, the created drag preview window shows a copy of the content of the dock widget / dock are that is dragged
DragPreviewHasWindowFrame = 0x1000,///< If opaque undocking is disabled, then this flag configures if the drag preview is frameless or looks like a real window
@ -216,7 +215,7 @@ public:
DefaultOpaqueConfig = DefaultBaseConfig
| OpaqueSplitterResize
| OpaqueUndocking, ///< the default configuration with opaque operations - this may cause issues if ActiveX or Qt 3D windows are involved
| DragPreviewShowsContentPixmap, ///< the default configuration for non opaque operations
DefaultNonOpaqueConfig = DefaultBaseConfig
| DragPreviewShowsContentPixmap, ///< the default configuration for non opaque operations

View File

@ -162,9 +162,9 @@ struct DockWidgetTabPrivate
}
template <typename T>
IFloatingWidget* createFloatingWidget(T* Widget, bool OpaqueUndocking)
IFloatingWidget* createFloatingWidget(T* Widget, bool CreateContainer)
{
if (OpaqueUndocking)
if (CreateContainer)
{
return new CFloatingDockContainer(Widget);
}
@ -312,8 +312,7 @@ bool DockWidgetTabPrivate::startFloating(eDragState DraggingState)
ADS_PRINT("startFloating");
DragState = DraggingState;
IFloatingWidget* FloatingWidget = nullptr;
bool OpaqueUndocking = CDockManager::testConfigFlag(CDockManager::OpaqueUndocking) ||
(DraggingFloatingWidget != DraggingState);
bool CreateContainer = (DraggingFloatingWidget != DraggingState);
// If section widget has multiple tabs, we take only one tab
// If it has only one single tab, we can move the complete
@ -321,12 +320,12 @@ bool DockWidgetTabPrivate::startFloating(eDragState DraggingState)
QSize Size;
if (DockArea->dockWidgetsCount() > 1)
{
FloatingWidget = createFloatingWidget(DockWidget, OpaqueUndocking);
FloatingWidget = createFloatingWidget(DockWidget, CreateContainer);
Size = DockWidget->size();
}
else
{
FloatingWidget = createFloatingWidget(DockArea, OpaqueUndocking);
FloatingWidget = createFloatingWidget(DockArea, CreateContainer);
Size = DockArea->size();
}
@ -392,10 +391,6 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
{
if (ev->button() == Qt::LeftButton)
{
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
{
releaseMouse();
}
auto CurrentDragState = d->DragState;
d->GlobalDragStartMousePosition = QPoint();
d->DragStartMousePosition = QPoint();
@ -481,23 +476,17 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
// Floating is only allowed for widgets that are floatable
// If we do non opaque undocking, then can create the drag preview
// if the widget is movable.
// We can create the drag preview if the widget is movable.
auto Features = d->DockWidget->features();
if (Features.testFlag(CDockWidget::DockWidgetFloatable)
|| (Features.testFlag(CDockWidget::DockWidgetMovable) && !CDockManager::testConfigFlag(CDockManager::OpaqueUndocking)))
if (Features.testFlag(CDockWidget::DockWidgetFloatable) || (Features.testFlag(CDockWidget::DockWidgetMovable)))
{
// If we undock, we need to restore the initial position of this
// tab because it looks strange if it remains on its dragged position
if (d->isDraggingState(DraggingTab) && !CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
if (d->isDraggingState(DraggingTab))
{
parentWidget()->layout()->update();
}
d->startFloating();
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
{
grabMouse();
}
}
return;
}