[PyKDE] QCustomMenuItem examples?

John Marshall John.Marshall at ec.gc.ca
Tue Jun 3 16:55:00 BST 2003


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.

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




More information about the PyQt mailing list