mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-26 07:49:48 -05:00
Manually make close tab buttons in macOS, because PySide2 is not showing the button on its own
This commit is contained in:
parent
b2f30e90b3
commit
7a0436a216
BIN
desktop/src/onionshare/resources/images/close_tab.png
Normal file
BIN
desktop/src/onionshare/resources/images/close_tab.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 688 B |
@ -156,6 +156,23 @@ class TabWidget(QtWidgets.QTabWidget):
|
||||
index = self.addTab(tab, strings._("gui_new_tab"))
|
||||
self.setCurrentIndex(index)
|
||||
|
||||
# In macOS, manually create a close button because tabs don't seem to have them otherwise
|
||||
if self.common.platform == "Darwin":
|
||||
|
||||
def close_tab():
|
||||
self.tabBar().tabCloseRequested.emit(self.indexOf(tab))
|
||||
|
||||
tab.close_button = QtWidgets.QPushButton()
|
||||
tab.close_button.setFlat(True)
|
||||
tab.close_button.setFixedWidth(40)
|
||||
tab.close_button.setIcon(
|
||||
QtGui.QIcon(GuiCommon.get_resource_path("images/close_tab.png"))
|
||||
)
|
||||
tab.close_button.clicked.connect(close_tab)
|
||||
self.tabBar().setTabButton(
|
||||
index, QtWidgets.QTabBar.RightSide, tab.close_button
|
||||
)
|
||||
|
||||
tab.init(mode_settings)
|
||||
# If it's persistent, set the persistent image in the tab
|
||||
self.change_persistent(tab.tab_id, tab.settings.get("persistent", "enabled"))
|
||||
|
Loading…
Reference in New Issue
Block a user