I've been programming an application with PySide2 and Python 3.8, and i was trying to enable HiDPi, and i found that adding this at the start of the script
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
was supposed to do the trick.
But it did not work for me. The window is shown with regular dpi (96ppp), while the whole system and apps are running on 125% (120ppp). Am I doing sth wrong?
Code:
import sys
from PySide2 import QtWidgets, QtGui, QtCore, QtMultimedia
"""
some functions
"""
if __name__ == "__main__":
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_EnableHighDpiScaling, True)
QtWidgets.QApplication.setAttribute(QtCore.Qt.AA_UseHighDpiPixmaps, True)
app = QtWidgets.QApplication(sys.argv)
window = QtWidgets.QMainWindow()
label = QtWidgets.QLabel(window)
label.setText("hey")
window.show()
app.exec_()
Screenshot (On the screenshot is difficult to appreciate the difference, I'm sorry):
System specs: Windows 10 Pro 64bit Python 3.7.8 PySide2 5.15.2