Fix build for Qt version < 5.6

This fixes 8a4e363483.
This commit is contained in:
Martin Kleusberg
2019-07-26 15:34:01 +02:00
parent b32351e7b6
commit 97d77d557b
3 changed files with 20 additions and 10 deletions

View File

@@ -267,13 +267,7 @@ void MainWindow::init()
popupTableMenu->addAction(ui->actionExportCsvPopup);
popupSchemaDockMenu = new QMenu(this);
actionPopupSchemaDockBrowseTable = popupSchemaDockMenu->addAction(QIcon(":icons/table"), tr("Browse Table"), [this]() {
sqlb::ObjectIdentifier obj(ui->treeSchemaDock->model()->data(ui->treeSchemaDock->currentIndex().sibling(ui->treeSchemaDock->currentIndex().row(), DbStructureModel::ColumnSchema), Qt::EditRole).toString().toStdString(),
ui->treeSchemaDock->model()->data(ui->treeSchemaDock->currentIndex().sibling(ui->treeSchemaDock->currentIndex().row(), DbStructureModel::ColumnName), Qt::EditRole).toString().toStdString());
QString tableToBrowse = QString::fromStdString(obj.toDisplayString());
switchToBrowseDataTab(tableToBrowse);
refresh(); // Required in case the Browse Data tab already was the active main tab
});
popupSchemaDockMenu->addAction(ui->actionPopupSchemaDockBrowseTable);
popupSchemaDockMenu->addSeparator();
popupSchemaDockMenu->addAction(ui->actionDropQualifiedCheck);
popupSchemaDockMenu->addAction(ui->actionEnquoteNamesCheck);
@@ -510,6 +504,15 @@ void MainWindow::init()
runSqlNewTab("PRAGMA optimize;", ui->actionOptimize->text());
});
// Action for switching the table via the Database Structure tab
connect(ui->actionPopupSchemaDockBrowseTable, &QAction::triggered, [this]() {
sqlb::ObjectIdentifier obj(ui->treeSchemaDock->model()->data(ui->treeSchemaDock->currentIndex().sibling(ui->treeSchemaDock->currentIndex().row(), DbStructureModel::ColumnSchema), Qt::EditRole).toString().toStdString(),
ui->treeSchemaDock->model()->data(ui->treeSchemaDock->currentIndex().sibling(ui->treeSchemaDock->currentIndex().row(), DbStructureModel::ColumnName), Qt::EditRole).toString().toStdString());
QString tableToBrowse = QString::fromStdString(obj.toDisplayString());
switchToBrowseDataTab(tableToBrowse);
refresh(); // Required in case the Browse Data tab already was the active main tab
});
// Set other window settings
setAcceptDrops(true);
setWindowTitle(QApplication::applicationName());
@@ -1863,7 +1866,7 @@ void MainWindow::createSchemaDockContextMenu(const QPoint &qPoint)
if(type == "table" || type == "view")
enable_browse_table = true;
}
actionPopupSchemaDockBrowseTable->setEnabled(enable_browse_table);
ui->actionPopupSchemaDockBrowseTable->setEnabled(enable_browse_table);
popupSchemaDockMenu->exec(ui->treeSchemaDock->mapToGlobal(qPoint));
}