[PyKDE] Problem: drawPushButton

Grzegorz Zegartowski greg at itam.zabrze.pl
Wed Jul 11 16:41:41 BST 2001


Gerard Vermeulen wrote:

>Greg / Phil
>
>I looked in the qstyle.sip file and I quote:
>
>virtual void drawPushButton(QPushButton *,QPainter *) = 0;
>virtual void drawPushButtonLabel(QPushButton *,QPainter *) = 0;
>
>Suppose it means that drawPushButton and drawPushButtonLabel
>are pure virtual functions, meaning that you have to redefine
>them in a derived class (this is a guess, read on).
>
>Greg, see themes.py in the examples directory how to do this :
>def drawButton(self, p, x, y, w, h, g, sunken=FALSE, fill=None)
>in the class NorwegianWoodStyle
>
>Gerard
>
Should I really redefine drawPushButton() in Python?
When you call: "style().drawPushButton()" in C++ program
it works perfectly.

#######################################################
class Q_EXPORT CMyPushButton : public QPushButton
{     
Q_OBJECT

    protected:
        virtual void drawButton( QPainter *paint );
}


void CMyPushButton::drawButton( QPainter *paint )
{
    style().drawPushButton(this, paint);
    drawButtonLabel(paint);               
}
#######################################################


Can you explain the diffrences bewteen Python and C++
when you call style() method?
 
Greg









More information about the PyQt mailing list