core/window: expose coordinate mapping functions on QsWindow

This commit is contained in:
outfoxxed 2025-05-29 22:35:17 -07:00
parent 6d42d26c79
commit 4a0f6382b0
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
4 changed files with 215 additions and 2 deletions

View file

@ -5,6 +5,7 @@
#include <qevent.h>
#include <qnamespace.h>
#include <qobject.h>
#include <qpoint.h>
#include <qproperty.h>
#include <qqmllist.h>
#include <qqmlparserstatus.h>
@ -13,6 +14,8 @@
#include <qsurfaceformat.h>
#include <qtmetamacros.h>
#include <qtypes.h>
#include <qvariant.h>
#include <qvectornd.h>
#include <qwindow.h>
#include "../core/qmlscreen.hpp"
@ -67,6 +70,14 @@ public:
void operator=(ProxyWindowBase&) = delete;
void operator=(ProxyWindowBase&&) = delete;
Q_INVOKABLE [[nodiscard]] QPointF itemPosition(QQuickItem* item) const;
Q_INVOKABLE [[nodiscard]] QRectF itemRect(QQuickItem* item) const;
Q_INVOKABLE [[nodiscard]] QPointF mapFromItem(QQuickItem* item, QPointF point) const;
Q_INVOKABLE [[nodiscard]] QPointF mapFromItem(QQuickItem* item, qreal x, qreal y) const;
Q_INVOKABLE [[nodiscard]] QRectF mapFromItem(QQuickItem* item, QRectF rect) const;
Q_INVOKABLE [[nodiscard]] QRectF
mapFromItem(QQuickItem* item, qreal x, qreal y, qreal width, qreal height) const;
void onReload(QObject* oldInstance) override;
void ensureQWindow();
void createWindow();
@ -201,6 +212,7 @@ public:
explicit ProxyWindowAttached(QQuickItem* parent);
[[nodiscard]] QObject* window() const override;
[[nodiscard]] ProxyWindowBase* proxyWindow() const override;
[[nodiscard]] QQuickItem* contentItem() const override;
protected:
@ -208,6 +220,7 @@ protected:
private:
ProxyWindowBase* mWindow = nullptr;
WindowInterface* mWindowInterface = nullptr;
void setWindow(ProxyWindowBase* window);
};