-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix QFontMetrics.width deprecation warning #715
Conversation
Codecov Report
@@ Coverage Diff @@
## master #715 +/- ##
=========================================
Coverage ? 40.54%
=========================================
Files ? 502
Lines ? 27660
Branches ? 4197
=========================================
Hits ? 11215
Misses ? 15973
Partials ? 472
Continue to review full report at Codecov.
|
All the changes are pretty similar and they solve the same compatibility problem. Could we refactor the handling I am wondering if it is worth having a module for compatibility among various versions of Qt, so that when we drop a specific version of Qt, we can maintain the compatibility layer more easily. @corranwebster, what do you think? (I would have wanted to designate such a module to be private to pyface to start with, but I don't think there is a notion of private modules in pyface so far 🤷 .) |
@Kit we already do some amount of fix-ups to make the APIs match (mainly imports between Qt4 and Qt5) in the |
Hmmm the |
I was mainly thinking about defining and reusing a function like this which is simple enough and we can find their usage again easily:
If adding this function is okay, the question is, where should this live? |
On the other hand, these repetitions are still minor so I'd also be happy to just merge this as it is. |
I think it's fine to merge as-is myself. If we were to generalize/unify as a separate function, I think it would make sense to do so to Wx as well (similar to what we do with |
I have opened #716 to remind us of the discussion. |
SGTM. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we create an issue and link it in the changes being made in this PR? I don't want future us arriving at these pieces of code after a random walk through the pyface codebase.
fixes #653
This PR simply uses QFontMetrics().horizontalAdvance() instead of QFontMetrics().width()when possible (horizontalAdvance was introduced in Qt 5.11) to avoid a deprecation warning.
Same fix was done in an open PR on traitsui: enthought/traitsui#1315