Lua: Expose QCursor::pos() within Qt bindings

Change-Id: I59c4a08d4331012441b7a9a76895db6310aab583
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
Lukasz Papierkowski
2024-12-02 16:26:08 +01:00
committed by lie
parent 6614e3c14d
commit 485d490422
2 changed files with 14 additions and 0 deletions

View File

@@ -9,6 +9,7 @@
#include <QApplication>
#include <QClipboard>
#include <QCursor>
#include <QCompleter>
#include <QDir>
#include <QFileDevice>
@@ -54,6 +55,12 @@ void setupQtModule()
qt["clipboard"] = &QApplication::clipboard;
qt.new_usertype<QCursor>(
"QCursor",
sol::no_constructor,
"pos", sol::resolve<QPoint()>(&QCursor::pos)
);
qt.new_usertype<QFontMetrics>(
"QFontMetrics",
"create",

View File

@@ -34,6 +34,13 @@ qt.QClipboard = {}
---@return QClipboard globalClipboard The global clipboard object.
function qt.clipboard() end
--@class QCursor A Lua wrapper for the Qt `QCursor` class.
qt.QCursor = {}
---Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.
---@return QPoint position The position of the cursor.
function qt.QCursor.pos() end
---@class QFontMetrics A Lua wrapper for the Qt `QFontMetrics` class.
qt.QFontMetrics = {}