KDDockWidgets API Documentation 2.0
Loading...
Searching...
No Matches
qtquick/views/View.cpp
Go to the documentation of this file.
1/*
2 This file is part of KDDockWidgets.
3
4 SPDX-FileCopyrightText: 2020 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: SĂ©rgio Martins <sergio.martins@kdab.com>
6
7 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only
8
9 Contact KDAB at <info@kdab.com> for commercial licensing options.
10*/
11
12#include "View.h"
13#include "core/Utils_p.h"
14#include "core/View_p.h"
15#include "ViewWrapper_p.h"
16#include "core/layouting/Item_p.h"
17#include "core/ScopedValueRollback_p.h"
18#include "qtquick/Window_p.h"
19#include "qtquick/Platform.h"
20#include "core/Group.h"
21
22#include <QtQuick/private/qquickitem_p.h>
23#include <qpa/qplatformwindow.h>
24#include <QtGui/private/qhighdpiscaling_p.h>
25#include <QGuiApplication>
26#include <QFile>
27#include <QQmlContext>
28
29using namespace KDDockWidgets;
30using namespace KDDockWidgets::QtQuick;
31
32namespace KDDockWidgets::QtQuick {
33
39class MouseEventRedirector : public QObject
40{
42public:
43 explicit MouseEventRedirector(QQuickItem *eventSource, View *eventTarget)
44 : QObject(eventTarget)
45 , m_eventSource(eventSource)
46 , m_eventTarget(eventTarget)
47 {
48 eventSource->installEventFilter(this);
49
50 // Each source can only have one MouseEventRedirector
51 auto oldRedirector = s_mouseEventRedirectors.take(eventSource);
52 if (oldRedirector) {
53 eventSource->removeEventFilter(oldRedirector);
54 oldRedirector->deleteLater();
55 }
56
57 s_mouseEventRedirectors.insert(eventSource, this);
58 }
59
60 static MouseEventRedirector *redirectorForSource(QObject *eventSource)
61 {
62 return s_mouseEventRedirectors.value(eventSource);
63 }
64
65 ~MouseEventRedirector() override;
66
67 bool eventFilter(QObject *source, QEvent *ev) override
68 {
69 if (QHoverEvent *hev = hoverEvent(ev)) {
71 m_eventTarget->onHoverEvent(
72 hev, m_eventSource->mapToGlobal(Qt5Qt6Compat::eventPos(hev)).toPoint());
73 return false;
74 }
76 QMouseEvent *me = mouseEvent(ev);
77 if (!me)
78 return false;
80 // MouseArea.enable is different from Item.enabled. The former still lets the events
81 // go through event loops. So query MouseArea.enable here and bail out if false.
82 const QVariant v = source->property("enabled");
83 if (v.isValid() && !v.toBool())
84 return false;
86 // Finally send the event
87 m_eventTarget->setProperty("cursorPosition", m_eventSource->property("cursorPosition"));
88 QPointer<QObject> lifeGuard(this);
89 qGuiApp->sendEvent(m_eventTarget, me);
91 if (!lifeGuard) {
92 // m_eventTarget was deleted, and so was "this"
93 return true;
94 }
96 m_eventTarget->setProperty("cursorPosition", CursorPosition_Undefined);
98 return false;
99 }
101 QQuickItem *const m_eventSource;
102 View *const m_eventTarget;
103 static QHash<QObject *, MouseEventRedirector *> s_mouseEventRedirectors;
106QHash<QObject *, MouseEventRedirector *> MouseEventRedirector::s_mouseEventRedirectors = {};
108MouseEventRedirector::~MouseEventRedirector()
110 s_mouseEventRedirectors.remove(m_eventSource);
114
117 return flags & (Qt::Window | Qt::Tool);
119
120static QQuickItem *actualParentItem(QQuickItem *candidateParentItem, Qt::WindowFlags flags)
122 // When we have a top-level, such as FloatingWindow, we only want to set QObject parentship
123 // and not parentItem.
124 return flagsAreTopLevelFlags(flags) ? nullptr : candidateParentItem;
127View::View(Core::Controller *controller, Core::ViewType type, QQuickItem *parent,
129 : QQuickItem(actualParentItem(parent, flags))
130 , View_qt(controller, type, this)
131 , m_windowFlags(flags)
133 if (parent && flagsAreTopLevelFlags(flags)) {
134 // See comment in actualParentItem(). We set only the QObject parent. Mimics QWidget
135 // behaviour
139 connect(this, &QQuickItem::widthChanged, this, [this] {
140 if (!Core::View::d->aboutToBeDestroyed()) { // If Window is being destroyed we don't bother
141 onResize(Core::View::size());
142 updateGeometry();
144 });
145
146 connect(this, &QQuickItem::heightChanged, this, [this] {
147 if (!Core::View::d->aboutToBeDestroyed()) { // If Window is being destroyed we don't bother
148 onResize(Core::View::size());
149 updateGeometry();
150 }
151 });
153 qGuiApp->installEventFilter(this);
154 _setSize({ 800, 800 });
155}
159 setSize(rect.width(), rect.height());
160 Core::View::move(rect.topLeft());
161}
162
163QQuickItem *View::createItem(QQmlEngine *engine, const QString &filename, QQmlContext *context)
164{
165 QQmlComponent component(engine, filename);
166 QObject *obj = component.create(context);
167 if (!obj) {
168 qWarning() << Q_FUNC_INFO << component.errorString();
169 return nullptr;
171
172 return qobject_cast<QQuickItem *>(obj);
173}
174
175void View::redirectMouseEvents(QQuickItem *source)
176{
177 if (auto existingRedirector = MouseEventRedirector::redirectorForSource(source)) {
178 if (existingRedirector->m_eventTarget == this) {
179 // Nothing to do. The specified event source is already redirecting to this instance
180 return;
181 }
182 }
183
184 new MouseEventRedirector(source, this);
185}
186
187void View::sendVisibleChangeEvent()
188{
189 if (Core::View::d->freed())
190 return;
191
192 if (m_inSetParent) {
193 // Setting parent to nullptr will emit visible true in QtQuick
194 // which we don't want, as we're going to hide it (as we do with QtWidgets)
195 return;
196 }
197
198 QEvent ev(isVisible() ? QEvent::Show : QEvent::Hide);
199 event(&ev);
200}
201
202void View::itemChange(QQuickItem::ItemChange change, const QQuickItem::ItemChangeData &data)
203{
204 QQuickItem::itemChange(change, data);
205
206 // Emulate the QWidget behaviour as QQuickItem doesn't receive some QEvents.
207 if (change == QQuickItem::ItemVisibleHasChanged)
208 sendVisibleChangeEvent();
209}
210
211void View::updateNormalGeometry()
212{
213 QWindow *window = QQuickItem::window();
214 if (!window) {
215 return;
216 }
217
219 if (const QPlatformWindow *pw = window->handle()) {
220 normalGeometry = QHighDpi::fromNativePixels(pw->normalGeometry(), pw->window());
221 }
222
223 if (!normalGeometry.isValid() && isNormalWindowState(WindowState(window->windowState()))) {
224 normalGeometry = window->geometry();
225 }
226
227 if (normalGeometry.isValid()) {
229 }
230}
231
232void View::move(int x, int y)
233{
234 if (isRootView()) {
235 if (QWindow *w = QQuickItem::window()) {
236 w->setPosition(x, y);
237 return;
238 }
239 }
240
241 QQuickItem::setX(x);
242 QQuickItem::setY(y);
244}
245
247{
248 if (ev->type() == QEvent::Close)
249 Core::View::d->requestClose(static_cast<QCloseEvent *>(ev));
250
251 return QQuickItem::event(ev);
252}
253
255{
256 if (qobject_cast<QWindow *>(watched)) {
257 if (m_mouseTrackingEnabled) {
258 switch (ev->type()) {
262 ev->ignore();
263 qGuiApp->sendEvent(this, ev);
264 // qDebug() << "Mouse event" << ev;
265 if (ev->isAccepted())
266 return true;
267 break;
268 default:
269 break;
270 }
271 }
272
273 if (ev->type() == QEvent::Resize || ev->type() == QEvent::Move) {
274 updateNormalGeometry();
275 } else if (ev->type() == QEvent::WindowStateChange) {
277 }
278 }
279
280 return QQuickItem::eventFilter(watched, ev);
281}
282
283bool View::close(QQuickItem *item)
284{
285 if (auto viewqtquick = qobject_cast<View *>(item)) {
286 QCloseEvent ev;
287 viewqtquick->Core::View::d->closeRequested.emit(&ev);
288
289 if (ev.isAccepted()) {
290 viewqtquick->setVisible(false);
291 return true;
292 }
293 }
294
295 return false;
296}
297
299{
300 return close(this);
301}
302
303void View::QQUICKITEMgeometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
304{
305 // Send a few events manually, since QQuickItem doesn't do it for us.
306 QQuickItem::QQUICKITEMgeometryChanged(newGeometry, oldGeometry);
307
308 // Not calling event() directly, otherwise it would skip event filters
309
310 if (newGeometry.size() != oldGeometry.size()) {
312 qGuiApp->sendEvent(this, &ev);
313 }
314
315 if (newGeometry.topLeft() != oldGeometry.topLeft()) {
317 qGuiApp->sendEvent(this, &ev);
318 }
319
320 Q_EMIT itemGeometryChanged();
321}
322
323bool View::isVisible() const
324{
325 if (QWindow *w = QQuickItem::window()) {
326 if (!w->isVisible())
327 return false;
328 }
329
330 // QQuickItemPrivate::explicitVisible is the actual visible state independently from the parent
331 // being visible or not. This is what we want to save with LayoutSaver.
332 // For now, we have no use case to know what is the effectiveVisible state. If we need it, then we'll
333 // need to have more API for this.
334
335 auto priv = QQuickItemPrivate::get(this);
336 return priv->explicitVisible;
337}
338
339void View::setVisible(bool is)
340{
341 if (isRootView()) {
342 if (QWindow *w = QQuickItem::window()) {
343 if (is && !w->isVisible()) {
344 w->show();
345 } else if (!is && w->isVisible()) {
346 w->hide();
347 }
348 }
349 }
350
351 QQuickItem::setVisible(is);
352
353#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
354 // Workaround QTBUG-112838, QQuickItem::itemChanged() isn't called anymore if there's no parent
355 if (is && !parentItem() && !QQuickItem::isVisible()) {
356 sendVisibleChangeEvent();
357 }
358#endif
359}
360
362{
363 auto priv = QQuickItemPrivate::get(this);
364 return !priv->explicitVisible;
365}
366
367void View::setSize(int w, int h)
368{
369 const auto newSize = QSize(w, h).expandedTo(minSize());
370 _setSize(newSize);
371}
372
373void View::_setSize(QSize newSize)
374{
375 // Like setSize() but does not honour minSize()
376
377 if (isRootView()) {
378 if (QWindow *window = QQuickItem::window()) {
379
380 if (window->size() != newSize) {
381 QRect windowGeo = window->geometry();
382 windowGeo.setSize(newSize);
383 window->setGeometry(windowGeo);
384 }
385 }
386 }
387
388 QQuickItem::setSize(newSize);
389}
390
391std::shared_ptr<Core::View> View::rootView() const
392{
393 if (Core::Window::Ptr window = View::window())
394 return window->rootView();
395
396 auto thisNonConst = const_cast<View *>(this);
397 return thisNonConst->asWrapper();
398}
399
400void View::makeItemFillParent(QQuickItem *item)
401{
402 if (!item) {
403 qWarning() << Q_FUNC_INFO << "Invalid item";
404 return;
405 }
406
407 QQuickItem *parentItem = item->parentItem();
408 if (!parentItem) {
409 qWarning() << Q_FUNC_INFO << "Invalid parentItem for" << item;
410 return;
411 }
412
413 QObject *anchors = item->property("anchors").value<QObject *>();
414 if (!anchors) {
415 qWarning() << Q_FUNC_INFO << "Invalid anchors for" << item;
416 return;
417 }
418
419 anchors->setProperty("fill", QVariant::fromValue(parentItem));
420}
421
423{
424 if (enable)
425 m_widgetAttributes |= attr;
426 else
427 m_widgetAttributes &= ~attr;
428}
429
431{
432 return m_widgetAttributes & attr;
433}
434
436{
437 if (on) {
438 m_windowFlags |= f;
439 } else {
440 m_windowFlags &= ~f;
441 }
442}
443
445{
446 return m_windowFlags;
447}
448
450{
451 const QSize min = property("kddockwidgets_min_size").toSize();
452 return min.expandedTo(Core::Item::hardcodedMinimumSize);
453}
454
456{
457 const QSize max = property("kddockwidgets_max_size").toSize();
458 return max.isEmpty() ? Core::Item::hardcodedMaximumSize
459 : max.boundedTo(Core::Item::hardcodedMaximumSize);
460}
461
463{
464 if (isRootView()) {
465 if (QWindow *w = QQuickItem::window()) {
466 return w->geometry();
467 }
468 }
469
470 return QRect(QPointF(QQuickItem::x(), QQuickItem::y()).toPoint(), QQuickItem::size().toSize());
471}
472
474{
475 return m_normalGeometry;
476}
477
479{
480 m_normalGeometry = geo;
481}
482
484{
485 if (maxSizeHint() != sz) {
486 setProperty("kddockwidgets_max_size", sz);
488 Core::View::d->layoutInvalidated.emit();
489 }
490}
491
492void View::setWidth(int w)
493{
494 QQuickItem::setWidth(w);
495}
496
498{
499 QQuickItem::setHeight(h);
500}
501
503{
504 setWidth(w);
505}
506
508{
509 setHeight(h);
510}
511
513{
514 setVisible(true);
515}
516
518{
519 setVisible(false);
520}
521
523{
524 Q_EMIT geometryUpdated();
525}
526
528{
529 // Nothing to do for QtQuick
530}
531
532void View::setParent(QQuickItem *parentItem)
533{
534 {
535 ScopedValueRollback guard(m_inSetParent, true);
536 QQuickItem::setParent(parentItem);
537 QQuickItem::setParentItem(parentItem);
538 }
539
540 // Mimic QWidget::setParent(), hide widget when setting parent
541 // Only of no parent item though, as that causes binding loops. Since it's benign we won't
542 // bother making it strictly like qtwidgets.
543 if (!parentItem && !m_inDtor)
544 setVisible(false);
545}
546
548{
550}
551
552void View::raiseAndActivate(QQuickItem *item)
553{
554 if (QWindow *w = item->window()) {
555 w->raise();
556 w->requestActivate();
557 }
558}
559
561{
562 raiseAndActivate(this);
563}
564
566{
567 if (QWindow *w = QQuickItem::window())
568 w->requestActivate();
569}
570
572{
573 if (isRootView()) {
574 if (QWindow *w = QQuickItem::window())
575 w->raise();
576 } else if (auto p = QQuickItem::parentItem()) {
577 // It's not a top-level, so just increase its Z-order
578 const auto siblings = p->childItems();
579 QQuickItem *last = siblings.last();
580 if (last != this)
581 stackAfter(last);
582 }
583}
584
585/*static*/ bool View::isRootView(const QQuickItem *item)
586{
587 QQuickItem *parent = item->parentItem();
588 if (!parent)
589 return true;
590
591 if (auto *w = qobject_cast<QQuickWindow *>(item->window())) {
592 if (parent == w->contentItem() || item == w->contentItem())
593 return true;
594 if (auto *qv = qobject_cast<QQuickView *>(item->window())) {
595 if (parent == qv->rootObject() || item == qv->rootObject())
596 return true;
597 }
598 }
599
600 return false;
601}
602
604{
605 return View::isRootView(this);
606}
607
608QQuickView *View::quickView() const
609{
610 return qobject_cast<QQuickView *>(QQuickItem::window());
611}
612
614{
615 return QQuickItem::mapToGlobal(localPt).toPoint();
616}
617
619{
620 return QQuickItem::mapFromGlobal(globalPt).toPoint();
621}
622
624{
625 if (!parent)
626 return {};
627
628 auto parentItem = asQQuickItem(parent);
629 return parentItem->mapFromGlobal(QQuickItem::mapToGlobal(pos)).toPoint();
630}
631
633{
634 if (QWindow *w = QQuickItem::window())
635 w->setOpacity(v);
636}
637
639{
640 if (QWindow *w = QQuickItem::window())
641 w->setTitle(title);
642}
643
644void View::setWindowIcon(const QIcon &icon)
645{
646 if (QWindow *w = QQuickItem::window())
647 w->setIcon(icon);
648}
649
651{
652 if (QWindow *w = QQuickItem::window())
653 return w->isActive();
654
655 return false;
656}
657
659{
660 if (QWindow *w = QQuickItem::window())
661 w->showNormal();
662}
663
665{
666 if (QWindow *w = QQuickItem::window())
667 w->showMinimized();
668}
669
671{
672 if (QWindow *w = QQuickItem::window())
673 w->showMaximized();
674}
675
677{
678 if (QWindow *w = QQuickItem::window())
679 return w->windowStates() & Qt::WindowMinimized;
680
681 return false;
682}
683
685{
686 if (QWindow *w = QQuickItem::window())
687 return w->windowStates() & Qt::WindowMaximized;
688
689 return false;
690}
691
692std::shared_ptr<Core::Window> View::window() const
693{
694 if (QWindow *w = QQuickItem::window()) {
695 auto windowqtquick = new QtQuick::Window(w);
696 return std::shared_ptr<Core::Window>(windowqtquick);
697 }
698
699 return {};
700}
701
702std::shared_ptr<Core::View> View::childViewAt(QPoint p) const
703{
704 auto child = QQuickItem::childAt(p.x(), p.y());
705 return child ? asQQuickWrapper(child) : nullptr;
706}
707
708/*static*/
709std::shared_ptr<Core::View> View::parentViewFor(const QQuickItem *item)
710{
711 auto p = item->parentItem();
712 if (QQuickWindow *window = item->window()) {
713 if (p == window->contentItem()) {
714 // For our purposes, the root view is the one directly below QQuickWindow::contentItem
715 return nullptr;
716 }
717 }
718
719 return p ? asQQuickWrapper(p) : nullptr;
720}
721
722/* static */
723std::shared_ptr<Core::View> View::asQQuickWrapper(QQuickItem *item)
724{
725 return ViewWrapper::create(item);
726}
727
728std::shared_ptr<Core::View> View::parentView() const
729{
730 return parentViewFor(this);
731}
732
733std::shared_ptr<Core::View> View::asWrapper()
734{
735 return ViewWrapper::create(this);
736}
737
739{
740 QQuickItem::grabMouse();
741}
742
744{
745 QQuickItem::ungrabMouse();
746}
747
749{
750 // Not needed for QtQuick
751}
752
754{
755 QQuickItem::setFocus(true, reason);
756 forceActiveFocus(reason);
757}
758
759bool View::hasFocus() const
760{
761 return QQuickItem::hasActiveFocus();
762}
763
765{
766 return m_focusPolicy;
767}
768
770{
771 m_focusPolicy = policy;
772}
773
775{
776 return QQuickItem::objectName();
777}
778
780{
781 if (minSize() != sz) {
782 setProperty("kddockwidgets_min_size", sz);
784 Core::View::d->layoutInvalidated.emit();
785 }
786}
787
788void View::render(QPainter *painter)
789{
790 if (QQuickWindow *w = QQuickItem::window()) {
791 const QImage image = w->grabWindow();
792
793 const QPoint pos = mapToScene({ 0, 0 }).toPoint();
794 const QRect sourceRect { pos * image.devicePixelRatio(), painter->window().size() * image.devicePixelRatio() };
795 painter->drawImage(painter->window(), image, sourceRect);
796 }
797}
798
800{
801 QQuickItem::setCursor(shape);
802}
803
804void View::setMouseTracking(bool enable)
805{
806 m_mouseTrackingEnabled = enable;
807}
808
810{
812 const auto childItems = QQuickItem::childItems();
813 result.reserve(childItems.size());
814 for (QQuickItem *child : childItems) {
815 result << asQQuickWrapper(child);
816 }
817
818 return result;
819}
820
822{
823 if (QWindow *window = QQuickItem::window()) {
824 m_oldWindowState = window->windowState();
825 }
826}
827
828namespace KDDockWidgets {
829inline QString cleanQRCFilename(const QString &filename)
830{
831 // QFile doesn't understand qrc:/ only :/
832
833 if (filename.startsWith(QStringLiteral("qrc:/")))
834 return filename.right(filename.size() - 3);
835
836 return filename;
837}
838}
839
840QQuickItem *View::createItem(const QString &filename, QQuickItem *parent, QQmlContext *ctx)
841{
842 auto p = parent;
843 QQmlEngine *engine = nullptr;
844 while (p && !engine) {
845 engine = qmlEngine(p);
846 p = p->parentItem();
847 }
848
849 if (!engine)
851
852 if (!engine) {
853 qWarning() << Q_FUNC_INFO << "No engine found";
854 return nullptr;
855 }
856
857 if (!QFile::exists(cleanQRCFilename(filename))) {
858 qWarning() << Q_FUNC_INFO << "File not found" << filename;
859 return nullptr;
860 }
861
862 QQmlComponent component(engine, filename);
863 auto qquickitem = qobject_cast<QQuickItem *>(component.create(ctx));
864 if (!qquickitem) {
865 qWarning() << Q_FUNC_INFO << component.errorString();
866 return nullptr;
867 }
868
869 qquickitem->setParentItem(parent);
870 qquickitem->QObject::setParent(parent);
871
872 return qquickitem;
873}
874
876{
877 QQuickItem::setZ(z);
878}
879
880QQuickItem *View::visualItem() const
881{
882 qWarning() << Q_FUNC_INFO
883 << "Base class called, please implement in your derived class if needed";
884 return nullptr;
885}
886
887QQmlContext *QtQuick::qmlContextFor(QQuickItem *item)
888{
889 while (item) {
890 if (auto ctx = qmlContext(item))
891 return ctx;
892 item = item->parentItem();
893 }
894
895 return nullptr;
896}
897
898#include "View.moc"
virtual bool is(ViewType) const
Returns whether the view is of the specified type Virtual so it can be overridden by ViewWrapper....
virtual void move(int x, int y)=0
void QQUICKITEMgeometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override
Qt::FocusPolicy focusPolicy() const override
bool isExplicitlyHidden() const override
Qt::WindowFlags flags() const override
std::shared_ptr< Core::View > rootView() const override
Returns the top-level gui element which this view is inside It's the root view of the window.
static QQuickItem * createItem(QQmlEngine *engine, const QString &filename, QQmlContext *context=nullptr)
Convenience to create a QQuickItem.
bool isRootView() const override final
bool hasAttribute(Qt::WidgetAttribute attr) const override
void itemChange(QQuickItem::ItemChange, const QQuickItem::ItemChangeData &) override
bool isActiveWindow() const override
Q_INVOKABLE void showMaximized() override
Q_INVOKABLE void showMinimized() override
void render(QPainter *) override
bool eventFilter(QObject *watched, QEvent *ev) override
Q_INVOKABLE void showNormal() override
QPoint mapToGlobal(QPoint localPt) const override
void setMaximumSize(QSize sz) override
void setZOrder(int) override
Sets the z order Not supported on all platforms.
void setParent(Core::View *parent) override
void onWindowStateChangeEvent(QWindowStateChangeEvent *)
std::shared_ptr< Core::View > childViewAt(QPoint p) const override
void setMinimumSize(QSize sz) override
void setWindowIcon(const QIcon &icon) override
void setMouseTracking(bool enable) override
void move(int x, int y) override
virtual QQuickItem * visualItem() const
QPoint mapTo(Core::View *parent, QPoint pos) const override
QPoint mapFromGlobal(QPoint globalPt) const override
QRect normalGeometry() const override
void setFocusPolicy(Qt::FocusPolicy) override
static std::shared_ptr< Core::View > asQQuickWrapper(QQuickItem *item)
QString viewName() const override
void setFlag(Qt::WindowType f, bool on=true) override
Q_INVOKABLE void redirectMouseEvents(QQuickItem *from)
QVector< std::shared_ptr< Core::View > > childViews() const override
@Returns a list of child views
std::shared_ptr< Core::View > parentView() const override
Returns the gui element's parent. Like QWidget::parentWidget()
QSize maxSizeHint() const override
void enableAttribute(Qt::WidgetAttribute attr, bool enable=true) override
static void makeItemFillParent(QQuickItem *item)
This is equivalent to "anchors.fill: parent but in C++.
void setCursor(Qt::CursorShape shape) override
void setFocus(Qt::FocusReason reason) override
void setSize(int w, int h) override final
std::shared_ptr< Core::Window > window() const override
Returns the window this view is inside For the Qt frontend, this wraps a QWindow. Like QWidget::windo...
void setWindowTitle(const QString &title) override
View(Core::Controller *controller, Core::ViewType type, QQuickItem *parent=nullptr, Qt::WindowFlags windowFlags={})
void setVisible(bool is) override
static std::shared_ptr< Core::View > parentViewFor(const QQuickItem *)
std::shared_ptr< Core::View > asWrapper() override
Returns this view, but as a wrapper.
void setWindowOpacity(double v) override
ViewType
Each View type also has a specific Controller associated with, except for ViewType::None.
Definition Controller.h:26
DOCKS_EXPORT QQmlContext * qmlContextFor(QQuickItem *)
QQuickItem * asQQuickItem(Core::View *view)
Class to abstract QAction, so code still works with QtQuick and Flutter.
QString cleanQRCFilename(const QString &filename)
bool isAccepted() const const
void ignore()
QEvent::Type type() const const
bool exists() const const
int remove(const Key &key)
qreal devicePixelRatio() const const
Q_OBJECTQ_OBJECT
void installEventFilter(QObject *filterObj)
QVariant property(const char *name) const const
void setParent(QObject *parent)
bool setProperty(const char *name, const QVariant &value)
void drawImage(const QRectF &target, const QImage &image, const QRectF &source, Qt::ImageConversionFlags flags)
QRect window() const const
int x() const const
int y() const const
bool isValid() const const
void setSize(const QSize &size)
QSize size() const const
QSizeF size() const const
QPointF topLeft() const const
QSize boundedTo(const QSize &otherSize) const const
QSize expandedTo(const QSize &otherSize) const const
bool isEmpty() const const
QString right(int n) const const
int size() const const
bool startsWith(const QString &s, Qt::CaseSensitivity cs) const const
CursorShape
FocusPolicy
FocusReason
WA_Moved
WindowMinimized
typedef WindowFlags
static bool flagsAreTopLevelFlags(Qt::WindowFlags flags)
static QQuickItem * actualParentItem(QQuickItem *candidateParentItem, Qt::WindowFlags flags)
QVariant fromValue(const T &value)
bool isValid() const const
bool toBool() const const
T value() const const
void reserve(int size)

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDDockWidgets
Advanced Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets/
Generated by doxygen 1.9.8