Issue
I am writing PySide tools that run within other 3rd party applications. The same tool will run in multiple applications and should be styled consistently across these. The problem I have is, these applications are sometimes using QT themselves and have their own styling, using presumably QPalette. When my tools parent to the main application they take on the main applications styling.
So I tried to solve this by using my own QPalette and setting my tools main window\widget to use it, however this doesn't have any effect on the widgets children and they still assume the styling from the main application (not sure if this is correct behaviour).
So I started using a stylesheet to customise the whole look, and largely this works. However it is still not consistent across applications. So either I am not overriding enough of the style sheet parameters or there are some things I cannot fix using the style sheet alone. Example of same style sheet in Nuke and 3ds Max
The very basic stylesheet I used in the test:
QWidget {
margin: 0px;
padding: 0px;
spacing: 0px;
color:white;
}
My Concise Questions are:
- Is it possible to completely override the appearance given by the QPalette using stylesheet alone?
- If it is and its relevant here, what could I be missing, the spacing\size are different. Both windows are at their minimum size. Other than margin and padding, I can't think what would be effecting it.
note: I know I haven't overwritten the QGroupbox style sheet, and even doing so doesn't produce the same result. I have also tried using em, px and ex. PySide version is 1.0.9 in nuke and 1.2.2 in max, if this makes a difference, and I guess it probably could. Thanks
Solution
Unfortunately, due to historical reasons Qt does offer all too many ways to skin the same cat when it comes to widget styling, and the stylesheets don't affect layouts. Thus you can't describe an application's style completely using only QSS, and unless you're careful in your design, you'll end up styling things in all sorts of ways, especially if your code has a lot of history. That'll be the case with the tool you're building your plug-in for.
First and foremost, you've realized now that consistent styling is really an interface that all components must adhere to. If this interface is not specified in the plugin developer documentation for the plugin host application, it'll be ugly and unnecessarily hard.
The best you can do is iterate the application's other widgets and sniff their pallettes, layout spacings, etc. You'll basically have to hack it into a working shape, and hope that the next release of the host application doesn't break it. Since they don't specify anything in this respect, they themselves have nothing to test against nor develop against, so the expectation is that yes, it'll break, and yes, it'll be ugly. That's what you get when interface specification is ignored.
Answered By - Kuba hasn't forgotten Monica
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.