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.
This commit is contained in:
Martin Kleusberg
2019-11-20 21:17:16 +01:00
parent fc5f9d25cf
commit 74a16912e1
2 changed files with 10 additions and 6 deletions

View File

@@ -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);

View File

@@ -39,9 +39,6 @@
<property name="currentIndex">
<number>0</number>
</property>
<property name="tabsClosable">
<bool>true</bool>
</property>
<property name="movable">
<bool>true</bool>
</property>
@@ -727,9 +724,6 @@ You can drag SQL statements from an object row and drop them into other applicat
<property name="currentIndex">
<number>-1</number>
</property>
<property name="tabsClosable">
<bool>true</bool>
</property>
<property name="movable">
<bool>true</bool>
</property>