Skip to content
Permalink
Browse files

[dbmanager] remove button text if toolbar is vertical

  • Loading branch information
nirvn committed Jul 2, 2018
1 parent 3c63219 commit fd4888bdeb1d6dbc9f02e23dde1e334bd9714a20
Showing with 12 additions and 5 deletions.
  1. +12 −5 python/plugins/db_manager/db_manager.py
@@ -56,6 +56,8 @@ def __init__(self, iface, parent=None):
self.restoreState(settings.value("/DB_Manager/mainWindow/windowState", QByteArray(), type=QByteArray))

self.toolBar.setIconSize(self.iface.iconSize())
self.toolBarOrientation()
self.toolBar.orientationChanged.connect(self.toolBarOrientation)
self.tabs.currentChanged.connect(self.tabChanged)
self.tree.selectedItemChanged.connect(self.itemChanged)
self.tree.model().dataChanged.connect(self.iface.reloadConnections)
@@ -356,6 +358,16 @@ def close_tab(self, index):
self.tabs.removeTab(index)
widget.deleteLater()

def toolBarOrientation(self):
button_style = Qt.ToolButtonIconOnly
if self.toolBar.orientation() == Qt.Horizontal:
button_style = Qt.ToolButtonTextBesideIcon

widget = self.toolBar.widgetForAction(self.actionImport)
widget.setToolButtonStyle(button_style)
widget = self.toolBar.widgetForAction(self.actionExport)
widget.setToolButtonStyle(button_style)

def setupUi(self):
self.setWindowTitle(self.tr("DB Manager"))
self.setWindowIcon(QIcon(":/db_manager/icon"))
@@ -466,8 +478,3 @@ def setupUi(self):
self.toolBar.addSeparator()
self.toolBar.addAction(self.actionImport)
self.toolBar.addAction(self.actionExport)

widget = self.toolBar.widgetForAction(self.actionImport)
widget.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
widget = self.toolBar.widgetForAction(self.actionExport)
widget.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)

0 comments on commit fd4888b

Please sign in to comment.
You can’t perform that action at this time.