Removed drop icons for sidebar drops

This commit is contained in:
Uwe Kindler 2023-06-28 07:32:49 +02:00
parent 047ea3c494
commit 21189759dd
4 changed files with 28 additions and 98 deletions

View File

@ -282,10 +282,7 @@ struct DockOverlayCrossPrivate
baseRect = areaRect;
}
//if (!internal::isSideBarArea(DockWidgetArea))
//{
p.fillRect(baseRect, backgroundColor);
//}
if (areaRect.isValid())
{
@ -304,8 +301,7 @@ struct DockOverlayCrossPrivate
}
p.restore();
//if (!internal::isSideBarArea(DockWidgetArea))
//{
p.save();
// Draw outer border
pen = p.pen();
@ -320,7 +316,7 @@ struct DockOverlayCrossPrivate
QRectF FrameRect(baseRect.topLeft(), QSizeF(baseRect.width(), baseSize.height() / 10));
p.drawRect(FrameRect);
p.restore();
//}
// Draw arrow for outer container drop indicators
if (IsOuterContainerArea)
@ -359,36 +355,6 @@ struct DockOverlayCrossPrivate
p.drawPolygon(Arrow);
}
// Draw the pin icons
if (internal::isSideBarArea(DockWidgetArea))
{
static QIcon PinIcon;
if (PinIcon.isNull())
{
std::cout << "Initializing pin icon" << std::endl;
QFile file(":/ads/images/vs-pin-button.svg");
file.open(QIODevice::ReadOnly);
QByteArray baData = file.readAll();
baData.replace("#000000", borderColor.name(QColor::HexRgb).toLatin1());
//baData.replace("#ffffff", overlayColor.name(QColor::HexArgb).toLatin1());
//std::cout << borderColor.name(QColor::HexRgb) << std::endl;
QSvgRenderer svgRenderer(baData);
QPixmap pix(svgRenderer.defaultSize());
pix.fill(Qt::transparent);
// create painter to act over pixmap
QPainter pixPainter(&pix);
svgRenderer.render(&pixPainter);
PinIcon = QIcon(pix);
}
//p.drawPixmap(0, PinIcon.paint(painter, rect, alignment, mode, state));
auto Rect = QRect(0, 0, 16, 16);
//Rect.setSize(baseRect.size() * 0.8);
Rect.moveCenter(baseRect.center().toPoint());
PinIcon.paint(&p, Rect, Qt::AlignCenter);
//auto Pixmap = PinIcon.pixmap(_this->windowHandle(), QSize(16, 16));
//p.drawPixmap(QPoint(0, 0), Pixmap);
}
pm.setDevicePixelRatio(DevicePixelRatio);
return pm;
}
@ -489,10 +455,12 @@ DockWidgetArea CDockOverlay::dropAreaUnderCursor() const
}
auto DockArea = qobject_cast<CDockAreaWidget*>(d->TargetWidget.data());
if (!DockArea)
if (!DockArea && CDockManager::autoHideConfigFlags().testFlag(CDockManager::AutoHideFeatureEnabled))
{
auto Rect = rect();
const QPoint pos = mapFromGlobal(QCursor::pos());
std::cout << "pos.y: " << pos.y() << " d->sideBarMouseZone(SideBarTop) " << d->sideBarMouseZone(SideBarTop) << std::endl;
if (pos.x() < d->sideBarMouseZone(SideBarLeft))
{
return LeftAutoHideArea;
@ -515,6 +483,10 @@ DockWidgetArea CDockOverlay::dropAreaUnderCursor() const
}
return Result;
}
else if (!DockArea)
{
return Result;
}
if (DockArea->allowedAreas().testFlag(CenterDockWidgetArea)
&& !DockArea->titleBar()->isHidden()
@ -612,6 +584,7 @@ void CDockOverlay::paintEvent(QPaintEvent* event)
double Factor = (CDockOverlay::ModeContainerOverlay == d->Mode) ?
3 : 2;
std::cout << "paint: da: " << da << std::endl;
switch (da)
{
case TopDockWidgetArea: r.setHeight(r.height() / Factor); break;
@ -707,23 +680,6 @@ QPoint DockOverlayCrossPrivate::areaGridPosition(const DockWidgetArea area)
default: return QPoint();
}
}
else if (CDockManager::autoHideConfigFlags().testFlag(CDockManager::AutoHideFeatureEnabled))
{
switch (area)
{
case TopDockWidgetArea: return QPoint(1, 3);
case RightDockWidgetArea: return QPoint(3, 5);
case BottomDockWidgetArea: return QPoint(5, 3);
case LeftDockWidgetArea: return QPoint(3, 1);
case CenterDockWidgetArea: return QPoint(3, 3);
case TopAutoHideArea: return QPoint(0, 3);
case RightAutoHideArea: return QPoint(3, 6);
case BottomAutoHideArea: return QPoint(6, 3);
case LeftAutoHideArea: return QPoint(3, 0);
default: return QPoint();
}
}
else
{
switch (area)
@ -778,15 +734,6 @@ void CDockOverlayCross::setupOverlayCross(CDockOverlay::eMode Mode)
areaWidgets.insert(LeftDockWidgetArea, d->createDropIndicatorWidget(LeftDockWidgetArea, Mode));
areaWidgets.insert(CenterDockWidgetArea, d->createDropIndicatorWidget(CenterDockWidgetArea, Mode));
if (CDockManager::autoHideConfigFlags().testFlag(CDockManager::AutoHideFeatureEnabled)
&& CDockOverlay::ModeContainerOverlay == Mode)
{
areaWidgets.insert(TopAutoHideArea, d->createDropIndicatorWidget(TopAutoHideArea, Mode));
areaWidgets.insert(RightAutoHideArea, d->createDropIndicatorWidget(RightAutoHideArea, Mode));
areaWidgets.insert(BottomAutoHideArea, d->createDropIndicatorWidget(BottomAutoHideArea, Mode));
areaWidgets.insert(LeftAutoHideArea, d->createDropIndicatorWidget(LeftAutoHideArea, Mode));
}
#if QT_VERSION >= 0x050600
d->LastDevicePixelRatio = devicePixelRatioF();
#else
@ -873,26 +820,6 @@ void CDockOverlayCross::setAreaWidgets(const QHash<DockWidgetArea, QWidget*>& wi
d->GridLayout->setColumnStretch(3, 0);
d->GridLayout->setColumnStretch(4, 1);
}
else if (CDockManager::autoHideConfigFlags().testFlag(CDockManager::AutoHideFeatureEnabled))
{
d->GridLayout->setContentsMargins(4, 4, 4, 4);
d->GridLayout->setSpacing(4);
d->GridLayout->setRowStretch(0, 0);
d->GridLayout->setRowStretch(1, 0);
d->GridLayout->setRowStretch(2, 1);
d->GridLayout->setRowStretch(3, 1);
d->GridLayout->setRowStretch(4, 1);
d->GridLayout->setRowStretch(5, 0);
d->GridLayout->setRowStretch(6, 0);
d->GridLayout->setColumnStretch(0, 0);
d->GridLayout->setColumnStretch(1, 0);
d->GridLayout->setColumnStretch(2, 1);
d->GridLayout->setColumnStretch(3, 1);
d->GridLayout->setColumnStretch(4, 1);
d->GridLayout->setColumnStretch(5, 0);
d->GridLayout->setColumnStretch(6, 0);
}
else
{
d->GridLayout->setContentsMargins(4, 4, 4, 4);

View File

@ -128,6 +128,8 @@ void FloatingDragPreviewPrivate::updateDropOverlays(const QPoint &GlobalPos)
auto DockAreaOverlay = DockManager->dockAreaOverlay();
auto DockDropArea = DockAreaOverlay->dropAreaUnderCursor();
auto ContainerDropArea = ContainerOverlay->dropAreaUnderCursor();
std::cout << "ContainerDropArea " << ContainerDropArea << std::endl;
std::cout << "DockDropArea " << DockDropArea << std::endl;
if (!TopContainer)
{

View File

@ -89,6 +89,7 @@ enum DockWidgetArea
InvalidDockWidgetArea = NoDockWidgetArea,
OuterDockAreas = TopDockWidgetArea | LeftDockWidgetArea | RightDockWidgetArea | BottomDockWidgetArea,
AutoHideDockAreas = LeftAutoHideArea | RightAutoHideArea | TopAutoHideArea | BottomAutoHideArea,
AllDockAreas = OuterDockAreas | CenterDockWidgetArea
};
Q_DECLARE_FLAGS(DockWidgetAreas, DockWidgetArea)

View File

@ -5,7 +5,7 @@ TARGET = $$qtLibraryTarget(qtadvanceddocking)
DEFINES += QT_DEPRECATED_WARNINGS
TEMPLATE = lib
DESTDIR = $${ADS_OUT_ROOT}/lib
QT += core gui widgets svg
QT += core gui widgets
!adsBuildStatic {
CONFIG += shared