Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[dbmanager] remove button text if toolbar is vertical
  • Loading branch information
nirvn committed Jul 2, 2018
1 parent 3c63219 commit fd4888b
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions python/plugins/db_manager/db_manager.py
Expand Up @@ -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)
Expand Down Expand Up @@ -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"))
Expand Down Expand Up @@ -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.