From 6b60869385137ec71e7bb91db76016f45eb711e1 Mon Sep 17 00:00:00 2001 From: Yuhang Zhao <zhaoyuhang@rankyee.com> Date: 周三, 06 12月 2023 10:09:42 +0800 Subject: [PATCH] port more implementation --- src/quick/quickitemdelegate.cpp | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/quick/quickitemdelegate.cpp b/src/quick/quickitemdelegate.cpp index 1b4426a..aa85204 100644 --- a/src/quick/quickitemdelegate.cpp +++ b/src/quick/quickitemdelegate.cpp @@ -5,11 +5,10 @@ namespace QWK { - QuickItemDelegate::QuickItemDelegate() { + QuickItemDelegate::QuickItemDelegate() : WindowItemDelegate() { } - QuickItemDelegate::~QuickItemDelegate() { - } + QuickItemDelegate::~QuickItemDelegate() = default; QWindow *QuickItemDelegate::window(QObject *obj) const { return static_cast<QQuickItem *>(obj)->window(); @@ -23,4 +22,23 @@ 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; + } + } \ No newline at end of file -- Gitblit v1.9.1