[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    [PyKDE] class MyStyle(QStyle): pass
From:       "Patrick Stinson" <patrickkidd () gmail ! com>
Date:       2006-11-04 23:41:56
Message-ID: 94ef510611041541n36de9311j911f475d1a81cba5 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Are you only using paintEvent for your custom widget looks, or have you
every subclassed QStyle? I'm wanting to do some prototyping in python but
I'm getting some odd behavior (like scrollbars not moving) from the
following, which worked fine in c++:


class Style(QStyle):
    def __init__(self, baseStyle):
        QStyle.__init__(self)
        self.nativeStyle = QStyleFactory.create(baseStyle)

    def styleHint(self, hint, option, widget, returnData):
        return self.nativeStyle.styleHint(hint, option, widget, returnData)

    def pixelMetric(self, pm, option, widget):
        return self.nativeStyle.pixelMetric(pm, option, widget)

    def drawPrimitive(self, element, option, painter, widget):
        self.nativeStyle.drawPrimitive(element, option, painter, widget)

    def drawControl(self, element, opt, painter,
widget):
        self.nativeStyle.drawControl(element, opt, painter, widget)

    def drawComplexControl(self, *args):
        self.nativeStyle.drawComplexControl(*args)

    def subElementRect(self, subElement, option, widget):
        return self.nativeStyle.subElementRect(subElement, option, widget)

    def sizeFromContents(self, ct, option, contentsSize, widget):
        return self.nativeStyle.sizeFromContents(ct, option, contentsSize,
widget)

    def standardPixmap(self, standardPixmap, option, widget):
        return self.nativeStyle.standardPixmap(standardPixmap, option,
widget)

baseName = QApplication.instance().style().objectName()
style = Style(baseName)

-- 
Patrick Kidd Stinson
http://www.patrickkidd.com/
http://pkaudio.sourceforge.net/
http://pksampler.sourceforge.net/

[Attachment #5 (text/html)]

Are you only using paintEvent for your custom widget looks, or have you every \
subclassed QStyle? I'm wanting to do some prototyping in python but I'm getting some \
odd behavior (like scrollbars not moving) from the following, which worked fine in \
c++: <br><br><br>class Style(QStyle):<br>&nbsp;&nbsp;&nbsp; def __init__(self, \
baseStyle):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
QStyle.__init__(self)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.nativeStyle \
= QStyleFactory.create(baseStyle)<br><br>&nbsp;&nbsp;&nbsp; def styleHint(self, hint, \
option, widget, returnData): <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
self.nativeStyle.styleHint(hint, option, widget, \
returnData)<br><br>&nbsp;&nbsp;&nbsp; def pixelMetric(self, pm, option, \
widget):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
self.nativeStyle.pixelMetric(pm, option, widget)<br><br>&nbsp;&nbsp;&nbsp; def \
drawPrimitive(self, element, option, painter, widget): \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.nativeStyle.drawPrimitive(element, option, painter, \
widget)<br><br>&nbsp;&nbsp;&nbsp; def drawControl(self, element, opt, painter, \
widget):&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n \
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; self.nativeStyle.drawControl (element, \
opt, painter, widget)<br><br>&nbsp;&nbsp;&nbsp; def drawComplexControl(self, \
*args):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; \
self.nativeStyle.drawComplexControl(*args)<br><br>&nbsp;&nbsp;&nbsp; def \
subElementRect(self, subElement, option, \
widget):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
self.nativeStyle.subElementRect (subElement, option, \
widget)<br><br>&nbsp;&nbsp;&nbsp; def sizeFromContents(self, ct, option, \
contentsSize, widget):<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
self.nativeStyle.sizeFromContents(ct, option, contentsSize, \
widget)<br><br>&nbsp;&nbsp;&nbsp; def standardPixmap(self, standardPixmap, option, \
widget): <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return \
self.nativeStyle.standardPixmap(standardPixmap, option, widget)<br \
clear="all"><br>baseName = QApplication.instance().style().objectName()<br>style = \
Style(baseName)<br><br>-- <br>Patrick Kidd Stinson<br> <a \
href="http://www.patrickkidd.com/">http://www.patrickkidd.com/</a><br><a \
href="http://pkaudio.sourceforge.net/">http://pkaudio.sourceforge.net/</a><br><a \
href="http://pksampler.sourceforge.net/">http://pksampler.sourceforge.net/ </a>



_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic