How to Call QT_SCALE_FACTOR?

不问归期 提交于 2019-12-11 00:59:07

问题


I have Anaconda installed on my computer. When I open Spyder though, it looks terrible because the DPI is high. I've been told to run QT_SCALE_FACTOR=2.5 spyder to solve the problem. However, I get back 'QT_SCALE_FACTOR' is not recognized as an internal or external command, operable program or batch file. This is frustrating because I have pyqt installed through Anaconda. It's also part of my path C:\...\Anaconda3\Lib\site-packages\PyQt5 If I call qmake -query, I get:

qmake -query
QT_SYSROOT:
QT_INSTALL_PREFIX:C:/Users/.../Anaconda3/Library
QT_INSTALL_ARCHDATA:C:/Users/.../Anaconda3/Library
QT_INSTALL_DATA:C:/Users/.../Anaconda3/Library
QT_INSTALL_DOCS:C:/Users/.../Anaconda3/Library/doc
QT_INSTALL_HEADERS:C:/Users/.../Anaconda3/Library/include/qt
QT_INSTALL_LIBS:C:/Users/.../Anaconda3/Library/lib
QT_INSTALL_LIBEXECS:C:/Users/.../Anaconda3/Library/bin
QT_INSTALL_BINS:C:/Users/.../Anaconda3/Library/bin
QT_INSTALL_TESTS:C:/Users/.../Anaconda3/Library/tests
QT_INSTALL_PLUGINS:C:/Users/.../Anaconda3/Library/plugins
QT_INSTALL_IMPORTS:C:/Users/.../Anaconda3/Library/imports
QT_INSTALL_QML:C:/Users/.../Anaconda3/Library/qml
QT_INSTALL_TRANSLATIONS:C:/Users/.../Anaconda3/Library/translations
QT_INSTALL_CONFIGURATION:
QT_INSTALL_EXAMPLES:C:/Users/.../Anaconda3/Library/examples
QT_INSTALL_DEMOS:C:/Users/.../Anaconda3/Library/examples
QT_HOST_PREFIX:C:/Users/.../Anaconda3/Library
QT_HOST_DATA:C:/Users/.../Anaconda3/Library
QT_HOST_BINS:C:/Users/.../Anaconda3/Library/bin
QT_HOST_LIBS:C:/Users/.../Anaconda3/Library/lib
QMAKE_SPEC:win32-msvc2015
QMAKE_XSPEC:win32-msvc2015
QMAKE_VERSION:3.0
QT_VERSION:5.6.2

So as you can see, it appears I have it installed just fine. How come I can't call QT_SCALE_FACTOR? How can I do that correctly? Thanks! (Incidentally, I'm running Windows 10 if that helps.)


回答1:


Run next commands in windows console (cmd.exe):

set QT_SCALE_FACTOR=2.5
spyder



回答2:


Or in main.cpp

qputenv("QT_SCALE_FACTOR", "1.5");

But you schould also set before

QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); //HiDPI pixmaps


来源:https://stackoverflow.com/questions/44009692/how-to-call-qt-scale-factor

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!