Lua: Expose QClipboard class in Qt package

Change-Id: I931bf619b1f4e94ae651d7c5eb7d21e79f3dfc93
Reviewed-by: <lie@spyro-soft.com>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Artur Twardy
2024-10-01 20:35:46 +02:00
parent 18a048b34d
commit 9f93e2261b
2 changed files with 18 additions and 0 deletions

View File

@@ -5,6 +5,8 @@
#include "utils.h"
#include <QApplication>
#include <QClipboard>
#include <QCompleter>
#include <QDir>
@@ -39,6 +41,16 @@ void setupQtModule()
});})
);
qt.new_usertype<QClipboard>(
"QClipboard",
sol::call_constructor,
&QApplication::clipboard,
"text",
sol::property([](QClipboard &self) { return self.text(); },
[](QClipboard &self, const QString &value) { self.setText(value); })
);
mirrorEnum(qt, QMetaEnum::fromType<QCompleter::CompletionMode>(), "QCompleterCompletionMode");
// clang-format off

View File

@@ -27,6 +27,12 @@ function qt.QCompleter.create(params) end
---@param function The function to be called when user choice is selected from popup.
function qt.QCompleter.onActivated(function) end
---@class QClipboard
--- A Lua wrapper for the Qt `QClipboard` class.
qt.QClipboard() Creates QClipboard object, which is a singleton instance of the system clipboard.
---@field text The text content of the clipboard. Gets or sets the text content of the clipboard.
---@enum TextElideMode
qt.TextElideMode = {
ElideLeft = 0,