Unsolved Incorrect styling of a QT window invoked via PySide
-
I’m trying to fix an issue in a large C++ codebase that uses QT for a substantial portion of its UI. We are displaying a QT window via PySide; I do not have access to its code or styling information for debugging purposes. When this window appears in our application, certain parts of its styling are incorrect: text is too dark, some backgrounds are the wrong colour, etc. The window looks fine when it is displayed in other applications, so the problem is somewhere in our codebase. It occurs on both Windows and Mac, so it doesn't seem to be OS-specific.
I have disabled our application’s QSS stylesheet, and have gone through the code to comment out all of the programmatic changes to stylesheets and QPainter properties I can find. Unfortunately, the issue persists. Do you have any suggestions as to how I can diagnose this problem? Is there some way to view the styles being applied to all QLabels, or to dump all styling information to a file?
Thanks so much for your help!
-
@QTSketcher
Not ideal, but to verify state of widgets without having to change code you can use https://doc.qt.io/qt-5/qapplication.html#allWidgets to visit all widgets, or https://doc.qt.io/qt-5/qapplication.html#topLevelWidgets to start a recursive descent to a particular widget you want to examine. From theQWidget*
you can look at itsstyleSheet()
(unfortunately there is "inherited effects" too) orstyle()
. You could use these e.g. for "Is there some way to view the styles being applied to all QLabels, or to dump all styling information to a file". You might put in a top-level menu item or shortcut key action to do this on click, so navigate the "bad" area and click to take snapshot.When you say "PySide", do you mean the old PySide1 or the new PySide2? I don't know how robust old PySide was, such that it might be implicated in your issue.