Added listing of triggers for selected table (not completely finished).
Used slightly different approach. This tab is fully build in source code using subclasses to adjust behaviour of widgets for reuse in the other tabs. Uses custom proxy model for filtering triggers for correct table and supporting out of the box sorting by QTableView. SqlCodePreview: QPlainTextEditor which sql highlighter and in readonly mode but allows copy.
This commit is contained in:
parent
446923ebaf
commit
2a75e86102
23 changed files with 697 additions and 67 deletions
27
pglab/SqlCodePreview.cpp
Normal file
27
pglab/SqlCodePreview.cpp
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include "SqlCodePreview.h"
|
||||
#include "UserConfiguration.h"
|
||||
#include "SqlSyntaxHighlighter.h"
|
||||
|
||||
SqlCodePreview::SqlCodePreview(QWidget *parent)
|
||||
: QPlainTextEdit(parent)
|
||||
{
|
||||
auto&& config = UserConfiguration::instance();
|
||||
setFont(config->codeFont());
|
||||
setTextInteractionFlags(Qt::TextSelectableByMouse | Qt::TextSelectableByKeyboard);
|
||||
m_highlighter = new SqlSyntaxHighlighter(document());
|
||||
}
|
||||
|
||||
|
||||
void SqlCodePreview::setCatalog(std::shared_ptr<const PgDatabaseCatalog> catalog)
|
||||
{
|
||||
connect(catalog.get(), &PgDatabaseCatalog::refreshed, this, &SqlCodePreview::catalogRefresh);
|
||||
catalogRefresh(catalog.get(), PgDatabaseCatalog::All);
|
||||
}
|
||||
|
||||
|
||||
void SqlCodePreview::catalogRefresh(const PgDatabaseCatalog *catalog, PgDatabaseCatalog::RefreshFlags flags)
|
||||
{
|
||||
if (flags & PgDatabaseCatalog::Types) {
|
||||
m_highlighter->setTypes(*catalog->types());
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue