mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 16:34:53 +01:00
General: Qt scale enhancement (#5059)
* set 'QT_SCALE_FACTOR_ROUNDING_POLICY' to 'PassThrough' * implemented 'get_openpype_qt_app' which set all openpype related attributes * implemented get app functions in igniter and ayon common * removed env varaibles 'QT_SCALE_FACTOR_ROUNDING_POLICY' * formatting fixes * fix line length * fix args
This commit is contained in:
parent
a76989108e
commit
594f1014ce
12 changed files with 104 additions and 94 deletions
|
|
@ -14,6 +14,7 @@ from openpype.client import (
|
|||
from openpype.style import (
|
||||
get_default_entity_icon_color,
|
||||
get_objected_colors,
|
||||
get_app_icon_path,
|
||||
)
|
||||
from openpype.resources import get_image_path
|
||||
from openpype.lib import filter_profiles, Logger
|
||||
|
|
@ -152,6 +153,36 @@ def qt_app_context():
|
|||
yield app
|
||||
|
||||
|
||||
def get_openpype_qt_app():
|
||||
"""Main Qt application initialized for OpenPype processed.
|
||||
|
||||
This function should be used only inside OpenPype process and never inside
|
||||
other processes.
|
||||
"""
|
||||
|
||||
app = QtWidgets.QApplication.instance()
|
||||
if app is None:
|
||||
for attr_name in (
|
||||
"AA_EnableHighDpiScaling",
|
||||
"AA_UseHighDpiPixmaps",
|
||||
):
|
||||
attr = getattr(QtCore.Qt, attr_name, None)
|
||||
if attr is not None:
|
||||
QtWidgets.QApplication.setAttribute(attr)
|
||||
|
||||
if hasattr(
|
||||
QtWidgets.QApplication, "setHighDpiScaleFactorRoundingPolicy"
|
||||
):
|
||||
QtWidgets.QApplication.setHighDpiScaleFactorRoundingPolicy(
|
||||
QtCore.Qt.HighDpiScaleFactorRoundingPolicy.PassThrough
|
||||
)
|
||||
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
app.setWindowIcon(QtGui.QIcon(get_app_icon_path()))
|
||||
return app
|
||||
|
||||
|
||||
class SharedObjects:
|
||||
jobs = {}
|
||||
icons = {}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue