mirror of
https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System.git
synced 2024-11-15 13:15:43 +08:00
Improved design of drop overlay cross
This commit is contained in:
parent
fade9d7b7c
commit
52aedfed31
@ -17,7 +17,7 @@ ads--CDockContainerWidget QSplitter::handle
|
||||
ads--CDockAreaWidget
|
||||
{
|
||||
background: palette(window);
|
||||
border: 1px solid palette(light);
|
||||
border: 1px solid white;
|
||||
}
|
||||
|
||||
ads--CDockAreaWidget #tabsMenuButton::menu-indicator
|
||||
@ -57,12 +57,10 @@ ads--CDockWidget
|
||||
border-width: 1px 0 0 0;
|
||||
}
|
||||
|
||||
QPushButton#closeButton
|
||||
{
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
QPushButton#closeButton,
|
||||
QPushButton#tabsMenuButton
|
||||
{
|
||||
padding: 0px;
|
||||
padding: 1px;
|
||||
}
|
||||
|
||||
|
||||
|
@ -277,6 +277,7 @@ DockAreaWidgetPrivate::DockAreaWidgetPrivate(CDockAreaWidget* _public) :
|
||||
void DockAreaWidgetPrivate::createTabBar()
|
||||
{
|
||||
TitleBar = new QFrame(_this);
|
||||
TitleBar->setObjectName("dockAreaTitleBar");
|
||||
TopLayout = new QBoxLayout(QBoxLayout::LeftToRight);
|
||||
TopLayout->setContentsMargins(0, 0, 0, 0);
|
||||
TopLayout->setSpacing(0);
|
||||
@ -378,7 +379,6 @@ CDockAreaWidget::CDockAreaWidget(CDockManager* DockManager, CDockContainerWidget
|
||||
d(new DockAreaWidgetPrivate(this))
|
||||
{
|
||||
d->DockManager = DockManager;
|
||||
setStyleSheet("ads--CDockAreaWidget {border: 1px solid white;}");
|
||||
d->Layout = new QBoxLayout(QBoxLayout::TopToBottom);
|
||||
d->Layout->setContentsMargins(0, 0, 0, 0);
|
||||
d->Layout->setSpacing(0);
|
||||
|
@ -85,6 +85,11 @@ CDockManager::CDockManager(QWidget *parent) :
|
||||
//============================================================================
|
||||
CDockManager::~CDockManager()
|
||||
{
|
||||
auto FloatingWidgets = d->FloatingWidgets;
|
||||
for (auto FloatingWidget : FloatingWidgets)
|
||||
{
|
||||
delete FloatingWidget;
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
|
@ -43,18 +43,22 @@ namespace ads
|
||||
//============================================================================
|
||||
static QPixmap createDropIndicatorPixmap(const QPalette& pal, const QSizeF& size, DockWidgetArea DockWidgetArea)
|
||||
{
|
||||
const QColor borderColor = pal.color(QPalette::Active, QPalette::Highlight);
|
||||
const QColor backgroundColor = pal.color(QPalette::Active, QPalette::Base);
|
||||
const QColor areaBackgroundColor = pal.color(QPalette::Active, QPalette::Highlight).lighter(150);
|
||||
QColor borderColor = pal.color(QPalette::Active, QPalette::Highlight);
|
||||
QColor backgroundColor = pal.color(QPalette::Active, QPalette::Base);
|
||||
QColor areaBackgroundColor = pal.color(QPalette::Active, QPalette::Highlight).lighter(150);
|
||||
|
||||
QPixmap pm(size.width(), size.height());
|
||||
pm.fill(QColor(0, 0, 0, 0));
|
||||
|
||||
QPainter p(&pm);
|
||||
QPen pen = p.pen();
|
||||
QRectF baseRect(pm.rect());
|
||||
QRectF ShadowRect(pm.rect());
|
||||
QRectF baseRect;
|
||||
baseRect.setSize(ShadowRect.size() * 0.7);
|
||||
baseRect.moveCenter(ShadowRect.center());
|
||||
|
||||
// Fill
|
||||
p.fillRect(ShadowRect, QColor(0, 0, 0, 64));
|
||||
p.fillRect(baseRect, backgroundColor);
|
||||
|
||||
// Drop area rect.
|
||||
@ -71,13 +75,13 @@ static QPixmap createDropIndicatorPixmap(const QPalette& pal, const QSizeF& size
|
||||
gradient.setFinalStop(areaRect.bottomLeft());
|
||||
break;
|
||||
case RightDockWidgetArea:
|
||||
areaRect = QRectF(baseRect.width() * .5f, baseRect.y(), baseRect.width() * .5f, baseRect.height());
|
||||
areaRect = QRectF(ShadowRect.width() * .5f, baseRect.y(), baseRect.width() * .5f, baseRect.height());
|
||||
areaLine = QLineF(areaRect.topLeft(), areaRect.bottomLeft());
|
||||
gradient.setStart(areaRect.topLeft());
|
||||
gradient.setFinalStop(areaRect.topRight());
|
||||
break;
|
||||
case BottomDockWidgetArea:
|
||||
areaRect = QRectF(baseRect.x(), baseRect.height() * .5f, baseRect.width(), baseRect.height() * .5f);
|
||||
areaRect = QRectF(baseRect.x(), ShadowRect.height() * .5f, baseRect.width(), baseRect.height() * .5f);
|
||||
areaLine = QLineF(areaRect.topLeft(), areaRect.topRight());
|
||||
gradient.setStart(areaRect.topLeft());
|
||||
gradient.setFinalStop(areaRect.bottomLeft());
|
||||
@ -123,7 +127,7 @@ QWidget* createDropIndicatorWidget(DockWidgetArea DockWidgetArea)
|
||||
QLabel* l = new QLabel();
|
||||
l->setObjectName("DockWidgetAreaLabel");
|
||||
|
||||
const qreal metric = static_cast<qreal>(l->fontMetrics().height()) * 2.f;
|
||||
const qreal metric = static_cast<qreal>(l->fontMetrics().height()) * 3.f;
|
||||
const QSizeF size(metric, metric);
|
||||
|
||||
l->setPixmap(createDropIndicatorPixmap(l->palette(), size, DockWidgetArea));
|
||||
@ -423,7 +427,7 @@ CDockOverlayCross::CDockOverlayCross(CDockOverlay* overlay) :
|
||||
setAttribute(Qt::WA_TranslucentBackground);
|
||||
|
||||
d->GridLayout = new QGridLayout();
|
||||
d->GridLayout->setSpacing(6);
|
||||
d->GridLayout->setSpacing(0);
|
||||
setLayout(d->GridLayout);
|
||||
}
|
||||
|
||||
|
@ -140,11 +140,13 @@ void FloatingDockContainerPrivate::updateDropOverlays(const QPoint& GlobalPos)
|
||||
return;
|
||||
}
|
||||
|
||||
ContainerOverlay->setAllowedAreas(TopContainer->dockAreaCount() > 1 ?
|
||||
OuterDockAreas : AllDockAreas);
|
||||
ContainerOverlay->showOverlay(TopContainer);
|
||||
ContainerOverlay->raise();
|
||||
|
||||
auto DockArea = TopContainer->dockAreaAt(GlobalPos);
|
||||
if (DockArea)
|
||||
if (DockArea && TopContainer->dockAreaCount() > 1)
|
||||
{
|
||||
DockAreaOverlay->setAllowedAreas(AllDockAreas);
|
||||
DockAreaOverlay->showOverlay(DockArea);
|
||||
@ -153,17 +155,6 @@ void FloatingDockContainerPrivate::updateDropOverlays(const QPoint& GlobalPos)
|
||||
{
|
||||
DockAreaOverlay->hideOverlay();
|
||||
}
|
||||
|
||||
|
||||
if (TopContainer)
|
||||
{
|
||||
ContainerOverlay->showOverlay(TopContainer);
|
||||
ContainerOverlay->raise();
|
||||
}
|
||||
else
|
||||
{
|
||||
ContainerOverlay->hideOverlay();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user