Skip to content

Commit 52aedfe

Browse files
author
Uwe Kindler
committed
Improved design of drop overlay cross
1 parent fade9d7 commit 52aedfe

File tree

5 files changed

+26
-28
lines changed

5 files changed

+26
-28
lines changed

AdvancedDockingSystem/res/stylesheets/default-windows2.css

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ ads--CDockContainerWidget QSplitter::handle
1717
ads--CDockAreaWidget
1818
{
1919
background: palette(window);
20-
border: 1px solid palette(light);
20+
border: 1px solid white;
2121
}
2222

2323
ads--CDockAreaWidget #tabsMenuButton::menu-indicator
@@ -57,12 +57,10 @@ ads--CDockWidget
5757
border-width: 1px 0 0 0;
5858
}
5959

60-
QPushButton#closeButton
61-
{
62-
padding: 0px;
63-
}
64-
60+
QPushButton#closeButton,
6561
QPushButton#tabsMenuButton
6662
{
67-
padding: 0px;
63+
padding: 1px;
6864
}
65+
66+

AdvancedDockingSystem/src/v2/DockAreaWidget.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ DockAreaWidgetPrivate::DockAreaWidgetPrivate(CDockAreaWidget* _public) :
277277
void DockAreaWidgetPrivate::createTabBar()
278278
{
279279
TitleBar = new QFrame(_this);
280+
TitleBar->setObjectName("dockAreaTitleBar");
280281
TopLayout = new QBoxLayout(QBoxLayout::LeftToRight);
281282
TopLayout->setContentsMargins(0, 0, 0, 0);
282283
TopLayout->setSpacing(0);
@@ -378,7 +379,6 @@ CDockAreaWidget::CDockAreaWidget(CDockManager* DockManager, CDockContainerWidget
378379
d(new DockAreaWidgetPrivate(this))
379380
{
380381
d->DockManager = DockManager;
381-
setStyleSheet("ads--CDockAreaWidget {border: 1px solid white;}");
382382
d->Layout = new QBoxLayout(QBoxLayout::TopToBottom);
383383
d->Layout->setContentsMargins(0, 0, 0, 0);
384384
d->Layout->setSpacing(0);

AdvancedDockingSystem/src/v2/DockManager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ CDockManager::CDockManager(QWidget *parent) :
8585
//============================================================================
8686
CDockManager::~CDockManager()
8787
{
88+
auto FloatingWidgets = d->FloatingWidgets;
89+
for (auto FloatingWidget : FloatingWidgets)
90+
{
91+
delete FloatingWidget;
92+
}
8893
delete d;
8994
}
9095

AdvancedDockingSystem/src/v2/DockOverlay.cpp

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,22 @@ namespace ads
4343
//============================================================================
4444
static QPixmap createDropIndicatorPixmap(const QPalette& pal, const QSizeF& size, DockWidgetArea DockWidgetArea)
4545
{
46-
const QColor borderColor = pal.color(QPalette::Active, QPalette::Highlight);
47-
const QColor backgroundColor = pal.color(QPalette::Active, QPalette::Base);
48-
const QColor areaBackgroundColor = pal.color(QPalette::Active, QPalette::Highlight).lighter(150);
46+
QColor borderColor = pal.color(QPalette::Active, QPalette::Highlight);
47+
QColor backgroundColor = pal.color(QPalette::Active, QPalette::Base);
48+
QColor areaBackgroundColor = pal.color(QPalette::Active, QPalette::Highlight).lighter(150);
4949

5050
QPixmap pm(size.width(), size.height());
5151
pm.fill(QColor(0, 0, 0, 0));
5252

5353
QPainter p(&pm);
5454
QPen pen = p.pen();
55-
QRectF baseRect(pm.rect());
55+
QRectF ShadowRect(pm.rect());
56+
QRectF baseRect;
57+
baseRect.setSize(ShadowRect.size() * 0.7);
58+
baseRect.moveCenter(ShadowRect.center());
5659

5760
// Fill
61+
p.fillRect(ShadowRect, QColor(0, 0, 0, 64));
5862
p.fillRect(baseRect, backgroundColor);
5963

6064
// Drop area rect.
@@ -71,13 +75,13 @@ static QPixmap createDropIndicatorPixmap(const QPalette& pal, const QSizeF& size
7175
gradient.setFinalStop(areaRect.bottomLeft());
7276
break;
7377
case RightDockWidgetArea:
74-
areaRect = QRectF(baseRect.width() * .5f, baseRect.y(), baseRect.width() * .5f, baseRect.height());
78+
areaRect = QRectF(ShadowRect.width() * .5f, baseRect.y(), baseRect.width() * .5f, baseRect.height());
7579
areaLine = QLineF(areaRect.topLeft(), areaRect.bottomLeft());
7680
gradient.setStart(areaRect.topLeft());
7781
gradient.setFinalStop(areaRect.topRight());
7882
break;
7983
case BottomDockWidgetArea:
80-
areaRect = QRectF(baseRect.x(), baseRect.height() * .5f, baseRect.width(), baseRect.height() * .5f);
84+
areaRect = QRectF(baseRect.x(), ShadowRect.height() * .5f, baseRect.width(), baseRect.height() * .5f);
8185
areaLine = QLineF(areaRect.topLeft(), areaRect.topRight());
8286
gradient.setStart(areaRect.topLeft());
8387
gradient.setFinalStop(areaRect.bottomLeft());
@@ -123,7 +127,7 @@ QWidget* createDropIndicatorWidget(DockWidgetArea DockWidgetArea)
123127
QLabel* l = new QLabel();
124128
l->setObjectName("DockWidgetAreaLabel");
125129

126-
const qreal metric = static_cast<qreal>(l->fontMetrics().height()) * 2.f;
130+
const qreal metric = static_cast<qreal>(l->fontMetrics().height()) * 3.f;
127131
const QSizeF size(metric, metric);
128132

129133
l->setPixmap(createDropIndicatorPixmap(l->palette(), size, DockWidgetArea));
@@ -423,7 +427,7 @@ CDockOverlayCross::CDockOverlayCross(CDockOverlay* overlay) :
423427
setAttribute(Qt::WA_TranslucentBackground);
424428

425429
d->GridLayout = new QGridLayout();
426-
d->GridLayout->setSpacing(6);
430+
d->GridLayout->setSpacing(0);
427431
setLayout(d->GridLayout);
428432
}
429433

AdvancedDockingSystem/src/v2/FloatingDockContainer.cpp

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,13 @@ void FloatingDockContainerPrivate::updateDropOverlays(const QPoint& GlobalPos)
140140
return;
141141
}
142142

143+
ContainerOverlay->setAllowedAreas(TopContainer->dockAreaCount() > 1 ?
144+
OuterDockAreas : AllDockAreas);
143145
ContainerOverlay->showOverlay(TopContainer);
144146
ContainerOverlay->raise();
145147

146148
auto DockArea = TopContainer->dockAreaAt(GlobalPos);
147-
if (DockArea)
149+
if (DockArea && TopContainer->dockAreaCount() > 1)
148150
{
149151
DockAreaOverlay->setAllowedAreas(AllDockAreas);
150152
DockAreaOverlay->showOverlay(DockArea);
@@ -153,17 +155,6 @@ void FloatingDockContainerPrivate::updateDropOverlays(const QPoint& GlobalPos)
153155
{
154156
DockAreaOverlay->hideOverlay();
155157
}
156-
157-
158-
if (TopContainer)
159-
{
160-
ContainerOverlay->showOverlay(TopContainer);
161-
ContainerOverlay->raise();
162-
}
163-
else
164-
{
165-
ContainerOverlay->hideOverlay();
166-
}
167158
}
168159

169160

0 commit comments

Comments
 (0)