forked from qt-creator/qt-creator
Lua: Add Utils.openExternalUrl
Change-Id: I149ecb416c6c8cab5fdb1420c0708b6ac62b2236 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
#include <utils/futuresynchronizer.h>
|
#include <utils/futuresynchronizer.h>
|
||||||
#include <utils/hostosinfo.h>
|
#include <utils/hostosinfo.h>
|
||||||
|
|
||||||
|
#include <QDesktopServices>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QUuid>
|
#include <QUuid>
|
||||||
|
|
||||||
@@ -184,6 +185,10 @@ void setupUtilsModule()
|
|||||||
"stop",
|
"stop",
|
||||||
[](QTimer *timer) { timer->stop(); });
|
[](QTimer *timer) { timer->stop(); });
|
||||||
|
|
||||||
|
utils["openExternalUrl"] = [](const QString &url) {
|
||||||
|
QDesktopServices::openUrl(QUrl::fromEncoded(url.toUtf8()));
|
||||||
|
};
|
||||||
|
|
||||||
return utils;
|
return utils;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@@ -122,4 +122,8 @@ function utils.Timer:start() end
|
|||||||
--- Stops the timer.
|
--- Stops the timer.
|
||||||
function utils.Timer:stop() end
|
function utils.Timer:stop() end
|
||||||
|
|
||||||
|
---Opens the given URL in the default browser.
|
||||||
|
---@param url string The URL to open.
|
||||||
|
function utils.openExternalUrl(url) end
|
||||||
|
|
||||||
return utils
|
return utils
|
||||||
|
Reference in New Issue
Block a user