forked from qt-creator/qt-creator
Lua: Expose hasFocus within TextEditor binding
Change-Id: Id16b4f78ccd0229ee1976be377df97ada1594c04 Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
This commit is contained in:
@@ -381,6 +381,13 @@ void setupTextEditorModule()
|
|||||||
"insertText",
|
"insertText",
|
||||||
[](TextEditorPtr editor, const QString &text) {
|
[](TextEditorPtr editor, const QString &text) {
|
||||||
editor->editorWidget()->multiTextCursor().insertText(text);
|
editor->editorWidget()->multiTextCursor().insertText(text);
|
||||||
|
},
|
||||||
|
"hasFocus",
|
||||||
|
[](const TextEditorPtr &textEditor) {
|
||||||
|
QTC_ASSERT(
|
||||||
|
textEditor && textEditor->editorWidget(),
|
||||||
|
throw sol::error("TextEditor is not valid"));
|
||||||
|
return textEditor->editorWidget()->hasFocus();
|
||||||
});
|
});
|
||||||
|
|
||||||
result.new_usertype<TextSuggestion::Data>(
|
result.new_usertype<TextSuggestion::Data>(
|
||||||
|
@@ -150,6 +150,10 @@ function TextEditor:hasLockedSuggestion() end
|
|||||||
---@param text string The text to insert.
|
---@param text string The text to insert.
|
||||||
function TextEditor:insertText(text) end
|
function TextEditor:insertText(text) end
|
||||||
|
|
||||||
|
---Indicates if the editor widget has focus.
|
||||||
|
---@return boolean hasFocus True if the editor widget has focus, false otherwise.
|
||||||
|
function TextEditor:hasFocus() end
|
||||||
|
|
||||||
---Returns the current editor or nil.
|
---Returns the current editor or nil.
|
||||||
---@return TextEditor|nil editor The currently active editor or nil if there is none.
|
---@return TextEditor|nil editor The currently active editor or nil if there is none.
|
||||||
function textEditor.currentEditor() end
|
function textEditor.currentEditor() end
|
||||||
|
Reference in New Issue
Block a user