30 :
DropIndicatorOverlay(dropArea,
Config::self().viewFactory()->createSegmentedDropIndicatorOverlayView(this, dropArea->view()))
36 const bool userChoseOpacity = !std::isnan(
Config::self().draggedWindowOpacity());
37 if (!userChoseOpacity)
54 for (
const auto &m_segment : m_segments) {
56 return m_segment.first;
63std::unordered_map<DropLocation, Polygon> SegmentedDropIndicatorOverlay::segmentsForRect(Rect r,
bool inner,
69 const int top = (r.y() == 0 && useOffset) ? l : r.
y();
70 const int left = (r.x() == 0 && useOffset) ? l : r.
x();
71 const int right = (
rect().right() == r.right() && useOffset) ? r.right() - l : r.right();
72 const int bottom = (
rect().bottom() == r.bottom() && useOffset) ? r.bottom() - l : r.bottom();
73 const Point topLeft = { left + halfPenWidth, top + halfPenWidth };
74 const Point topRight = { right, top + halfPenWidth };
75 const Point bottomLeft = { left + halfPenWidth, bottom };
76 const Point bottomRight = {
right, bottom };
78 const Vector<Point> leftPoints = { topLeft, bottomLeft, Point(left, bottom) + Point(l, -l),
79 topLeft + Point(l, l), topLeft };
81 const Vector<Point> rightPoints = { topRight, bottomRight, bottomRight + Point(-l, -l),
82 topRight + Point(-l, l) };
84 const Vector<Point> topPoints = { topLeft, topRight, topRight + Point(-l, l),
85 topLeft + Point(l, l) };
87 const Vector<Point> bottomPoints = { bottomLeft, bottomRight, bottomRight + Point(-l, -l),
88 bottomLeft + Point(l, -l) };
92 Vector<Point> { topLeft + Point(l, l), topRight + Point(-l, l),
93 bottomRight + Point(-l, -l), bottomLeft + Point(l, -l) };
94 const int maxWidth = bounds.boundingRect().width();
95 const Point centerPos = bounds.boundingRect().center();
100 const int tabWidth = int(indicatorWidth * 0.267);
101 const int tabHeight = int(indicatorHeight * 0.187);
102 const int centerRectLeft = centerPos.x() - indicatorWidth / 2;
103 const int centerRectRight = centerPos.x() + indicatorWidth / 2;
104 const int centerRectBottom = centerPos.y() + indicatorHeight / 2;
105 const int centerRectTop = centerPos.y() - indicatorHeight / 2;
109 { centerRectLeft, centerRectTop },
110 { centerRectLeft + tabWidth, centerRectTop },
111 { centerRectLeft + tabWidth, centerRectTop + tabHeight },
112 { centerRectRight, centerRectTop + tabHeight },
113 { centerRectRight, centerRectBottom },
114 { centerRectLeft, centerRectBottom },
130void SegmentedDropIndicatorOverlay::updateSegments()
134 const auto outterSegments = segmentsForRect(
rect(),
false);
139 auto it = outterSegments.find(indicator);
140 const Polygon segment = it == outterSegments.cend() ? Polygon() : it->second;
141 m_segments[indicator] = segment;
145 const bool hasOutter = !m_segments.empty();
146 const bool useOffset = hasOutter;
147 const auto innerSegments = segmentsForRect(
hoveredGroupRect(),
true, useOffset);
152 auto it = innerSegments.find(indicator);
153 const Polygon segment = it == innerSegments.cend() ? Polygon() : it->second;
154 m_segments[indicator] = segment;
Application-wide config to tune certain behaviours of the framework.
A MultiSplitter with support for drop indicators when hovering over.
QTextStream & center(QTextStream &stream)
QTextStream & right(QTextStream &stream)