I’m building an engine that lives inside a qt app that we built.
The qt style of the app and shotgun don’t work well together.
I tried calling _initialize_dark_look_and_feel()
and that fixes the shotgun widgets but it also applies the shotgun style to the rest of the qt app, which I don’t want.
I tried copying __initialize_dark_look_and_feel_qt5()
into a function that I could pass a widget in to style but it doesn’t seem to do anything.
Are there any ideas on how to get this to work or other ways to get the shotgun style to only affect the shotgun widgets?
def set_qt_style_on_widget(self, widget):
"""
Applies a dark style for Qt5 environments. This sets the "fusion" style
at the application level, and then constructs and applies a custom palette
that emulates Maya 2017's color scheme.
"""
widget.setStyle(self.style)
widget.setPalette(self.palette)
widget.setStyleSheet(".QWidget { font-size: 11px; }")
def _init_pyside(self):
"""
Handles the pyside init
"""
from Qt import QtGui, QtWidgets
self.style = QtWidgets.QStyleFactory.create('fusion')
self.palette = QtGui.QPalette()
# setup palette the same as __initialize_dark_look_and_feel_qt5
def _create_dialog_with_widget(self, title, bundle, widget_class, *args, **kwargs):
dialog, widget = super(CustomEngine, self)._create_dialog_with_widget(title, bundle, widget_class, *args, **kwargs)
self.set_qt_style_on_widget(widget)
return (dialog, widget)