From c804a5e94518688934be693f266d26e7bbd159b2 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Mon, 14 Sep 2015 16:51:39 -1000 Subject: [PATCH] Add button to toggle toolbar text --- src/mcedit2/editorapp.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/mcedit2/editorapp.py b/src/mcedit2/editorapp.py index 7714700..ba3e2a6 100644 --- a/src/mcedit2/editorapp.py +++ b/src/mcedit2/editorapp.py @@ -119,6 +119,21 @@ class MCEditApp(QtGui.QApplication): log.info("Loaded main window.") + def toggleToolbarText(enable): + if enable: + style = Qt.ToolButtonTextUnderIcon + else: + style = Qt.ToolButtonIconOnly + self.mainWindow.toolsToolBar.setToolButtonStyle(style) + self.mainWindow.panelsToolBar.setToolButtonStyle(style) + + self.toggleToolbarTextAction = QtGui.QAction("Toolbar Text", self) + self.toggleToolbarTextAction.setCheckable(True) + self.toggleToolbarTextAction.setChecked(True) + + self.toggleToolbarTextAction.toggled.connect(toggleToolbarText) + self.toggleToolbarTextAction.__toggled = toggleToolbarText + # --- OpenGL --- setDefaultFormat() @@ -488,6 +503,8 @@ class MCEditApp(QtGui.QApplication): :type session: EditorSession """ self.mainWindow.panelsToolBar.clear() + self.mainWindow.panelsToolBar.addAction(self.toggleToolbarTextAction) + self.mainWindow.toolsToolBar.clear() self.removeSessionDockWidgets()