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"));
34ClassicIndicators::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);
43ClassicIndicators::~ClassicIndicators()
45 delete m_indicatorWindow;
50 return m_indicatorWindow->hover(globalPos);
55 return m_indicatorWindow->posForIndicator(loc);
58bool ClassicIndicators::innerLeftIndicatorVisible()
const
63bool ClassicIndicators::innerRightIndicatorVisible()
const
68bool ClassicIndicators::innerTopIndicatorVisible()
const
73bool ClassicIndicators::innerBottomIndicatorVisible()
const
78bool ClassicIndicators::outterLeftIndicatorVisible()
const
83bool ClassicIndicators::outterRightIndicatorVisible()
const
88bool ClassicIndicators::outterTopIndicatorVisible()
const
93bool ClassicIndicators::outterBottomIndicatorVisible()
const
98bool ClassicIndicators::tabIndicatorVisible()
const
103bool ClassicIndicators::onResize(
QSize)
105 m_indicatorWindow->resize(window()->size());
109void 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();
124void ClassicIndicators::raiseIndicators()
126 m_indicatorWindow->raise();
153void 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();
212void ClassicIndicators::updateWindowPosition()
214 QRect rect = this->rect();
215 if (KDDockWidgets::isWindow(m_indicatorWindow)) {
220 m_indicatorWindow->setGeometry(rect);
223bool ClassicIndicators::rubberBandIsTopLevel()
const
228QRect ClassicIndicators::geometryForRubberband(
QRect localRect)
const
230 if (!rubberBandIsTopLevel())
234 QPoint topLeftGlobal = m_dropArea->QWidgetAdapter::mapToGlobal(topLeftLocal);
static IndicatorWindow * createIndicatorWindow(ClassicIndicators *classicIndicators)
KDDockWidgets::Location locationToMultisplitterLocation(DropLocation location)
Application-wide config to tune certain behaviours of the framework.
void moveTo(int x, int y)
void moveTopLeft(const QPoint &position)
QPoint topLeft() const const