Sorry,

Forgot to attach the test script. Here it is.

Best Regards,
Umit Oztosun
# -*- coding: utf-8 -*-

import sys
from qt import *

class MyButton(QPushButton):

    def drawButton(self, painter):
        # This line:
        self.style().drawControl(QStyle.CE_PushButton, painter, self,
                            self.rect(),
                            self.colorGroup(), QStyle.Style_ButtonDefault)
        defaultFont = painter.font()
        newFont = QFont(defaultFont)
        newFont.setWeight(QFont.Normal)
        painter.setFont(newFont)

        # and this line cause problems:
        self.style().drawControl(QStyle.CE_PushButtonLabel, painter, self,
                            self.style().subRect(QStyle.SR_PushButtonContents, self),
                            self.colorGroup(), QStyle.Style_Default)

        painter.setFont(defaultFont)

class style_test(QWidget):
    def __init__(self,parent = None,name = None,fl = 0):
        # Standart stuff
        QWidget.__init__(self,parent,name,fl)
        style_testLayout = QVBoxLayout(self,11,6,"style_testLayout")
        self.pushButton4 = MyButton(self,"pushButton4")
        style_testLayout.addWidget(self.pushButton4)
        self.resize(QSize(344,96).expandedTo(self.minimumSizeHint()))
        self.pushButton4.setText("Test Button")
        self.setCaption("Abstract style() Test")

if __name__ == "__main__":
    a = QApplication(sys.argv)
    #a.setStyle('platinum') # Uncomment this line to make it work
    QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
    w = style_test()
    a.setMainWidget(w)
    w.show()
    a.exec_loop()
_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to