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;
|
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
|
// sense to move it to a new floating widget and leave this one
|
||||||
// empty
|
// empty
|
||||||
if (d->DockArea->dockContainer()->isFloating()
|
if (d->DockArea->dockContainer()->isFloating()
|
||||||
@ -612,7 +612,7 @@ void CDockAreaTitleBar::mouseMoveEvent(QMouseEvent* ev)
|
|||||||
int DragDistance = (d->DragStartMousePos - ev->pos()).manhattanLength();
|
int DragDistance = (d->DragStartMousePos - ev->pos()).manhattanLength();
|
||||||
if (DragDistance >= CDockManager::startDragDistance())
|
if (DragDistance >= CDockManager::startDragDistance())
|
||||||
{
|
{
|
||||||
ADS_PRINT("CTabsScrollArea::startFloating");
|
ADS_PRINT("CDockAreaTitlBar::startFloating");
|
||||||
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);
|
||||||
|
@ -33,7 +33,6 @@ struct FloatingDragPreviewPrivate
|
|||||||
CFloatingDragPreview *_this;
|
CFloatingDragPreview *_this;
|
||||||
QWidget* Content;
|
QWidget* Content;
|
||||||
CDockAreaWidget* ContentSourceArea = nullptr;
|
CDockAreaWidget* ContentSourceArea = nullptr;
|
||||||
CDockContainerWidget* ContenSourceContainer = nullptr;
|
|
||||||
QPoint DragStartMousePosition;
|
QPoint DragStartMousePosition;
|
||||||
CDockManager* DockManager;
|
CDockManager* DockManager;
|
||||||
CDockContainerWidget *DropContainer = nullptr;
|
CDockContainerWidget *DropContainer = nullptr;
|
||||||
@ -123,22 +122,8 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
|
|||||||
int VisibleDockAreas = TopContainer->visibleDockAreaCount();
|
int VisibleDockAreas = TopContainer->visibleDockAreaCount();
|
||||||
ContainerOverlay->setAllowedAreas(
|
ContainerOverlay->setAllowedAreas(
|
||||||
VisibleDockAreas > 1 ? OuterDockAreas : AllDockAreas);
|
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);
|
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->enableDropPreview(true);
|
||||||
DockAreaOverlay->setAllowedAreas(
|
DockAreaOverlay->setAllowedAreas(
|
||||||
@ -149,8 +134,7 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
|
|||||||
// the mouse is in the title bar. If the ContainerArea is valid
|
// the mouse is in the title bar. If the ContainerArea is valid
|
||||||
// then we ignore the dock area of the dockAreaOverlay() and disable
|
// then we ignore the dock area of the dockAreaOverlay() and disable
|
||||||
// the drop preview
|
// the drop preview
|
||||||
if ((Area == CenterDockWidgetArea)
|
if ((Area == CenterDockWidgetArea) && (ContainerDropArea != InvalidDockWidgetArea))
|
||||||
&& (ContainerArea != InvalidDockWidgetArea))
|
|
||||||
{
|
{
|
||||||
DockAreaOverlay->enableDropPreview(false);
|
DockAreaOverlay->enableDropPreview(false);
|
||||||
ContainerOverlay->enableDropPreview(true);
|
ContainerOverlay->enableDropPreview(true);
|
||||||
@ -159,10 +143,24 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
|
|||||||
{
|
{
|
||||||
ContainerOverlay->enableDropPreview(InvalidDockWidgetArea == Area);
|
ContainerOverlay->enableDropPreview(InvalidDockWidgetArea == Area);
|
||||||
}
|
}
|
||||||
|
ContainerOverlay->showOverlay(TopContainer);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DockAreaOverlay->hideOverlay();
|
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)
|
if (DockArea == ContentSourceArea && InvalidDockWidgetArea == ContainerDropArea)
|
||||||
{
|
{
|
||||||
DropContainer = nullptr;
|
DropContainer = nullptr;
|
||||||
@ -270,7 +268,6 @@ CFloatingDragPreview::CFloatingDragPreview(CDockWidget* Content)
|
|||||||
if (Content->dockAreaWidget()->openDockWidgetsCount() == 1)
|
if (Content->dockAreaWidget()->openDockWidgetsCount() == 1)
|
||||||
{
|
{
|
||||||
d->ContentSourceArea = Content->dockAreaWidget();
|
d->ContentSourceArea = Content->dockAreaWidget();
|
||||||
d->ContenSourceContainer = Content->dockContainer();
|
|
||||||
}
|
}
|
||||||
setWindowTitle(Content->windowTitle());
|
setWindowTitle(Content->windowTitle());
|
||||||
}
|
}
|
||||||
@ -282,7 +279,6 @@ CFloatingDragPreview::CFloatingDragPreview(CDockAreaWidget* Content)
|
|||||||
{
|
{
|
||||||
d->DockManager = Content->dockManager();
|
d->DockManager = Content->dockManager();
|
||||||
d->ContentSourceArea = Content;
|
d->ContentSourceArea = Content;
|
||||||
d->ContenSourceContainer = Content->dockContainer();
|
|
||||||
setWindowTitle(Content->currentDockWidget()->windowTitle());
|
setWindowTitle(Content->currentDockWidget()->windowTitle());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user