forked from qt-creator/qt-creator
Lua: Don't use sol::property with member variables
See also: https://github.com/ThePhD/sol2/issues/1682 Fixes: QTCREATORBUG-32694 Change-Id: I70b80fbd88ef39d36269e349d30f31c3201c4ec3 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <lie@spyro-soft.com>
This commit is contained in:
@@ -238,18 +238,26 @@ void setupTextEditorModule()
|
|||||||
"Position",
|
"Position",
|
||||||
sol::no_constructor,
|
sol::no_constructor,
|
||||||
"line",
|
"line",
|
||||||
sol::property(&Position::line, &Position::line),
|
sol::property(
|
||||||
|
[](const Position &pos) { return pos.line; },
|
||||||
|
[](Position &pos, int line) { pos.line = line; }),
|
||||||
"column",
|
"column",
|
||||||
sol::property(&Position::column, &Position::column));
|
sol::property(
|
||||||
|
[](const Position &pos) { return pos.column; },
|
||||||
|
[](Position &pos, int column) { pos.column = column; }));
|
||||||
|
|
||||||
// In range can't use begin/end as "end" is a reserved word for LUA scripts
|
// In range can't use begin/end as "end" is a reserved word for LUA scripts
|
||||||
result.new_usertype<Range>(
|
result.new_usertype<Range>(
|
||||||
"Range",
|
"Range",
|
||||||
sol::no_constructor,
|
sol::no_constructor,
|
||||||
"from",
|
"from",
|
||||||
sol::property(&Range::begin, &Range::begin),
|
sol::property(
|
||||||
|
[](const Range &range) { return range.begin; },
|
||||||
|
[](Range &range, const Position &begin) { range.begin = begin; }),
|
||||||
"to",
|
"to",
|
||||||
sol::property(&Range::end, &Range::end));
|
sol::property(
|
||||||
|
[](const Range &range) { return range.end; },
|
||||||
|
[](Range &range, const Position &end) { range.end = end; }));
|
||||||
|
|
||||||
auto textCursorType = result.new_usertype<QTextCursor>(
|
auto textCursorType = result.new_usertype<QTextCursor>(
|
||||||
"TextCursor",
|
"TextCursor",
|
||||||
|
Reference in New Issue
Block a user