[PyKDE] Icon with text in QMenuBar
mla-pykde at forrussia.org
Tue Jun 7 14:16:00 BST 2005
On Monday 06 June 2005 23:47, Hans-Peter Jansen wrote:
> Am Montag, 6. Juni 2005 20:37 schrieb Peter Clark:
> > I've been playing around with menus (I just discovered that it's
> > possible to embed widgets in a menu--neat!) and now I'm wondering
> > about icons. Is it possible to combine text in a menu bar with an
> > icon?
> > I tried playing around with menu.py from the PyKDE examples.
> > Here's the snippet I was playing with (lines 169-170):
> > self.menu = QMenuBar( self )
> > self.menu.insertItem( "&File", self.file )
> > I was able to substitute an icon for text with:
> > self.menu.insertItem( QPixmap ( p1_xpm ), self.file )
> > Where p1 is an xpm of a yellow folder (defined in the code). To place
> > an icon and text together, I tried this:
> > self.menu.insertItem( self.p1, "&File", self.file )
> > No errors, but likewise no icon next to "File". Any suggestions?
> Typically, this is the right moment to grok the concept of QActions..
Thanks for the hint, but I'm afraid that I'm still a little ways from
groking QAction. Reading The Fine Documentation, I understand fine how it
works for menu *items*. But the menu bar continues to thwart my every
attempt. It looks as though for an item to be in the menu bar, it must be a
QPopupMenu. Could you point me in a more specific direction?
More information about the PyQt