Add helper classes to support strings containing variables

* VariableResolvingString will accept strings potentially containing
   variables as inputs and will automatically resolve any variables when
   converting to std::string
 * VariableTextEdit is a simple wrapper around ResizingPlainTextEdit to
   enable working with VariableResolvingString
This commit is contained in:
WarmUpTill
2022-11-30 20:00:05 +01:00
committed by WarmUpTill
parent 632ad5085f
commit 14f0194372
6 changed files with 161 additions and 3 deletions

View File

@@ -0,0 +1,18 @@
#include "variable-text-edit.hpp"
#include "switcher-data-structs.hpp"
VariableTextEdit::VariableTextEdit(QWidget *parent)
: ResizingPlainTextEdit(parent)
{
}
void VariableTextEdit::setPlainText(const QString &string)
{
QPlainTextEdit::setPlainText(string);
}
void VariableTextEdit::setPlainText(const VariableResolvingString &string)
{
QPlainTextEdit::setPlainText(
QString::fromStdString(string.UnresolvedValue()));
}