[PyKDE] custom style problem

Vicent Mas uvep at ono.com
Thu Jul 8 14:46:01 BST 2004


Hi,
I'm trying to create a simple custom style (newbie with styles) but I cannot 
to make it work, so I need some help. This is what I've done.

customstyle script
-------------------------
from qt import *

class CustomStyle(QWindowsStyle):
	def __init__(self) :
		apply(QWindowsStyle.__init__m (self,))

	def drawControl(self, celem, painter, widget, rect, colorGroup, flags, opt) :
		print "I'm here"
		if celem ==QStyle.CE_PushButtonLabel :
			# do something
		else :
			QWindowsStyle(self, celem, painter, widget, rect, colorGroup, flags, opt)

main script:
----------------
from customstyle import *
...
app = QApplication(args)
app.setStyle(customStyle())
...

I expected that when the application draws the label (pixmap or iconset with 
text) of any QPushButton some actions would be executed, but nothing happens. 
In fact the string <I'm here> is never printed.
I really don't know what is wrong. Please, could you tell me where are the 
mistakes?

Thanks in advance.
-- 
Share what you know, learn what you don't




More information about the PyQt mailing list