Move syntax highlighter objects to SqlTextEdit class

Any SqlTextEdit object has its SQL syntax highlighter anyway, so it
makes sense to move the syntax highlighter object inside the text edit
class instead of maintining somewhere else. This hopefully makes the
code a bit easier to maintain.
This commit is contained in:
Martin Kleusberg
2014-11-09 12:20:02 +01:00
parent 7cfd80621e
commit f257f9248e
6 changed files with 12 additions and 27 deletions

View File

@@ -26,9 +26,6 @@ SqlExecutionArea::SqlExecutionArea(QWidget* parent, DBBrowserDB* _db) :
logfont.setPointSize(PreferencesDialog::getSettingsValue("log", "fontsize").toInt());
ui->editErrors->setFont(logfont);
// Create syntax highlighter
highlighter = new SQLiteSyntaxHighlighter(ui->editEditor->document());
// Create model
model = new SqliteTableModel(this, db, PreferencesDialog::getSettingsValue("db", "prefetchsize").toInt());
ui->tableResult->setModel(model);
@@ -47,7 +44,7 @@ SqlExecutionArea::~SqlExecutionArea()
void SqlExecutionArea::setTableNames(const QStringList& tables)
{
highlighter->setTableNames(tables);
ui->editEditor->syntaxHighlighter()->setTableNames(tables);
}
QString SqlExecutionArea::getSql() const