New syntax highlighter not complete.
- Supports comments - more efficient as it scans the text block instead of repeatedly searching throught the whole block - type matching based on catalog (but need to add aliases manually) - added many keywords todo: - heap corruption bug - symbol stops at special char like parenthese or operator or something similar.
This commit is contained in:
parent
4364f427bf
commit
37e8882a3c
11 changed files with 311 additions and 72 deletions
10
querytab.cpp
10
querytab.cpp
|
|
@ -1,7 +1,7 @@
|
|||
#include "querytab.h"
|
||||
#include "ui_querytab.h"
|
||||
|
||||
#include "sqlhighlighter.h"
|
||||
#include "SqlSyntaxHighlighter.h"
|
||||
|
||||
#include <QStandardPaths>
|
||||
#include <QFileDialog>
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
#include "MainWindow.h"
|
||||
#include "OpenDatabase.h"
|
||||
#include "pgtypecontainer.h"
|
||||
#include "pgsqldatabasecatalogue.h"
|
||||
#include "util.h"
|
||||
|
||||
QueryTab::QueryTab(MainWindow *win, QWidget *parent) :
|
||||
|
|
@ -40,10 +41,13 @@ QueryTab::QueryTab(MainWindow *win, QWidget *parent) :
|
|||
font.setFixedPitch(true);
|
||||
font.setPointSize(10);
|
||||
ui->queryEdit->setFont(font);
|
||||
highlighter.reset(new SqlHighlighter(ui->queryEdit->document()));
|
||||
highlighter = new SqlSyntaxHighlighter(ui->queryEdit->document());
|
||||
|
||||
OpenDatabase* open_database = m_win->getDatabase();
|
||||
m_typeDelegate.setTypeSelectionModel(open_database->getTypeSelectionModel());
|
||||
m_typeDelegate.setTypeSelectionModel(open_database->typeSelectionModel());
|
||||
|
||||
auto cat = open_database->catalogue();
|
||||
highlighter->setTypes(cat->types());
|
||||
|
||||
ui->paramTableView->setModel(&m_paramList);
|
||||
ui->paramTableView->setItemDelegateForColumn(1, &m_typeDelegate);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue