Switched script source code view to a QScintilla based view.
This commit is contained in:
+1
-1
@@ -9,7 +9,7 @@ QT += core gui
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets serialport printsupport qml
|
||||
CONFIG(release, debug|release):DEFINES += QT_NO_DEBUG_OUTPUT
|
||||
|
||||
CONFIG += c++11
|
||||
CONFIG += c++11 qscintilla2
|
||||
|
||||
TARGET = SavvyCAN
|
||||
TEMPLATE = app
|
||||
|
||||
+5
-2
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <QFile>
|
||||
#include <QFileDialog>
|
||||
#include <Qsci/qscilexerjavascript.h>
|
||||
|
||||
#include "mainwindow.h"
|
||||
|
||||
@@ -23,6 +24,8 @@ ScriptingWindow::ScriptingWindow(const QVector<CANFrame> *frames, QWidget *paren
|
||||
connect(ui->btnRevertScript, &QAbstractButton::pressed, this, &ScriptingWindow::revertScript);
|
||||
connect(ui->btnSaveScript, &QAbstractButton::pressed, this, &ScriptingWindow::saveScript);
|
||||
connect(MainWindow::getReference(), &MainWindow::framesUpdated, this, &ScriptingWindow::updatedFrames);
|
||||
|
||||
ui->txtScriptSource->setLexer(new QsciLexerJavaScript(ui->txtScriptSource));
|
||||
}
|
||||
|
||||
ScriptingWindow::~ScriptingWindow()
|
||||
@@ -181,7 +184,7 @@ void ScriptingWindow::saveScript()
|
||||
delete outFile;
|
||||
return;
|
||||
}
|
||||
outFile->write(ui->txtScriptSource->toPlainText().toUtf8());
|
||||
outFile->write(ui->txtScriptSource->text().toUtf8());
|
||||
outFile->close();
|
||||
delete outFile;
|
||||
}
|
||||
@@ -195,6 +198,6 @@ void ScriptingWindow::revertScript()
|
||||
|
||||
void ScriptingWindow::recompileScript()
|
||||
{
|
||||
currentScript->scriptText = ui->txtScriptSource->toPlainText();
|
||||
currentScript->scriptText = ui->txtScriptSource->text();
|
||||
currentScript->compileScript();
|
||||
}
|
||||
|
||||
+14
-4
@@ -53,7 +53,7 @@
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,5,0,0,1">
|
||||
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,10,0,0,4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
@@ -65,9 +65,12 @@
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="txtScriptSource">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
<widget class="QsciScintilla" name="txtScriptSource">
|
||||
<property name="toolTip">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="whatsThis">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
@@ -113,6 +116,13 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QsciScintilla</class>
|
||||
<extends>QFrame</extends>
|
||||
<header>Qsci/qsciscintilla.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
|
||||
Reference in New Issue
Block a user