1
0
mirror of https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git synced 2025-04-01 02:42:39 +08:00

Removed debug output and fixed painting of SideBar drag overlays

This commit is contained in:
Uwe Kindler 2023-07-10 12:07:44 +02:00 committed by Jon Jenssen
parent 758d939d13
commit 24a440f259
2 changed files with 3 additions and 10 deletions

View File

@ -583,6 +583,7 @@ bool CDockOverlay::dropPreviewEnabled() const
void CDockOverlay::paintEvent(QPaintEvent* event) void CDockOverlay::paintEvent(QPaintEvent* event)
{ {
Q_UNUSED(event); Q_UNUSED(event);
// Draw rect based on location // Draw rect based on location
if (!d->DropPreviewEnabled) if (!d->DropPreviewEnabled)
{ {
@ -608,6 +609,7 @@ void CDockOverlay::paintEvent(QPaintEvent* event)
case BottomAutoHideArea: r.setY(r.height() - d->sideBarOverlaySize(SideBarBottom)); break; case BottomAutoHideArea: r.setY(r.height() - d->sideBarOverlaySize(SideBarBottom)); break;
default: return; default: return;
} }
QPainter painter(this); QPainter painter(this);
QColor Color = palette().color(QPalette::Active, QPalette::Highlight); QColor Color = palette().color(QPalette::Active, QPalette::Highlight);
QPen Pen = painter.pen(); QPen Pen = painter.pen();

View File

@ -103,7 +103,6 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
{ {
if (!_this->isVisible() || !DockManager) if (!_this->isVisible() || !DockManager)
{ {
std::cout << "return 1" << std::endl;
return; return;
} }
@ -132,13 +131,10 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
if (!TopContainer) if (!TopContainer)
{ {
std::cout << "ContainerOverlay->hideOverlay() 1" << std::endl;
ContainerOverlay->hideOverlay(); ContainerOverlay->hideOverlay();
std::cout << "DockAreaOverlay->hideOverlay() 1" << std::endl;
DockAreaOverlay->hideOverlay(); DockAreaOverlay->hideOverlay();
if (CDockManager::testConfigFlag(CDockManager::DragPreviewIsDynamic)) if (CDockManager::testConfigFlag(CDockManager::DragPreviewIsDynamic))
{ {
std::cout << "return 2" << std::endl;
setHidden(false); setHidden(false);
} }
return; return;
@ -155,7 +151,6 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
{ {
VisibleDockAreas++; VisibleDockAreas++;
} }
std::cout << "VisibleDockAreas " << VisibleDockAreas << std::endl;
DockWidgetAreas AllowedAreas = (VisibleDockAreas > 1) ? OuterDockAreas : AllDockAreas; DockWidgetAreas AllowedAreas = (VisibleDockAreas > 1) ? OuterDockAreas : AllDockAreas;
//ContainerOverlay->enableDropPreview(ContainerDropArea != InvalidDockWidgetArea); //ContainerOverlay->enableDropPreview(ContainerDropArea != InvalidDockWidgetArea);
@ -168,12 +163,12 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
AllowedAreas.setFlag(CenterDockWidgetArea, DockArea->allowedAreas().testFlag(CenterDockWidgetArea)); AllowedAreas.setFlag(CenterDockWidgetArea, DockArea->allowedAreas().testFlag(CenterDockWidgetArea));
} }
ContainerOverlay->setAllowedAreas(AllowedAreas); ContainerOverlay->setAllowedAreas(AllowedAreas);
ContainerOverlay->enableDropPreview(ContainerDropArea != InvalidDockWidgetArea);
if (DockArea && DockArea->isVisible() && VisibleDockAreas >= 0 && DockArea != ContentSourceArea) if (DockArea && DockArea->isVisible() && VisibleDockAreas >= 0 && DockArea != ContentSourceArea)
{ {
DockAreaOverlay->enableDropPreview(true); DockAreaOverlay->enableDropPreview(true);
DockAreaOverlay->setAllowedAreas( (VisibleDockAreas == 1) ? NoDockWidgetArea : DockArea->allowedAreas()); DockAreaOverlay->setAllowedAreas( (VisibleDockAreas == 1) ? NoDockWidgetArea : DockArea->allowedAreas());
DockWidgetArea Area = DockAreaOverlay->showOverlay(DockArea); DockWidgetArea Area = DockAreaOverlay->showOverlay(DockArea);
std::cout << "DockWidgetArea " << Area << std::endl;
// A CenterDockWidgetArea for the dockAreaOverlay() indicates that // A CenterDockWidgetArea for the dockAreaOverlay() indicates that
// the mouse is in the title bar. If the ContainerArea is valid // the mouse is in the title bar. If the ContainerArea is valid
@ -182,20 +177,16 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
if ((Area == CenterDockWidgetArea) && (ContainerDropArea != InvalidDockWidgetArea)) if ((Area == CenterDockWidgetArea) && (ContainerDropArea != InvalidDockWidgetArea))
{ {
DockAreaOverlay->enableDropPreview(false); DockAreaOverlay->enableDropPreview(false);
std::cout << "ContainerOverlay->enableDropPreview(true) 1" << std::endl;
ContainerOverlay->enableDropPreview(true); ContainerOverlay->enableDropPreview(true);
} }
else else
{ {
std::cout << "ContainerOverlay->enableDropPreview 2" << std::endl;
ContainerOverlay->enableDropPreview(InvalidDockWidgetArea == Area); ContainerOverlay->enableDropPreview(InvalidDockWidgetArea == Area);
} }
ContainerOverlay->showOverlay(TopContainer); ContainerOverlay->showOverlay(TopContainer);
} }
else else
{ {
std::cout << "DockAreaOverlay->hideOverlay() 2" << std::endl;
DockAreaOverlay->hideOverlay(); DockAreaOverlay->hideOverlay();
// If there is only one single visible dock area in a container, then // 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 // it does not make sense to show a dock overlay because the dock area