Switched script source code view to a QScintilla based view.

This commit is contained in:
Collin Kidder
2015-12-02 21:56:06 -05:00
parent 0d7490a423
commit cc0f1733b1
3 changed files with 20 additions and 7 deletions
+1 -1
View File
@@ -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
View File
@@ -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
View File
@@ -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>