Skip to content

Commit

Permalink
make sure textarea runs checkSyntax whenever amount of columns changes
Browse files Browse the repository at this point in the history
  • Loading branch information
JorisGoosen committed Dec 12, 2023
1 parent a5250c3 commit 023ab81
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
3 changes: 0 additions & 3 deletions QMLComponents/components/JASP/Controls/TextArea.qml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@ TextAreaBase
property bool useTabAsSpaces : true
property var nextTabItem

signal applyRequest()
signal editingFinished()

Component.onCompleted: control.editingFinished.connect(editingFinished)

function userEnteredInput() {
Expand Down
7 changes: 6 additions & 1 deletion QMLComponents/controls/textareabase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ void TextAreaBase::setUp()
_separators.push_back(separator.toString());
}

connect(this, SIGNAL(applyRequest()), this, SLOT(checkSyntaxHandler()));
//If "rowCount" changes on VariableInfo it means a column has been added or removed, this means the model should be reencoded and checked
//Fixes https://github.com/jasp-stats/jasp-issues/issues/2462
connect(VariableInfo::info(), &VariableInfo::rowCountChanged, this, &TextAreaBase::checkSyntaxHandler);

//Also do it on request of course ;)
connect(this, &TextAreaBase::applyRequest, this, &TextAreaBase::checkSyntaxHandler);
}

void TextAreaBase::rScriptDoneHandler(const QString & result)
Expand Down
2 changes: 2 additions & 0 deletions QMLComponents/controls/textareabase.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ public slots:
signals:
void textTypeChanged();
void hasScriptErrorChanged();
void applyRequest();
void editingFinished();

protected slots:
void termsChangedHandler() override;
Expand Down

0 comments on commit 023ab81

Please sign in to comment.