From 74a16912e11d79b3a7f943ef16360aa9062b3e55 Mon Sep 17 00:00:00 2001 From: Martin Kleusberg Date: Wed, 20 Nov 2019 21:17:16 +0100 Subject: [PATCH] Remove close buttons on tabs and add button for closing SQL tabs This gives us some more space in the tab bar and should reduce the risk of accidentally closing a tab. It looks prettier too. We could add an option for this in the Preferences dialog but in order to not add too many rarely used options, let's try it without an option first. See issue #1968. --- src/MainWindow.cpp | 10 ++++++++++ src/MainWindow.ui | 6 ------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/MainWindow.cpp b/src/MainWindow.cpp index 6b5689db..d0247059 100644 --- a/src/MainWindow.cpp +++ b/src/MainWindow.cpp @@ -333,6 +333,16 @@ void MainWindow::init() QShortcut* setTab4Shortcut = new QShortcut(QKeySequence("Alt+4"), this); connect(setTab4Shortcut, &QShortcut::activated, [this]() { ui->mainTab->setCurrentIndex(3); }); + // Add button to close Execute SQL tabs + QToolButton* buttonCloseSqlTab = new QToolButton(ui->tabSqlAreas); + buttonCloseSqlTab->setIcon(QIcon(":icons/close")); + buttonCloseSqlTab->setToolTip(tr("Close current SQL tab")); + buttonCloseSqlTab->setAutoRaise(true); + connect(buttonCloseSqlTab, &QToolButton::clicked, [this]() { + closeSqlTab(ui->tabSqlAreas->currentIndex()); + }); + ui->tabSqlAreas->setCornerWidget(buttonCloseSqlTab); + // If we're not compiling in SQLCipher, hide its FAQ link in the help menu #ifndef ENABLE_SQLCIPHER ui->actionSqlCipherFaq->setVisible(false); diff --git a/src/MainWindow.ui b/src/MainWindow.ui index 16dd868a..03b31430 100644 --- a/src/MainWindow.ui +++ b/src/MainWindow.ui @@ -39,9 +39,6 @@ 0 - - true - true @@ -727,9 +724,6 @@ You can drag SQL statements from an object row and drop them into other applicat -1 - - true - true