[PyQt] QPainter bug(?) in printing.pyw example from PyQt book
Mark Summerfield
mark at qtrac.eu
Fri Jan 9 10:46:33 GMT 2009
On 2009-01-08, Denis Konchekov wrote:
> System: Ubuntu 8.10, Python 2.5.2, PyQt 4.4.3
> Book "Rapid GUI Programming with Python and Qt", example from chap13
> Faded cells in first table after printing to pdf (before changing pen
> color).
> See screenshot in attachment or here:
> http://img404.imageshack.us/done.php?l=img404/1899/75073848lv9.jpg
> Everything ok after adding yet another painter.setPen(Qt.color):
>
> <...>
> y += serifLineHeight
> if balance < 0:
> painter.setPen(Qt.red)
> text = "Please remit the amount owing immediately."
> else:
> text = ("We are delighted to have done business "
> "with you.")
> painter.drawText(x, y, text)
> painter.setPen(Qt.red) #added
> painter.setPen(Qt.black)
> y += int(serifLineHeight * 1.5)
> painter.drawText(x, y, "Transactions:")
> y += serifLineHeight
> option = QTextOption(Qt.AlignRight|Qt.AlignVCenter)
> for date, amount in statement.transactions:
> <...>
>
> mysticism?
Hi Denis,
I get exactly the same problem as you do with Qt 4.4, so it looks to me
like a Qt (or PyQt) bug that was not present in Qt 4.3.
My preferred workaround is:
painter.setPen(Qt.NoPen) # workaround
painter.setPen(Qt.black)
--
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
"Programming in Python 3" - ISBN 0137129297
More information about the PyQt
mailing list