On dimanche 15 janvier 2017 10:31:27 CET David Faure wrote: > Feel free to experiment meanwhile and tell me what you find
OK, I did experiments (and reading Qt source code) and here are the results. * setStyleSheet() on a widget always propagates to child widgets * there is no way to prevent it from propagating to a given child (so for a dialog, a possible hack is to create it with no parent, but this can give centering/focus trouble on some platforms I believe) * setStyle() on a widget *never* propagates to child widgets (as documented, but very surprising to me, especially since it would probably have been easy for Qt to provide that option, given that it was implemented for the internal QStyle that implements stylesheets) * setPalette() on a widget always propagates to child widgets (I knew that one) As a result, a working solution (for a completely unstyled QFileDialog, native or builtin) is: * no stylesheet, but a custom QStyle subclass instead, applied with setStyle() on each individual widget being created, except for those in a file dialog. As to the palette, it just needs to be set on any window being created, and the system palette (saved on startup) is set instead on file dialogs. I have started to implement this solution (using a qApp event filter to be notified of widgets being created/reparented using QEvent::Polish). The longest part of the job is obviously to convert the stylesheet to a QStyle subclass, but I'm making good progress with that (well... I'm at 27% of the qss file ;). Using QStyle instead of a stylesheet also gives full control over the layouting and painting of the widgets, and is faster (at runtime, not at coding time :-). Sneak peek of the code: http://www.davidfaure.fr/2017/ThornStyle.cpp http://www.davidfaure.fr/2017/ThornStyle.h I can't do intermediate commits until the stylesheet is fully converted, because I can't mix and match the two. BTW if there was anything you wanted different in the styling, now is the time to tell me; no point in me porting the settings from the qss if we then decide to do something differently; better avoid doing the work twice. -- David Faure, [email protected], http://www.davidfaure.fr Working on KDE Frameworks 5 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Rosegarden-devel mailing list [email protected] - use the link below to unsubscribe https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
