13#include "core/DropIndicatorOverlay_p.h"
14#include "kddockwidgets/core/indicators/ClassicDropIndicatorOverlay.h"
15#include "core/Utils_p.h"
35 name = QStringLiteral(
"center");
38 name = QStringLiteral(
"inner_left");
41 name = QStringLiteral(
"inner_right");
44 name = QStringLiteral(
"inner_bottom");
47 name = QStringLiteral(
"inner_top");
50 name = QStringLiteral(
"outter_left");
53 name = QStringLiteral(
"outter_bottom");
56 name = QStringLiteral(
"outter_right");
59 name = QStringLiteral(
"outter_top");
75 , m_classicIndicators(classicIndicators)
83 auto subContext =
new QQmlContext(
plat()->qmlEngine()->rootContext(),
this);
84 subContext->setContextProperty(QStringLiteral(
"_kddw_overlayWindow"),
this);
86 Q_ASSERT(m_overlayItem);
88 m_overlayItem->setZ(2);
90 m_window->rootContext()->setContextProperty(QStringLiteral(
"_kddw_overlayWindow"),
this);
91 m_window->
init(qmlSouceUrl());
163 QQuickItem *item = indicatorForPos(pt);
172QQuickItem *ClassicDropIndicatorOverlay::indicatorForPos(
QPoint pt)
const
175 Q_ASSERT(indicators.
size() == 9);
177 for (QQuickItem *item : indicators) {
178 if (item->isVisible()) {
179 QRect rect(0, 0,
int(item->width()),
int(item->height()));
180 rect.moveTopLeft(item->mapToGlobal(
QPointF(0, 0)).toPoint());
181 if (rect.contains(pt)) {
198 return indicator->mapToGlobal(indicator->boundingRect().center()).toPoint();
214 if (KDDockWidgets::isOffscreen()) {
233QUrl ClassicDropIndicatorOverlay::qmlSouceUrl()
const
235 return QUrl(QStringLiteral(
"qrc:/kddockwidgets/qtquick/views/qml/ClassicIndicatorsOverlay.qml"));
241 Q_ASSERT(indicators.
size() == 9);
243 for (QQuickItem *item : indicators) {
244 if (locationForIndicator(item) == loc)
248 qWarning() << Q_FUNC_INFO <<
"Couldn't find indicator for location" << loc;
252DropLocation ClassicDropIndicatorOverlay::locationForIndicator(
const QQuickItem *item)
const
254 return DropLocation(item->property(
"indicatorType").toInt());
262 QQuickItem *root = m_window ? m_window->rootObject() : m_overlayItem;
264 for (QQuickItem *item : items) {
268 }
else if (item->objectName() ==
QLatin1String(
"innerIndicators")) {
270 for (QQuickItem *innerItem : innerIndicators) {
293 m_window->setGeometry(geo);
307 m_window->setVisible(is);
310 m_overlayItem->setVisible(is);
317 m_window->resize(sz);
325 return m_window !=
nullptr;
void setObjectName(const QString &name)
QObject * parent() const const
QString fromLatin1(const char *str, int size)
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const const
void push_back(const T &value)