PyQt4 Toolbar Button Alignment
I have this code
Menu = self.menuBar()
EditMenu = Menu.addMenu("&File")
OptionMenu = Menu.addMenu("&Options")
HelpMenu = Menu.addMenu("&Help")
EditMenu.addActions((fileNewAction,faultAction,storeAction,localAction,scheduleAction))
OptionMenu.addAction(settingAction)
Toolbar = QtGui.QToolBar()
Toolbar.setIconSize(QtCore.QSize(50,50))
Toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon|QtCore.Qt.AlignLeading)
#<= Toolbuttonstyle
self.addToolBar(QtCore.Qt.LeftToolBarArea,Toolbar)
Toolbar.addActions((fileNewAction,faultAction,scheduleAction,storeAction,localAction,settingAction))
settings = QtCore.QSettings()
self.restoreGeometry(settings.value("Geometry").toByteArray())
which give me this
i used
Toolbar.setToolButtonStyle(QtCore.Qt.ToolButtonTextBesideIcon|QtCore.Qt.AlignLeading)
to display the text on the right side of the toolbar button and to align
all the toolbar button images to the left. But the texts are not appearing
on the right side.
If i remove the QtCore.Qt.AlignLeading,
I get unaligned (left side) buttons like this
(1) How do i get my toolbar button icons align to the left and display the
text on the right side at the same time?
Another question is
(2) How do i adjust the width of the raised button effect when i mouse
over on each button? I want the width of all the buttons to be the same.
The width seems to be different depending on how long the text is.
No comments:
Post a Comment