Skip to content

Commit fade9d7

Browse files
author
Uwe Kindler
committed
Improved handling of tabified widgets, improced CSS to decrease height of title bars
1 parent a8ccbfa commit fade9d7

File tree

2 files changed

+35
-2
lines changed

2 files changed

+35
-2
lines changed

AdvancedDockingSystem/res/stylesheets/default-windows2.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,13 @@ ads--CDockWidget
5656
border-style: solid;
5757
border-width: 1px 0 0 0;
5858
}
59+
60+
QPushButton#closeButton
61+
{
62+
padding: 0px;
63+
}
64+
65+
QPushButton#tabsMenuButton
66+
{
67+
padding: 0px;
68+
}

AdvancedDockingSystem/src/v2/DockOverlay.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636

3737
#include <iostream>
3838

39+
#include "DockAreaWidget.h"
40+
3941
namespace ads
4042
{
4143
//============================================================================
@@ -223,7 +225,24 @@ DockWidgetAreas CDockOverlay::allowedAreas() const
223225
//============================================================================
224226
DockWidgetArea CDockOverlay::dropAreaUnderCursor() const
225227
{
226-
return d->Cross->cursorLocation();
228+
DockWidgetArea Result = d->Cross->cursorLocation();
229+
if (Result != InvalidDockWidgetArea)
230+
{
231+
return Result;
232+
}
233+
234+
CDockAreaWidget* DockArea = dynamic_cast<CDockAreaWidget*>(d->TargetWidget.data());
235+
if (!DockArea)
236+
{
237+
return Result;
238+
}
239+
240+
if (DockArea->titleAreaGeometry().contains(DockArea->mapFromGlobal(QCursor::pos())))
241+
{
242+
return CenterDockWidgetArea;
243+
}
244+
245+
return Result;
227246
}
228247

229248

@@ -516,7 +535,11 @@ DockWidgetArea CDockOverlayCross::cursorLocation() const
516535
void CDockOverlayCross::showEvent(QShowEvent*)
517536
{
518537
resize(d->DockOverlay->size());
519-
move(d->DockOverlay->pos());
538+
QPoint TopLeft = d->DockOverlay->pos();
539+
QPoint Offest((this->width() - d->DockOverlay->width()) / 2,
540+
(this->height() - d->DockOverlay->height()) / 2);
541+
QPoint CrossTopLeft = TopLeft - Offest;
542+
move(CrossTopLeft);
520543
}
521544

522545

0 commit comments

Comments
 (0)