mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Added dropIntoAutoHideSideBar() function
This commit is contained in:
parent
21189759dd
commit
f6ccaba6aa
@ -181,6 +181,11 @@ public:
|
||||
*/
|
||||
void dropIntoContainer(CFloatingDockContainer* FloatingWidget, DockWidgetArea area);
|
||||
|
||||
/**
|
||||
* Drop floating widget into auto hide side bar
|
||||
*/
|
||||
void dropIntoAutoHideSideBar(CFloatingDockContainer* FloatingWidget, DockWidgetArea area);
|
||||
|
||||
/**
|
||||
* Drop floating widget into dock area
|
||||
*/
|
||||
@ -505,6 +510,23 @@ void DockContainerWidgetPrivate::dropIntoContainer(CFloatingDockContainer* Float
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void DockContainerWidgetPrivate::dropIntoAutoHideSideBar(CFloatingDockContainer* FloatingWidget, DockWidgetArea area)
|
||||
{
|
||||
auto SideBarLocation = internal::toSideBarLocation(area);
|
||||
auto NewDockAreas = FloatingWidget->findChildren<CDockAreaWidget*>(
|
||||
QString(), Qt::FindChildrenRecursively);
|
||||
for (auto DockArea : NewDockAreas)
|
||||
{
|
||||
auto DockWidgets = DockArea->dockWidgets();
|
||||
for (auto DockWidget : DockWidgets)
|
||||
{
|
||||
_this->createAndSetupAutoHideContainer(SideBarLocation, DockWidget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//============================================================================
|
||||
void DockContainerWidgetPrivate::dropIntoCenterOfSection(
|
||||
CFloatingDockContainer* FloatingWidget, CDockAreaWidget* TargetArea)
|
||||
@ -1661,18 +1683,8 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
|
||||
{
|
||||
if (internal::isSideBarArea(ContainerDropArea))
|
||||
{
|
||||
auto SideBarLocation = internal::toSideBarLocation(ContainerDropArea);
|
||||
std::cout << "Drop into sidebar " << std::endl;
|
||||
auto NewDockAreas = FloatingWidget->findChildren<CDockAreaWidget*>(
|
||||
QString(), Qt::FindChildrenRecursively);
|
||||
for (auto DockArea : NewDockAreas)
|
||||
{
|
||||
auto DockWidgets = DockArea->dockWidgets();
|
||||
for (auto DockWidget : DockWidgets)
|
||||
{
|
||||
createAndSetupAutoHideContainer(SideBarLocation, DockWidget);
|
||||
}
|
||||
}
|
||||
ADS_PRINT("Container Drop Content: " << ContainerDropArea);
|
||||
d->dropIntoAutoHideSideBar(FloatingWidget, ContainerDropArea);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1712,10 +1724,29 @@ void CDockContainerWidget::dropFloatingWidget(CFloatingDockContainer* FloatingWi
|
||||
d->DockManager->notifyFloatingWidgetDrop(FloatingWidget);
|
||||
}
|
||||
|
||||
/*
|
||||
* else if (internal::isSideBarArea(ContainerDropArea))
|
||||
{
|
||||
// Drop into AutoHideArea
|
||||
auto DockWidget = qobject_cast<CDockWidget*>(d->Content);
|
||||
auto DockArea = qobject_cast<CDockAreaWidget*>(d->Content);
|
||||
auto SideBarLocation = internal::toSideBarLocation(ContainerDropArea);
|
||||
if (DockWidget)
|
||||
{
|
||||
DockWidget->toggleAutoHide(SideBarLocation);
|
||||
}
|
||||
else if (DockArea)
|
||||
{
|
||||
DockArea->toggleAutoHide(SideBarLocation);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
//============================================================================
|
||||
void CDockContainerWidget::dropWidget(QWidget* Widget, DockWidgetArea DropArea, CDockAreaWidget* TargetAreaWidget)
|
||||
{
|
||||
std::cout << "CDockContainerWidget::dropWidget" << std::endl;
|
||||
CDockWidget* SingleDockWidget = topLevelDockWidget();
|
||||
if (TargetAreaWidget)
|
||||
{
|
||||
|
@ -35,7 +35,6 @@
|
||||
#include <QDebug>
|
||||
#include <QMap>
|
||||
#include <QWindow>
|
||||
#include <QSvgRenderer>
|
||||
|
||||
#include "DockAreaWidget.h"
|
||||
#include "DockAreaTitleBar.h"
|
||||
@ -459,8 +458,6 @@ DockWidgetArea CDockOverlay::dropAreaUnderCursor() const
|
||||
{
|
||||
auto Rect = rect();
|
||||
const QPoint pos = mapFromGlobal(QCursor::pos());
|
||||
|
||||
std::cout << "pos.y: " << pos.y() << " d->sideBarMouseZone(SideBarTop) " << d->sideBarMouseZone(SideBarTop) << std::endl;
|
||||
if (pos.x() < d->sideBarMouseZone(SideBarLeft))
|
||||
{
|
||||
return LeftAutoHideArea;
|
||||
@ -584,7 +581,6 @@ void CDockOverlay::paintEvent(QPaintEvent* event)
|
||||
double Factor = (CDockOverlay::ModeContainerOverlay == d->Mode) ?
|
||||
3 : 2;
|
||||
|
||||
std::cout << "paint: da: " << da << std::endl;
|
||||
switch (da)
|
||||
{
|
||||
case TopDockWidgetArea: r.setHeight(r.height() / Factor); break;
|
||||
|
@ -128,8 +128,6 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
|
||||
auto DockAreaOverlay = DockManager->dockAreaOverlay();
|
||||
auto DockDropArea = DockAreaOverlay->dropAreaUnderCursor();
|
||||
auto ContainerDropArea = ContainerOverlay->dropAreaUnderCursor();
|
||||
std::cout << "ContainerDropArea " << ContainerDropArea << std::endl;
|
||||
std::cout << "DockDropArea " << DockDropArea << std::endl;
|
||||
|
||||
if (!TopContainer)
|
||||
{
|
||||
@ -349,7 +347,6 @@ void CFloatingDragPreview::startFloating(const QPoint &DragStartMousePos,
|
||||
void CFloatingDragPreview::finishDragging()
|
||||
{
|
||||
ADS_PRINT("CFloatingDragPreview::finishDragging");
|
||||
std::cout << "CFloatingDragPreview::finishDragging" << std::endl;
|
||||
|
||||
auto DockDropArea = d->DockManager->dockAreaOverlay()->visibleDropAreaUnderCursor();
|
||||
auto ContainerDropArea = d->DockManager->containerOverlay()->visibleDropAreaUnderCursor();
|
||||
@ -372,32 +369,15 @@ void CFloatingDragPreview::finishDragging()
|
||||
}
|
||||
else if (ContainerDropArea != InvalidDockWidgetArea)
|
||||
{
|
||||
std::cout << "ContainerDropArea != InvalidDockWidgetArea " << ContainerDropArea << std::endl;
|
||||
CDockAreaWidget* DockArea = nullptr;
|
||||
// If there is only one single dock area, and we drop into the center
|
||||
// then we tabify the dropped widget into the only visible dock area
|
||||
if (d->DropContainer->visibleDockAreaCount() <= 1 && CenterDockWidgetArea == ContainerDropArea)
|
||||
{
|
||||
d->DropContainer->dropWidget(d->Content, ContainerDropArea, d->DropContainer->dockAreaAt(QCursor::pos()));
|
||||
}
|
||||
else if (internal::isSideBarArea(ContainerDropArea))
|
||||
{
|
||||
// Drop into AutoHideArea
|
||||
auto DockWidget = qobject_cast<CDockWidget*>(d->Content);
|
||||
auto DockArea = qobject_cast<CDockAreaWidget*>(d->Content);
|
||||
auto SideBarLocation = internal::toSideBarLocation(ContainerDropArea);
|
||||
if (DockWidget)
|
||||
{
|
||||
DockWidget->toggleAutoHide(SideBarLocation);
|
||||
}
|
||||
else if (DockArea)
|
||||
{
|
||||
DockArea->toggleAutoHide(SideBarLocation);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
d->DropContainer->dropWidget(d->Content, ContainerDropArea, nullptr);
|
||||
DockArea = d->DropContainer->dockAreaAt(QCursor::pos());
|
||||
}
|
||||
|
||||
d->DropContainer->dropWidget(d->Content, ContainerDropArea, DockArea);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user