mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-27 00:11:33 +08:00
Removed support for opaque undocking
This commit is contained in:
parent
624d21d001
commit
9c30169c42
@ -544,13 +544,7 @@ void MainWindowPrivate::createContent()
|
|||||||
|
|
||||||
#ifdef Q_OS_WIN
|
#ifdef Q_OS_WIN
|
||||||
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
|
||||||
// If opaque undocking is active, then undocking of widgets while
|
DockManager->addDockWidget(ads::CenterDockWidgetArea, createActiveXWidget(), RighDockArea);
|
||||||
// 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
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -262,8 +262,7 @@ IFloatingWidget* DockAreaTitleBarPrivate::makeAreaFloating(const QPoint& Offset,
|
|||||||
{
|
{
|
||||||
QSize Size = DockArea->size();
|
QSize Size = DockArea->size();
|
||||||
this->DragState = DragState;
|
this->DragState = DragState;
|
||||||
bool CreateFloatingDockContainer = CDockManager::testConfigFlag(
|
bool CreateFloatingDockContainer = (DraggingFloatingWidget != DragState);
|
||||||
CDockManager::OpaqueUndocking) || (DraggingFloatingWidget != DragState);
|
|
||||||
CFloatingDockContainer* FloatingDockContainer = nullptr;
|
CFloatingDockContainer* FloatingDockContainer = nullptr;
|
||||||
IFloatingWidget* FloatingWidget;
|
IFloatingWidget* FloatingWidget;
|
||||||
if (CreateFloatingDockContainer)
|
if (CreateFloatingDockContainer)
|
||||||
@ -589,10 +588,6 @@ void CDockAreaTitleBar::mouseReleaseEvent(QMouseEvent* ev)
|
|||||||
if (ev->button() == Qt::LeftButton)
|
if (ev->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
ADS_PRINT("CDockAreaTitleBar::mouseReleaseEvent");
|
ADS_PRINT("CDockAreaTitleBar::mouseReleaseEvent");
|
||||||
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
|
|
||||||
{
|
|
||||||
releaseMouse();
|
|
||||||
}
|
|
||||||
ev->accept();
|
ev->accept();
|
||||||
auto CurrentDragState = d->DragState;
|
auto CurrentDragState = d->DragState;
|
||||||
d->DragStartMousePos = QPoint();
|
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
|
// If one single dock widget in this area is not floatable then the whole
|
||||||
// area is not floatable
|
// area is not floatable
|
||||||
// If we do non opaque undocking, then we can create the floating drag
|
// We can create the floating drag preview if the dock widget is movable
|
||||||
// preview if the dock widget is movable
|
|
||||||
auto Features = d->DockArea->features();
|
auto Features = d->DockArea->features();
|
||||||
if (!Features.testFlag(CDockWidget::DockWidgetFloatable)
|
if (!Features.testFlag(CDockWidget::DockWidgetFloatable) && !(Features.testFlag(CDockWidget::DockWidgetMovable)))
|
||||||
&& !(Features.testFlag(CDockWidget::DockWidgetMovable) && !CDockManager::testConfigFlag(CDockManager::OpaqueUndocking)))
|
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -653,10 +646,6 @@ void CDockAreaTitleBar::mouseMoveEvent(QMouseEvent* ev)
|
|||||||
d->startFloating(d->DragStartMousePos);
|
d->startFloating(d->DragStartMousePos);
|
||||||
auto Overlay = d->DockArea->dockManager()->containerOverlay();
|
auto Overlay = d->DockArea->dockManager()->containerOverlay();
|
||||||
Overlay->setAllowedAreas(OuterDockAreas);
|
Overlay->setAllowedAreas(OuterDockAreas);
|
||||||
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
|
|
||||||
{
|
|
||||||
grabMouse();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -180,7 +180,6 @@ public:
|
|||||||
TabCloseButtonIsToolButton = 0x0040,//! If enabled the tab close buttons will be QToolButtons instead of QPushButtons - disabled by default
|
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
|
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
|
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
|
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
|
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
|
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
|
DefaultOpaqueConfig = DefaultBaseConfig
|
||||||
| OpaqueSplitterResize
|
| 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
|
DefaultNonOpaqueConfig = DefaultBaseConfig
|
||||||
| DragPreviewShowsContentPixmap, ///< the default configuration for non opaque operations
|
| DragPreviewShowsContentPixmap, ///< the default configuration for non opaque operations
|
||||||
|
@ -162,9 +162,9 @@ struct DockWidgetTabPrivate
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
IFloatingWidget* createFloatingWidget(T* Widget, bool OpaqueUndocking)
|
IFloatingWidget* createFloatingWidget(T* Widget, bool CreateContainer)
|
||||||
{
|
{
|
||||||
if (OpaqueUndocking)
|
if (CreateContainer)
|
||||||
{
|
{
|
||||||
return new CFloatingDockContainer(Widget);
|
return new CFloatingDockContainer(Widget);
|
||||||
}
|
}
|
||||||
@ -312,8 +312,7 @@ bool DockWidgetTabPrivate::startFloating(eDragState DraggingState)
|
|||||||
ADS_PRINT("startFloating");
|
ADS_PRINT("startFloating");
|
||||||
DragState = DraggingState;
|
DragState = DraggingState;
|
||||||
IFloatingWidget* FloatingWidget = nullptr;
|
IFloatingWidget* FloatingWidget = nullptr;
|
||||||
bool OpaqueUndocking = CDockManager::testConfigFlag(CDockManager::OpaqueUndocking) ||
|
bool CreateContainer = (DraggingFloatingWidget != DraggingState);
|
||||||
(DraggingFloatingWidget != DraggingState);
|
|
||||||
|
|
||||||
// If section widget has multiple tabs, we take only one tab
|
// If section widget has multiple tabs, we take only one tab
|
||||||
// If it has only one single tab, we can move the complete
|
// If it has only one single tab, we can move the complete
|
||||||
@ -321,12 +320,12 @@ bool DockWidgetTabPrivate::startFloating(eDragState DraggingState)
|
|||||||
QSize Size;
|
QSize Size;
|
||||||
if (DockArea->dockWidgetsCount() > 1)
|
if (DockArea->dockWidgetsCount() > 1)
|
||||||
{
|
{
|
||||||
FloatingWidget = createFloatingWidget(DockWidget, OpaqueUndocking);
|
FloatingWidget = createFloatingWidget(DockWidget, CreateContainer);
|
||||||
Size = DockWidget->size();
|
Size = DockWidget->size();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FloatingWidget = createFloatingWidget(DockArea, OpaqueUndocking);
|
FloatingWidget = createFloatingWidget(DockArea, CreateContainer);
|
||||||
Size = DockArea->size();
|
Size = DockArea->size();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -392,10 +391,6 @@ void CDockWidgetTab::mouseReleaseEvent(QMouseEvent* ev)
|
|||||||
{
|
{
|
||||||
if (ev->button() == Qt::LeftButton)
|
if (ev->button() == Qt::LeftButton)
|
||||||
{
|
{
|
||||||
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
|
|
||||||
{
|
|
||||||
releaseMouse();
|
|
||||||
}
|
|
||||||
auto CurrentDragState = d->DragState;
|
auto CurrentDragState = d->DragState;
|
||||||
d->GlobalDragStartMousePosition = QPoint();
|
d->GlobalDragStartMousePosition = QPoint();
|
||||||
d->DragStartMousePosition = QPoint();
|
d->DragStartMousePosition = QPoint();
|
||||||
@ -481,23 +476,17 @@ void CDockWidgetTab::mouseMoveEvent(QMouseEvent* ev)
|
|||||||
|
|
||||||
|
|
||||||
// Floating is only allowed for widgets that are floatable
|
// Floating is only allowed for widgets that are floatable
|
||||||
// If we do non opaque undocking, then can create the drag preview
|
// We can create the drag preview if the widget is movable.
|
||||||
// if the widget is movable.
|
|
||||||
auto Features = d->DockWidget->features();
|
auto Features = d->DockWidget->features();
|
||||||
if (Features.testFlag(CDockWidget::DockWidgetFloatable)
|
if (Features.testFlag(CDockWidget::DockWidgetFloatable) || (Features.testFlag(CDockWidget::DockWidgetMovable)))
|
||||||
|| (Features.testFlag(CDockWidget::DockWidgetMovable) && !CDockManager::testConfigFlag(CDockManager::OpaqueUndocking)))
|
|
||||||
{
|
{
|
||||||
// If we undock, we need to restore the initial position of this
|
// If we undock, we need to restore the initial position of this
|
||||||
// tab because it looks strange if it remains on its dragged position
|
// 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();
|
parentWidget()->layout()->update();
|
||||||
}
|
}
|
||||||
d->startFloating();
|
d->startFloating();
|
||||||
if (CDockManager::testConfigFlag(CDockManager::OpaqueUndocking))
|
|
||||||
{
|
|
||||||
grabMouse();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user