Commit 4e36c6a7 authored by L. E. Segovia's avatar L. E. Segovia

Insert new variables in a new line

CC @tymond
parent 72659b03
......@@ -121,7 +121,7 @@ void ExprControlCollection::addControlDialog() {
break;
#endif
}
emit insertString(s.toStdString());
emit insertString(s);
}
}
......
......@@ -85,7 +85,7 @@ Q_SIGNALS:
void linkColorOutput(QColor color);
/// Emitted to request that a new widget string should be added to the expression
/// i.e. after "Add new variable" was used
void insertString(const std::string &controlString);
void insertString(const QString &controlString);
public
Q_SLOTS:
/// Notification from outside that a linked color widget was changed
......
......@@ -141,7 +141,7 @@ void ExprEditor::setControlCollectionWidget(ExprControlCollection* widget) {
{
connect(controlRebuildTimer, SIGNAL(timeout()), SLOT(rebuildControls()));
connect(controls, SIGNAL(controlChanged(int)), SLOT(controlChanged(int)));
connect(controls, SIGNAL(insertString(const std::string&)), SLOT(insertStr(const std::string&)));
connect(controls, SIGNAL(insertString(const QString&)), SLOT(insertStr(const QString&)));
}
}
......@@ -187,9 +187,15 @@ void ExprEditor::setExpr(const QString& expression, const bool doApply) {
if (doApply) emit apply();
}
void ExprEditor::insertStr(const std::string& str) { exprTe->insertPlainText(QString::fromStdString(str)); }
void ExprEditor::insertStr(const QString& str)
{
exprTe->append(str);
}
void ExprEditor::appendStr(const std::string& str) { exprTe->append(QString::fromStdString(str)); }
void ExprEditor::appendStr(const QString& str)
{
exprTe->append(str);
}
void ExprEditor::addError(const int startPos, const int endPos, const QString& error) {
QString message = tr("(%1, %2): %3").arg(startPos).arg(endPos).arg(error);
......
......@@ -57,11 +57,11 @@ Q_SIGNALS:
// Sets the expression that is in the editor
void setExpr(const QString& expression, const bool apply = false);
// Append string
void appendStr(const std::string& str);
void appendStr(const QString& str);
public
Q_SLOTS:
// Insert string
void insertStr(const std::string& str);
void insertStr(const QString& str);
public:
// Adds an error and its associated position
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment