PDA

View Full Version : QMenu Icon Scale in PyQt?



jkrienert
11th March 2015, 13:57
Several postings about setting the QMenu Icon size to be larger then the defaulted 16x16 have been reviewed:
http://www.qtcentre.org/threads/21187-QMenu-always-displays-icons-aty-16x16-px
http://www.qtcentre.org/threads/15742-How-to-change-Icon-size-in-QMenu
http://www.qtcentre.org/threads/4173-Why-does-QMenuBar-resize-icons

Yet I am unable to establish how exactly to implement what these postings have deemed successful in context of PyQt.
Currently my menu is created via the following code:

# build the CSV option Menu
self.CSVoptionMenu = QMenu( self.iface.mainWindow() )
for Option in CSVOptionList:
self.CSVoptionMenu.addAction(Option)
self.CSVoptionMenu.setLayoutDirection(QtCore.Qt.Le ftToRight)
self.CSVoptionMenu.setStyleSheet('QMenu::item {padding: 4px 6px 4px 6px;} QMenu::item:selected\
{color: white; background-color: QLinearGradient( x1: 0, y1: \
0, x2: 0, y2: 1, stop: 0 #49a4ff, stop: 1 #1e84ea);}')
self.CSVoptionMenu.setIcon(QIcon(":/plugins/graphicgroundwater/buttons/optionsCSVedit.png"))
self.CSVoptionMenu.setTitle("Edit Options")
self.CSVoptionMenu.triggered.connect(self.runOptio nCSVEditor)

I supposed it might be as simple as appending a string to the 'setStyleSheet()' command, but after several attempts with no success - I figured someone might have clearer insights on the issue.
-Appreciations