[app] Set Fusion style using API

Instead of passing the style via QApplication arguments,
use the QQuickStyle API.
This commit is contained in:
Yann Lanthony 2024-12-20 16:54:39 +01:00
parent aeb77d8dbc
commit a790ac8f21

View file

@ -8,6 +8,7 @@ from PySide6 import __version__ as PySideVersion
from PySide6 import QtCore from PySide6 import QtCore
from PySide6.QtCore import Qt, QUrl, QJsonValue, qInstallMessageHandler, QtMsgType, QSettings from PySide6.QtCore import Qt, QUrl, QJsonValue, qInstallMessageHandler, QtMsgType, QSettings
from PySide6.QtGui import QIcon from PySide6.QtGui import QIcon
from PySide6.QtQuickControls2 import QQuickStyle
from PySide6.QtWidgets import QApplication from PySide6.QtWidgets import QApplication
import meshroom import meshroom
@ -186,12 +187,11 @@ Additional Resources:
class MeshroomApp(QApplication): class MeshroomApp(QApplication):
""" Meshroom UI Application. """ """ Meshroom UI Application. """
def __init__(self, args): def __init__(self, inputArgs):
meshroom.core.initPipelines() meshroom.core.initPipelines()
QtArgs = [args[0], '-style', 'Fusion'] + args[1:] # force Fusion style by default args = createMeshroomParser(inputArgs)
qtArgs = []
args = createMeshroomParser(args)
logStringToPython = { logStringToPython = {
'fatal': logging.FATAL, 'fatal': logging.FATAL,
@ -203,7 +203,7 @@ class MeshroomApp(QApplication):
} }
logging.getLogger().setLevel(logStringToPython[args.verbose]) logging.getLogger().setLevel(logStringToPython[args.verbose])
super(MeshroomApp, self).__init__(QtArgs) super(MeshroomApp, self).__init__(inputArgs[:1] + qtArgs)
self.setOrganizationName('AliceVision') self.setOrganizationName('AliceVision')
self.setApplicationName('Meshroom') self.setApplicationName('Meshroom')
@ -213,6 +213,9 @@ class MeshroomApp(QApplication):
font.setPointSize(9) font.setPointSize(9)
self.setFont(font) self.setFont(font)
# Use Fusion style by default.
QQuickStyle.setStyle("Fusion")
pwd = os.path.dirname(__file__) pwd = os.path.dirname(__file__)
self.setWindowIcon(QIcon(os.path.join(pwd, "img/meshroom.svg"))) self.setWindowIcon(QIcon(os.path.join(pwd, "img/meshroom.svg")))