Make new tab button login in the QTabWidget instead of QTabBar

This commit is contained in:
Micah Lee 2019-10-27 14:21:40 -07:00
parent 3ceab336f9
commit f83d88b29e
No known key found for this signature in database
GPG key ID: 403C2657CD994F73
4 changed files with 109 additions and 25 deletions

View file

@ -26,7 +26,7 @@ from .tor_connection_dialog import TorConnectionDialog
from .settings_dialog import SettingsDialog
from .widgets import Alert
from .update_checker import UpdateThread
from .tab import Tab
from .tab_widget import TabWidget
class MainWindow(QtWidgets.QMainWindow):
@ -96,25 +96,12 @@ class MainWindow(QtWidgets.QMainWindow):
self.status_bar.addPermanentWidget(self.status_bar.server_status_indicator)
# Tabs
self.tabs = QtWidgets.QTabWidget()
self.tabs.setStyleSheet(self.common.gui.css["tab_bar_new_tab"])
self.tabs.setMovable(True)
self.tabs.setTabsClosable(True)
self.tabs.setUsesScrollButtons(True)
# New tab button
new_tab_button = QtWidgets.QToolButton()
new_tab_button.setStyleSheet(self.common.gui.css["tab_bar_new_tab_button"])
new_tab_button.setText("+")
new_tab_button.setAutoRaise(True)
self.tabs.insertTab(0, QtWidgets.QWidget(), "")
self.tabs.tabBar().setTabButton(0, QtWidgets.QTabBar.RightSide, new_tab_button)
self.tabs.tabBar().setTabToolTip(0, strings._("gui_new_tab_tooltip"))
self.tabs = TabWidget(self.common, self.system_tray, self.status_bar)
# Start with a tab
new_tab = Tab(self.common, self.system_tray, self.status_bar, filenames)
self.tabs.insertTab(0, new_tab, strings._("gui_new_tab"))
self.tabs.setCurrentIndex(0)
# new_tab = Tab(self.common, self.system_tray, self.status_bar, filenames)
# self.tabs.insertTab(0, new_tab, strings._("gui_new_tab"))
# self.tabs.setCurrentIndex(0)
# Layout
layout = QtWidgets.QVBoxLayout()