diff --git a/src/lib/preferences/preferences.cpp b/src/lib/preferences/preferences.cpp
index 5b49655d2..15b9e2e60 100644
--- a/src/lib/preferences/preferences.cpp
+++ b/src/lib/preferences/preferences.cpp
@@ -239,6 +239,7 @@ Preferences::Preferences(BrowserWindow* window, QWidget* parent)
ui->closedInsteadOpened->setChecked(settings.value("closedInsteadOpenedTabs", false).toBool());
ui->showTabPreviews->setChecked(settings.value("showTabPreviews", false).toBool());
ui->animatedTabPreviews->setChecked(settings.value("tabPreviewAnimationsEnabled", true).toBool());
+ ui->showCloseOnInactive->setCurrentIndex(settings.value("showCloseOnInactiveTabs", 0).toInt());
settings.endGroup();
connect(ui->showTabPreviews, SIGNAL(toggled(bool)), this, SLOT(showTabPreviewsChanged(bool)));
@@ -914,6 +915,7 @@ void Preferences::saveSettings()
settings.setValue("closedInsteadOpenedTabs", ui->closedInsteadOpened->isChecked());
settings.setValue("showTabPreviews", ui->showTabPreviews->isChecked());
settings.setValue("tabPreviewAnimationsEnabled", ui->animatedTabPreviews->isChecked());
+ settings.setValue("showCloseOnInactiveTabs", ui->showCloseOnInactive->currentIndex());
settings.endGroup();
//DOWNLOADS
diff --git a/src/lib/preferences/preferences.ui b/src/lib/preferences/preferences.ui
index 319c42b8c..16e808118 100644
--- a/src/lib/preferences/preferences.ui
+++ b/src/lib/preferences/preferences.ui
@@ -763,6 +763,52 @@
+ -
+
+
-
+
+
+ Show close buttons on inactive tabs:
+
+
+
+ -
+
+
-
+
+ Automatic
+
+
+ -
+
+ Always
+
+
+ -
+
+ Never
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+ QSizePolicy::Expanding
+
+
+
+ 40
+ 20
+
+
+
+
+
+
-
diff --git a/src/lib/webview/tabbar.cpp b/src/lib/webview/tabbar.cpp
index 344a4b3fb..476c64d54 100644
--- a/src/lib/webview/tabbar.cpp
+++ b/src/lib/webview/tabbar.cpp
@@ -47,6 +47,7 @@ TabBar::TabBar(BrowserWindow* window, TabWidget* tabWidget)
, m_tabPreview(new TabPreview(window, window))
, m_showTabPreviews(false)
, m_hideTabBarWithOneTab(false)
+ , m_showCloseOnInactive(0)
, m_clickedTab(0)
, m_normalTabWidth(0)
, m_activeTabWidth(0)
@@ -56,7 +57,7 @@ TabBar::TabBar(BrowserWindow* window, TabWidget* tabWidget)
setElideMode(Qt::ElideRight);
setDocumentMode(true);
setFocusPolicy(Qt::NoFocus);
- setTabsClosable(true);
+ setTabsClosable(false);
setMouseTracking(true);
setMovable(true);
@@ -90,6 +91,7 @@ void TabBar::loadSettings()
m_tabPreview->setAnimationsEnabled(settings.value("tabPreviewAnimationsEnabled", true).toBool());
m_showTabPreviews = settings.value("showTabPreviews", false).toBool();
bool activateLastTab = settings.value("ActivateLastTabWhenClosingActual", false).toBool();
+ m_showCloseOnInactive = settings.value("showCloseOnInactiveTabs", 0).toInt(0);
settings.endGroup();
setSelectionBehaviorOnRemove(activateLastTab ? QTabBar::SelectPreviousTab : QTabBar::SelectRightTab);
@@ -269,11 +271,16 @@ QSize TabBar::tabSizeHint(int index, bool fast) const
bool tryAdjusting = availableWidth >= MINIMUM_TAB_WIDTH * normalTabsCount;
- if (tabsClosable() && availableWidth < (MINIMUM_TAB_WIDTH + 25) * normalTabsCount) {
+ if (m_showCloseOnInactive != 1 && tabsClosable() && availableWidth < (MINIMUM_TAB_WIDTH + 25) * normalTabsCount) {
// Hiding close buttons to save some space
tabBar->setTabsClosable(false);
tabBar->showCloseButton(currentIndex());
}
+ if (m_showCloseOnInactive == 1) {
+ // Hiding close buttons to save some space
+ tabBar->setTabsClosable(true);
+ tabBar->showCloseButton(currentIndex());
+ }
if (tryAdjusting) {
m_normalTabWidth = maxWidthForTab;
@@ -296,7 +303,7 @@ QSize TabBar::tabSizeHint(int index, bool fast) const
}
// Restore close buttons according to preferences
- if (!tabsClosable() && availableWidth >= (MINIMUM_TAB_WIDTH + 25) * normalTabsCount) {
+ if (m_showCloseOnInactive != 2 && !tabsClosable() && availableWidth >= (MINIMUM_TAB_WIDTH + 25) * normalTabsCount) {
tabBar->setTabsClosable(true);
// Hide close buttons on pinned tabs
diff --git a/src/lib/webview/tabbar.h b/src/lib/webview/tabbar.h
index 2b5193a93..341af0cf0 100644
--- a/src/lib/webview/tabbar.h
+++ b/src/lib/webview/tabbar.h
@@ -112,7 +112,8 @@ private:
bool m_showTabPreviews;
bool m_hideTabBarWithOneTab;
-
+
+ int m_showCloseOnInactive;
int m_clickedTab;
mutable int m_normalTabWidth;