feat(plugins): add setter to MessageElement words

This commit is contained in:
Rasmus Karlsson
2026-08-09 15:12:58 +02:00
parent ea0e913af4
commit 93e024388e
2 changed files with 31 additions and 4 deletions
+15 -4
View File
@@ -640,10 +640,21 @@ void createUserType(sol::table &c2)
return el.visit<const ImageElement, const CircularImageElement>(
&ImageElement::image, &CircularImageElement::image);
}),
"words", sol::property([](const ElementRef &el) {
return el.visit<const TextElement, const SingleLineTextElement>(
&TextElement::words, &SingleLineTextElement::words);
}),
"words",
sol::property(
[](const ElementRef &el) {
return el.visit<const TextElement, const SingleLineTextElement>(
&TextElement::words, &SingleLineTextElement::words);
},
[](const ElementRef &el, const QStringList &words) {
el.visit<TextElement, SingleLineTextElement>(
[&](auto &el) {
el.setWords(words);
},
[&](auto &el) {
el.setWords(words);
});
}),
"color", sol::property([](const ElementRef &el) {
return el.visit<const TextElement, const SingleLineTextElement>(
[](const TextElement &el) {
+16
View File
@@ -310,6 +310,14 @@ public:
return this->words_;
}
/// Set the words of this element.
///
/// Normally set during construction, but can be overridden in plugins.
void setWords(const QStringList &newWords)
{
this->words_ = newWords;
}
protected:
QStringList words_;
@@ -358,6 +366,14 @@ public:
return this->words_;
}
/// Set the words of this element.
///
/// Normally set during construction, but can be overridden in plugins.
void setWords(const QStringList &newWords)
{
this->words_ = newWords;
}
private:
MessageColor color_;
FontStyle style_;