PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 364 - Possible unsupported method call: QPainter.drawText(PySide.QtCore.QRect, Alignment, unicode, PySide.QtCore.QRect)
: Possible unsupported method call: QPainter.drawText(PySide.QtCore.QRect, Alig...
Status: CLOSED INVALID
Product: PySide
Classification: Unclassified
Component: QtGui
: 0.4.1
: All All
: P3 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2010-09-17 08:18 EEST by Luca Donaggio
Modified: 2010-10-13 13:52 EEST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Luca Donaggio 2010-09-17 08:18:09 EEST
In Maemo Fremantle, this use of QPainter.drawText():

boundingRect = QRect()
painter.drawText(someRect,(Qt.AlignTop | Qt.AlignLeft | Qt.TextWordWrap),u'Some
Text',boundingRect)

produces the following error:

TypeError: 'PySide.QtGui.QPainter.drawText' called with wrong argument types:
  PySide.QtGui.QPainter.drawText(PySide.QtCore.QRect, Alignment, unicode,
PySide.QtCore.QRect)
Supported signatures:
  PySide.QtGui.QPainter.drawText(PySide.QtCore.QPoint, QString)
  PySide.QtGui.QPainter.drawText(PySide.QtCore.QPointF, QString)
  PySide.QtGui.QPainter.drawText(PySide.QtCore.QRect, int, QString,
PySide.QtCore.QRect)
  PySide.QtGui.QPainter.drawText(PySide.QtCore.QRectF, QString,
PySide.QtGui.QTextOption = QTextOption())
  PySide.QtGui.QPainter.drawText(PySide.QtCore.QRectF, int, QString,
PySide.QtCore.QRectF)
  PySide.QtGui.QPainter.drawText(int, int, QString)
  PySide.QtGui.QPainter.drawText(int, int, int, int, int, QString,
PySide.QtCore.QRect)

while omitting the last parameters works:

painter.drawText(someRect,(Qt.AlignTop | Qt.AlignLeft | Qt.TextWordWrap),u'Some
Text')
Comment 1 renato filho 2010-09-21 15:06:33 EEST
this last argument is used to return the the area utilized for the text. Python
does not support passes value by reference then you replace all functions like
these to return a tuple or an object, then the correct usage is:

boundingRect = painter.drawText(someRect,(Qt.AlignTop | Qt.AlignLeft |
Qt.TextWordWrap),u'SomeText')


Thnaks
Comment 2 Luca Donaggio 2010-09-22 09:48:15 EEST
Thanks Renato!