forked from qt-creator/qt-creator
Lua: Add getNativeShortcut function for platform-specific key representations
Change-Id: I190b00c824234ac9d0a2ceb28e1d4f402f0a27bb Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -93,6 +93,10 @@ void setupUtilsModule()
|
||||
|
||||
utils.set_function("createUuid", []() { return QUuid::createUuid().toString(); });
|
||||
|
||||
utils.set_function("getNativeShortcut", [](QString shortcut) {
|
||||
return QKeySequence::fromString(shortcut).toString(QKeySequence::NativeText);
|
||||
});
|
||||
|
||||
sol::function wrap = async["wrap"].get<sol::function>();
|
||||
|
||||
utils["waitms"] = wrap(utils["waitms_cb"]);
|
||||
|
@@ -18,6 +18,11 @@ function utils.waitms_cb(ms, callback) end
|
||||
---@return QString Arbitrary UUID string.
|
||||
function utils.createUuid() end
|
||||
|
||||
---Converts a given shortcut string into its native representation for the current platform.
|
||||
---@param shortcut string The shortcut string (e.g., "Ctrl+Shift+A").
|
||||
---@return QString The native representation of the shortcut.
|
||||
function utils.getNativeShortcut(shortcut) end
|
||||
|
||||
---@class Id
|
||||
utils.Id = {}
|
||||
|
||||
|
Reference in New Issue
Block a user