From fade9d7b7ce2fed9f1637d1d7e68f1467b1bb5cd Mon Sep 17 00:00:00 2001 From: Uwe Kindler Date: Fri, 3 Mar 2017 14:27:37 +0100 Subject: [PATCH] Improved handling of tabified widgets, improced CSS to decrease height of title bars --- .../res/stylesheets/default-windows2.css | 10 +++++++ AdvancedDockingSystem/src/v2/DockOverlay.cpp | 27 +++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/AdvancedDockingSystem/res/stylesheets/default-windows2.css b/AdvancedDockingSystem/res/stylesheets/default-windows2.css index 15fde86..1bc2ace 100644 --- a/AdvancedDockingSystem/res/stylesheets/default-windows2.css +++ b/AdvancedDockingSystem/res/stylesheets/default-windows2.css @@ -56,3 +56,13 @@ ads--CDockWidget border-style: solid; border-width: 1px 0 0 0; } + +QPushButton#closeButton +{ + padding: 0px; +} + +QPushButton#tabsMenuButton +{ + padding: 0px; +} diff --git a/AdvancedDockingSystem/src/v2/DockOverlay.cpp b/AdvancedDockingSystem/src/v2/DockOverlay.cpp index f80fe57..d3bf2fd 100644 --- a/AdvancedDockingSystem/src/v2/DockOverlay.cpp +++ b/AdvancedDockingSystem/src/v2/DockOverlay.cpp @@ -36,6 +36,8 @@ #include +#include "DockAreaWidget.h" + namespace ads { //============================================================================ @@ -223,7 +225,24 @@ DockWidgetAreas CDockOverlay::allowedAreas() const //============================================================================ DockWidgetArea CDockOverlay::dropAreaUnderCursor() const { - return d->Cross->cursorLocation(); + DockWidgetArea Result = d->Cross->cursorLocation(); + if (Result != InvalidDockWidgetArea) + { + return Result; + } + + CDockAreaWidget* DockArea = dynamic_cast(d->TargetWidget.data()); + if (!DockArea) + { + return Result; + } + + if (DockArea->titleAreaGeometry().contains(DockArea->mapFromGlobal(QCursor::pos()))) + { + return CenterDockWidgetArea; + } + + return Result; } @@ -516,7 +535,11 @@ DockWidgetArea CDockOverlayCross::cursorLocation() const void CDockOverlayCross::showEvent(QShowEvent*) { resize(d->DockOverlay->size()); - move(d->DockOverlay->pos()); + QPoint TopLeft = d->DockOverlay->pos(); + QPoint Offest((this->width() - d->DockOverlay->width()) / 2, + (this->height() - d->DockOverlay->height()) / 2); + QPoint CrossTopLeft = TopLeft - Offest; + move(CrossTopLeft); }