[Qt-interest] drawRect()/fillRect() not working at qt-4.5.0?
Ole Streicher
ole-usenet-spam at gmx.net
Mon May 25 09:35:29 CEST 2009
Hi,
is there anything buggy with drawRect at qt-4.5.0? I have the following
(python) code:
------------------------8<-----------------------------------------------
from PyQt4 import QtGui,QtCore
class MyRubberBand(QtGui.QRubberBand):
def __init__(self, parent):
QtGui.QRubberBand.__init__(self, QtGui.QRubberBand.Line, parent)
self.setColor(QtGui.QColor('Yellow'))
def paintEvent(self, event):
painter = QtGui.QPainter(self)
painter.setPen(self.pen)
painter.setBrush(self.brush)
painter.drawRect(self.rect())
# painter.fillRect(self.rect(), self.brush)
def setColor(self, color):
self.pen = QtGui.QPen(color, 2)
bcolor = QtGui.QColor(color)
bcolor.setAlpha(128)
self.brush = QtGui.QBrush(bcolor)
------------------------8<-----------------------------------------------
With qt-4.4.3 (openSUSE 11.1), I get what I expected: a yellow
rubberband that is filled with some transparency.
However, with qt-4.5.0 (kubuntu 9.04), only the rectangle frame is
displayed. The transparent filling is not displayed. Explicite filling
doesnt help either.
Is this a bug in qt or in my code?
Although my code is Qt I suspect that the problem will be in my
understanding of Qt, or in Qt itself, not in python -- that's why I am
posting here.
Best regards
Ole
More information about the Qt-interest-old
mailing list