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 225 - QWidget didn't have fontMetrics Functions
: QWidget didn't have fontMetrics Functions
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: QtGui
: 0.3.1
: All All
: P5 minor
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2010-05-20 07:45 EEST by Benoît HERVIER
Modified: 2010-06-07 09:24 EEST (History)
7 users (show)

See Also:


Attachments
Sample case for QWidget.fontMetrics (291 bytes, text/x-python)
2010-05-20 07:45 EEST, Benoît HERVIER
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Benoît HERVIER 2010-05-20 07:45:51 EEST
Created attachment 44 [details]
Sample case for QWidget.fontMetrics

The fontMetrics function isn't listed in documentation function list :

http://www.pyside.org/docs/pyside/PySide/QtGui/QWidget.html#PySide.QtGui.QWidget.

But some references are made to fontMetrics in this documentation. Specially
the "see also" part of the documentation of QWidget.font

This methods isn't deprecated in Qt4.4 from what i see in the documentation,
and exist in PyQt4.

Tested on Maemo Fremantle :

0.3.0-1maemo1
and Qt 4.6.2

This breaks compatibility with PyQt4 but a work arround can be used (extracted
from KhtEditor sources (self is a subclass of a QWidget)):

#QWidget.fontMetrics didn't exist on current 0.3.0 version of PySide
#binding. Just a work arround for the moment
#width = self.fontMetrics().width(str(self.highest_line)) + 4
#PySide Work Arround
width = QFontMetrics(self.font).width(str(self.highest_line)) + 4

Sample case join
Comment 1 Benoît HERVIER 2010-05-20 14:23:51 EEST
Tested also on pyside-qt4 Version: 0.3.1-1maemo2
Comment 2 Hugo Parente Lima 2010-05-21 14:24:25 EEST
Fixed, just waiting for code review.

http://qt.gitorious.org/pyside/pyside-shiboken/merge_requests/147
Comment 3 Hugo Parente Lima 2010-05-21 18:49:28 EEST
Fixed in commit pyside-shiboken/072aeadecfff5db9abcb665db144c5d80976fc22
Comment 4 renato filho 2010-06-07 09:24:30 EEST
released 0.3.2.