klauer / qtpynodeeditor

Python Qt NodeEditor (qtpy, PyQt5, PySide)
https://klauer.github.io/qtpynodeeditor/
Other
186 stars 53 forks source link

FIX: QFontMetrics.width() deprecation #36

Closed klauer closed 4 years ago

klauer commented 4 years ago

Closes #33

Did a quick comparison between the alternates QFontMetrics.horizontalAdvance(str) vs QFontMetrics.boundingRect(str).width() and didn't find much of a difference at least in the example case:

image image

klauer commented 4 years ago

Travis isn't showing results here - wonder if it's because I'm PR'ing to my own repository. Anyway, this is passing with the CI fix in f12bab2: https://travis-ci.org/github/klauer/qtpynodeeditor/builds/671860068

NovA80 commented 3 years ago

QFontMetrics.horizontalAdvance() is introduced in Qt-5.11. It's a rather new version, not always available in stable repos. For example in latest Anaconda, just PyQt-5.9 LTS conda package is provided, which is required by spyder4 etc, so pip-installing newer PyQt is not an option. So to use qtpynodeeditor in stable Anaconda this commit would be better reverted.