mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-12-25 23:51:33 +08:00
Fixed issue #164 - Single DockArea cannot be split
This commit is contained in:
parent
b7e7c0ccc3
commit
aa7976dac6
@ -589,7 +589,7 @@ void CDockAreaTitleBar::mouseMoveEvent(QMouseEvent* ev)
|
||||
return;
|
||||
}
|
||||
|
||||
// If this is the last dock area in a dock container it does not make
|
||||
// If this is the last dock area in a floating dock container it does not make
|
||||
// sense to move it to a new floating widget and leave this one
|
||||
// empty
|
||||
if (d->DockArea->dockContainer()->isFloating()
|
||||
@ -612,7 +612,7 @@ void CDockAreaTitleBar::mouseMoveEvent(QMouseEvent* ev)
|
||||
int DragDistance = (d->DragStartMousePos - ev->pos()).manhattanLength();
|
||||
if (DragDistance >= CDockManager::startDragDistance())
|
||||
{
|
||||
ADS_PRINT("CTabsScrollArea::startFloating");
|
||||
ADS_PRINT("CDockAreaTitlBar::startFloating");
|
||||
d->startFloating(d->DragStartMousePos);
|
||||
auto Overlay = d->DockArea->dockManager()->containerOverlay();
|
||||
Overlay->setAllowedAreas(OuterDockAreas);
|
||||
|
@ -33,7 +33,6 @@ struct FloatingDragPreviewPrivate
|
||||
CFloatingDragPreview *_this;
|
||||
QWidget* Content;
|
||||
CDockAreaWidget* ContentSourceArea = nullptr;
|
||||
CDockContainerWidget* ContenSourceContainer = nullptr;
|
||||
QPoint DragStartMousePosition;
|
||||
CDockManager* DockManager;
|
||||
CDockContainerWidget *DropContainer = nullptr;
|
||||
@ -123,22 +122,8 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
|
||||
int VisibleDockAreas = TopContainer->visibleDockAreaCount();
|
||||
ContainerOverlay->setAllowedAreas(
|
||||
VisibleDockAreas > 1 ? OuterDockAreas : AllDockAreas);
|
||||
|
||||
DockWidgetArea ContainerArea = InvalidDockWidgetArea;
|
||||
// If there is only one single visible dock area in a container, then
|
||||
// it does not make sense to show a dock overlay because the dock area
|
||||
// would be removed and inserted at the same position
|
||||
if (VisibleDockAreas <= 1)
|
||||
{
|
||||
ContainerOverlay->hideOverlay();
|
||||
}
|
||||
else
|
||||
{
|
||||
ContainerArea = ContainerOverlay->showOverlay(TopContainer);
|
||||
}
|
||||
ContainerOverlay->enableDropPreview(ContainerArea != InvalidDockWidgetArea);
|
||||
auto DockArea = TopContainer->dockAreaAt(GlobalPos);
|
||||
if (DockArea && DockArea->isVisible() && VisibleDockAreas > 0 && DockArea != ContentSourceArea)
|
||||
if (DockArea && DockArea->isVisible() && VisibleDockAreas >= 0 && DockArea != ContentSourceArea)
|
||||
{
|
||||
DockAreaOverlay->enableDropPreview(true);
|
||||
DockAreaOverlay->setAllowedAreas(
|
||||
@ -149,8 +134,7 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
|
||||
// the mouse is in the title bar. If the ContainerArea is valid
|
||||
// then we ignore the dock area of the dockAreaOverlay() and disable
|
||||
// the drop preview
|
||||
if ((Area == CenterDockWidgetArea)
|
||||
&& (ContainerArea != InvalidDockWidgetArea))
|
||||
if ((Area == CenterDockWidgetArea) && (ContainerDropArea != InvalidDockWidgetArea))
|
||||
{
|
||||
DockAreaOverlay->enableDropPreview(false);
|
||||
ContainerOverlay->enableDropPreview(true);
|
||||
@ -159,10 +143,24 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
|
||||
{
|
||||
ContainerOverlay->enableDropPreview(InvalidDockWidgetArea == Area);
|
||||
}
|
||||
ContainerOverlay->showOverlay(TopContainer);
|
||||
}
|
||||
else
|
||||
{
|
||||
DockAreaOverlay->hideOverlay();
|
||||
// If there is only one single visible dock area in a container, then
|
||||
// it does not make sense to show a dock overlay because the dock area
|
||||
// would be removed and inserted at the same position
|
||||
if (VisibleDockAreas <= 1)
|
||||
{
|
||||
ContainerOverlay->hideOverlay();
|
||||
}
|
||||
else
|
||||
{
|
||||
ContainerOverlay->showOverlay(TopContainer);
|
||||
}
|
||||
|
||||
|
||||
if (DockArea == ContentSourceArea && InvalidDockWidgetArea == ContainerDropArea)
|
||||
{
|
||||
DropContainer = nullptr;
|
||||
@ -270,7 +268,6 @@ CFloatingDragPreview::CFloatingDragPreview(CDockWidget* Content)
|
||||
if (Content->dockAreaWidget()->openDockWidgetsCount() == 1)
|
||||
{
|
||||
d->ContentSourceArea = Content->dockAreaWidget();
|
||||
d->ContenSourceContainer = Content->dockContainer();
|
||||
}
|
||||
setWindowTitle(Content->windowTitle());
|
||||
}
|
||||
@ -282,7 +279,6 @@ CFloatingDragPreview::CFloatingDragPreview(CDockAreaWidget* Content)
|
||||
{
|
||||
d->DockManager = Content->dockManager();
|
||||
d->ContentSourceArea = Content;
|
||||
d->ContenSourceContainer = Content->dockContainer();
|
||||
setWindowTitle(Content->currentDockWidget()->windowTitle());
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user