12 #include "ClassicIndicators_p.h"
15 #include "ClassicIndicatorsWindow_p.h"
17 #include "private/DropArea_p.h"
18 #include "private/DragController_p.h"
19 #include "private/Frame_p.h"
20 #include "private/Logging_p.h"
21 #include "private/DockRegistry_p.h"
22 #include "private/Utils_p.h"
28 auto window =
new IndicatorWindow(classicIndicators);
29 window->setObjectName(QStringLiteral(
"_docks_IndicatorWindow_Overlay"));
34 ClassicIndicators::ClassicIndicators(DropArea *dropArea)
35 : DropIndicatorOverlayInterface(dropArea)
36 , m_rubberBand(
Config::self().frameworkWidgetFactory()->createRubberBand(rubberBandIsTopLevel() ? nullptr : dropArea))
39 if (rubberBandIsTopLevel())
40 m_rubberBand->setWindowOpacity(0.5);
43 ClassicIndicators::~ClassicIndicators()
45 delete m_indicatorWindow;
50 return m_indicatorWindow->hover(globalPos);
55 return m_indicatorWindow->posForIndicator(loc);
58 bool ClassicIndicators::innerLeftIndicatorVisible()
const
63 bool ClassicIndicators::innerRightIndicatorVisible()
const
68 bool ClassicIndicators::innerTopIndicatorVisible()
const
73 bool ClassicIndicators::innerBottomIndicatorVisible()
const
78 bool ClassicIndicators::outterLeftIndicatorVisible()
const
83 bool ClassicIndicators::outterRightIndicatorVisible()
const
88 bool ClassicIndicators::outterTopIndicatorVisible()
const
93 bool ClassicIndicators::outterBottomIndicatorVisible()
const
98 bool ClassicIndicators::tabIndicatorVisible()
const
103 bool ClassicIndicators::onResize(
QSize)
105 m_indicatorWindow->resize(window()->size());
109 void ClassicIndicators::updateVisibility()
112 m_indicatorWindow->updatePositions();
113 m_indicatorWindow->setVisible(
true);
114 updateWindowPosition();
117 m_rubberBand->setVisible(
false);
118 m_indicatorWindow->setVisible(
false);
121 Q_EMIT indicatorsVisibleChanged();
124 void ClassicIndicators::raiseIndicators()
126 m_indicatorWindow->raise();
153 void ClassicIndicators::setDropLocation(
DropLocation location)
155 setCurrentDropLocation(location);
158 m_rubberBand->setVisible(
false);
163 m_rubberBand->setGeometry(geometryForRubberband(m_hoveredFrame ? m_hoveredFrame->QWidgetAdapter::geometry() : rect()));
164 m_rubberBand->setVisible(
true);
165 if (rubberBandIsTopLevel()) {
166 m_rubberBand->raise();
174 Frame *relativeToFrame =
nullptr;
181 if (!m_hoveredFrame) {
182 qWarning() <<
"ClassicIndicators::setCurrentDropLocation: frame is null. location=" << location
183 <<
"; isHovered=" << isHovered()
184 <<
"; dropArea->widgets=" << m_dropArea->items();
188 relativeToFrame = m_hoveredFrame;
199 auto windowBeingDragged = DragController::instance()->windowBeingDragged();
201 QRect rect = m_dropArea->rectForDrop(windowBeingDragged, multisplitterLocation,
202 m_dropArea->itemForFrame(relativeToFrame));
204 m_rubberBand->setGeometry(geometryForRubberband(rect));
205 m_rubberBand->setVisible(
true);
206 if (rubberBandIsTopLevel()) {
207 m_rubberBand->raise();
212 void ClassicIndicators::updateWindowPosition()
214 QRect rect = this->rect();
215 if (KDDockWidgets::isWindow(m_indicatorWindow)) {
220 m_indicatorWindow->setGeometry(rect);
223 bool ClassicIndicators::rubberBandIsTopLevel()
const
225 return Config::self().internalFlags() & Config::InternalFlag_TopLevelIndicatorRubberBand;
228 QRect ClassicIndicators::geometryForRubberband(
QRect localRect)
const
230 if (!rubberBandIsTopLevel())
234 QPoint topLeftGlobal = m_dropArea->QWidgetAdapter::mapToGlobal(topLeftLocal);