Sine Striker
2023-12-05 3cfe15a9c3db0993d8b8fef5d148625840e5a75c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "quickitemdelegate_p.h"
 
#include <QtQuick/QQuickItem>
#include <QtQuick/QQuickWindow>
 
namespace QWK {
 
    QuickItemDelegate::QuickItemDelegate() : WindowItemDelegate() {
    }
 
    QuickItemDelegate::~QuickItemDelegate() = default;
 
    QWindow *QuickItemDelegate::window(QObject *obj) const {
        return static_cast<QQuickItem *>(obj)->window();
    }
 
    bool QuickItemDelegate::isEnabled(QObject *obj) const {
        return static_cast<QQuickItem *>(obj)->isEnabled();
    }
 
    bool QuickItemDelegate::isVisible(QObject *obj) const {
        return static_cast<QQuickItem *>(obj)->isVisible();
    }
 
    QRect QuickItemDelegate::mapGeometryToScene(const QObject *obj) const {
        auto item = static_cast<const QQuickItem *>(obj);
        const QPointF originPoint = item->mapToScene(QPointF(0.0, 0.0));
#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0))
        const QSizeF size = item->size();
#else
        const QSizeF size = {item->width(), item->height()};
#endif
        return QRectF(originPoint, size).toRect();
    }
 
    QWindow *QuickItemDelegate::hostWindow(QObject *host) const {
        return static_cast<QQuickWindow *>(host);
    }
 
    bool QuickItemDelegate::isHostSizeFixed(QObject *host) const {
        return false;
    }
 
}