[PyKDE] QCustomMenuItem examples?

John Marshall John.Marshall at ec.gc.ca
Wed Jun 4 15:28:01 BST 2003


On Tue, 2003-06-03 at 14:52, John Marshall wrote:
> Hi,
> 
> I am trying to use the QCustomMenuItem class under
> Python and am getting "Memory fault" as soon as I try
> to bring up the popup menu it is in.

While looking at the PyQt stuff I noticed that the
menu.cpp example was converted to menu.py BUT the
MyMenuItem class, which subclasses QCustomMenuItem,
was not used (commented out). When I tried to use
it (uncommented it and modified the code to actually
use for the bold and underline menu items), it did
not work.

My conclusion is that QCustomMenuItem is currently
not supported, although it is wrapped. Can someone
confirm this? Has anyone ever used the QCustomMenuItem
under PyQt?

Thanks,
John

> 
> My subclass really does nothing:
> -----
> #! /usr/bin/env python2.2
> #
> # NewMenuItem.py
> 
> from qt import *
> 
> class NewMenuItem(QCustomMenuItem):
> 
>     def __init__(self):
>         print "__init__"
>         apply(QCustomMenuItem.__init__, (self,))
> 
>     def paint(self, p, cg, act, enabled, x, y, w, h):
>         print "Painting..."
> 
>     def setFont(self, font):
>         print "setFont"
> 
>     def sizeHint(self):
>         print "sizeHint"
>         return QSize(0,0)
> 
>     def fullSpan(self):
>         print "fullSpan"
>         return 0
> 
>     def isSeparator(self):
>         print "isSeparator"
>         return 1
> -----
> 
> Does anyone see anything wrong with the code above or
> have any suggestions/examples regarding QCustomMenuItem?
> 
> Thanks,
> John
> 
> _______________________________________________
> PyKDE mailing list    PyKDE at mats.imk.fraunhofer.de
> http://mats.imk.fraunhofer.de/mailman/listinfo/pykde





More information about the PyQt mailing list