@@ -56,6 +56,8 @@ def __init__(self, iface, parent=None):
56
56
self .restoreState (settings .value ("/DB_Manager/mainWindow/windowState" , QByteArray (), type = QByteArray ))
57
57
58
58
self .toolBar .setIconSize (self .iface .iconSize ())
59
+ self .toolBarOrientation ()
60
+ self .toolBar .orientationChanged .connect (self .toolBarOrientation )
59
61
self .tabs .currentChanged .connect (self .tabChanged )
60
62
self .tree .selectedItemChanged .connect (self .itemChanged )
61
63
self .tree .model ().dataChanged .connect (self .iface .reloadConnections )
@@ -356,6 +358,16 @@ def close_tab(self, index):
356
358
self .tabs .removeTab (index )
357
359
widget .deleteLater ()
358
360
361
+ def toolBarOrientation (self ):
362
+ button_style = Qt .ToolButtonIconOnly
363
+ if self .toolBar .orientation () == Qt .Horizontal :
364
+ button_style = Qt .ToolButtonTextBesideIcon
365
+
366
+ widget = self .toolBar .widgetForAction (self .actionImport )
367
+ widget .setToolButtonStyle (button_style )
368
+ widget = self .toolBar .widgetForAction (self .actionExport )
369
+ widget .setToolButtonStyle (button_style )
370
+
359
371
def setupUi (self ):
360
372
self .setWindowTitle (self .tr ("DB Manager" ))
361
373
self .setWindowIcon (QIcon (":/db_manager/icon" ))
@@ -466,8 +478,3 @@ def setupUi(self):
466
478
self .toolBar .addSeparator ()
467
479
self .toolBar .addAction (self .actionImport )
468
480
self .toolBar .addAction (self .actionExport )
469
-
470
- widget = self .toolBar .widgetForAction (self .actionImport )
471
- widget .setToolButtonStyle (Qt .ToolButtonTextBesideIcon )
472
- widget = self .toolBar .widgetForAction (self .actionExport )
473
- widget .setToolButtonStyle (Qt .ToolButtonTextBesideIcon )
0 commit comments