From 97d77d557bb936579fdac0282edf5d290789f1f1 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Fri, 26 Jul 2019 15:34:01 +0200 Subject: [PATCH] Fix build for Qt version < 5.6 This fixes 8a4e363483c685b898b6f696d6f0239a9ba10967. --- src/MainWindow.cpp | 19 +++++++++++-------- src/MainWindow.h | 2 -- src/MainWindow.ui | 9 +++++++++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 84fd00ea..8b40053c 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -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)); } diff --git a/src/MainWindow.h b/src/MainWindow.h index ce1ef357..d4a0bbc8 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -134,8 +134,6 @@ private: QMenu* popupSaveFilterAsMenu; QMenu* popupBrowseDataHeaderMenu; - QAction* actionPopupSchemaDockBrowseTable; - QLabel* statusEncodingLabel; QLabel* statusEncryptionLabel; QLabel* statusReadOnlyLabel; diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 7d969440..07bc92c3 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -2579,6 +2579,15 @@ You can drag SQL statements from the Schema column and drop them into the SQL ed Ctrl+Shift+S + + + + :/icons/table:/icons/table + + + Browse Table + +