mirror of
https://github.com/Chatterino/chatterino2.git
synced 2026-08-24 10:04:53 -05:00
feat(plugins): add setter to MessageElement words
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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_;
|
||||
|
||||
Reference in New Issue
Block a user