Fixed some cases where nullptr were not correctly handled.
This commit is contained in:
parent
e66326472e
commit
aa50d3097e
3 changed files with 18 additions and 10 deletions
|
|
@ -27,7 +27,9 @@ QueryParamListController::QueryParamListController(QTableView *tv,
|
|||
, paramTableView(tv)
|
||||
, m_openDatabase(opendb)
|
||||
{
|
||||
m_typeDelegate.setTypeSelectionModel(opendb->typeSelectionModel());
|
||||
if (opendb) {
|
||||
m_typeDelegate.setTypeSelectionModel(opendb->typeSelectionModel());
|
||||
}
|
||||
|
||||
paramTableView->setModel(&m_paramList);
|
||||
paramTableView->setItemDelegateForColumn(1, &m_typeDelegate);
|
||||
|
|
@ -82,17 +84,20 @@ QueryTab::QueryTab(MainWindow *win, QWidget *parent) :
|
|||
font.setPointSize(10);
|
||||
ui->queryEdit->setFont(font);
|
||||
|
||||
OpenDatabase* open_database = m_win->getDatabase();
|
||||
auto cat = open_database->catalogue();
|
||||
|
||||
highlighter = new SqlSyntaxHighlighter(ui->queryEdit->document());
|
||||
highlighter->setTypes(cat->types());
|
||||
OpenDatabase* open_database = m_win->getDatabase();
|
||||
if (open_database) {
|
||||
auto cat = open_database->catalogue();
|
||||
highlighter->setTypes(cat->types());
|
||||
}
|
||||
|
||||
connect(ui->queryEdit, &QPlainTextEdit::textChanged, this, &QueryTab::queryTextChanged);
|
||||
|
||||
m_queryParamListController = new QueryParamListController(ui->paramTableView, open_database, this);
|
||||
connect(ui->addButton, &QPushButton::clicked, m_queryParamListController, &QueryParamListController::on_addParam);
|
||||
connect(ui->removeButton, &QPushButton::clicked, m_queryParamListController, &QueryParamListController::on_removeParam);
|
||||
connect(ui->addButton, &QPushButton::clicked, m_queryParamListController,
|
||||
&QueryParamListController::on_addParam);
|
||||
connect(ui->removeButton, &QPushButton::clicked, m_queryParamListController,
|
||||
&QueryParamListController::on_removeParam);
|
||||
}
|
||||
|
||||
QueryTab::~QueryTab()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue