Skip to content
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

Enable high DPI scaling on Qt >= 5.6 #3333

Merged
merged 1 commit into from
Jul 29, 2016
Merged

Conversation

patstew
Copy link
Contributor

@patstew patstew commented Jul 29, 2016

Fixes #2119

@ccordoba12
Copy link
Member

@patstew, thanks a lot for working on this!! Could we say that this fixes issue #2119? The other minor issues you report could be fixed in different PRs :-)

@goanpeca
Copy link
Member

goanpeca commented Jul 29, 2016

Could we use a different version comparison that using QTVERSION Should we use the qtpy ones?

@ccordoba12
Copy link
Member

@goanpeca, it requires a bit more code, but I was thinking that too. I'll add a comment to the diff :-)

@goanpeca
Copy link
Member

goanpeca commented Jul 29, 2016

@ccordoba12 , or we could do it the way @SylvainCorlay did,

    # For retina displays on qt5
    if hasattr(Qt, 'AA_UseHighDpiPixmaps'):
        app.setAttribute(Qt.AA_UseHighDpiPixmaps)

    if hasattr(Qt, 'AA_EnableHighDpiScaling'):
        app.setAttribute(Qt.AA_EnableHighDpiScaling)

@ccordoba12
Copy link
Member

It doesn't work like that because AA_EnableHighDpiScaling needs to be
set before the application is created.

El 29/07/16 a las 09:49, Gonzalo Peña-Castellanos escribió:

@ccordoba12 https://github.com/ccordoba12 , or we could do it the
way @SylvainCorlay https://github.com/SylvainCorlay did,

 # For retina displays on qt5
 if  hasattr(Qt,'AA_UseHighDpiPixmaps'):
     app.setAttribute(Qt.AA_UseHighDpiPixmaps)

 if  hasattr(Qt,'AA_EnableHighDpiScaling')and  WIN:
     app.setAttribute(Qt.AA_EnableHighDpiScaling)


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#3333 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAWS7Q01Me86WYJnYwx5VCQgk03Qjxhvks5qahLrgaJpZM4JYLvL.

# be set before creating the application
#==============================================================================
if QT_VERSION >= 0x050600:
QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@patstew, we prefer to avoid a comparison with an hex number, so please write this code like

if hasattr(Qt, 'AA_EnableHighDpiScaling'):
    QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)

@goanpeca
Copy link
Member

Sure, on Navigator when I use that the application is already created

@patstew
Copy link
Contributor Author

patstew commented Jul 29, 2016

There you go, I've changed it to use hasattr instead. The attribute has no effect if you set it after a QGuiApplication constructor.

@ccordoba12
Copy link
Member

Yes, the Qt docs are quite clear about it:

http://doc.qt.io/qt-5/qt.html

(Look for Qt::AA_EnableHighDpiScaling)

El 29/07/16 a las 10:02, Gonzalo Peña-Castellanos escribió:

Sure, on Navigator when I use that the application is already created


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#3333 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAWS7a0zhjXfUFyJOQdwl_9nlVwtA91Gks5qahXugaJpZM4JYLvL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants