Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[Somewhat Solved] Are there any "proving grounds" for stylesheets?
Is there any easy way to find out if a stylesheet is styling all the standard elements Qt comes with? Like a huge window with all the different widgets, where you can load a stylesheet and see how well it works?
If there is no such thing, would there be a way to generate such a widget without having to create it by hand?
jsprenkle last edited by
They also look differently on different operating systems. The closest I know of is the widget gallery in the online documentation
It doesn't matter if they look differently in their native state.
Is there any sourcecode for said gallery, so one could use it to test stylesheets?
Have a look at PATH_TO_YOUR_QT_SOURCES/examples/widgets/styles
Thanks for the hint, but there are several elements missing, I think. First thing I see is that all the views are missing, and there is probably more.
Would there be a way to automatically create an object for every non-abstract subclass of QWidget, put all of them together in some kind of layout (maybe a QFormLayout, labeling things by the className()) and then use the result for testing stylesheets? It wouldn't need to be pretty or fast, but it would be a lot more convenient than coding everything by hand.
NicuPopescu last edited by
if I get it right, you need a simple test case for any kind of widgets?
if so, just do a simple main window project and in its constructor paste this:
@ QFile qss("style.qss");
bool opened = qss.open(QFile::ReadOnly);
QString data = QString::fromUtf8(qss.readAll());
*.qss is just a convention
do a style.qss file in your project dir and you're ready for test ... objectName will be your selector in css file
and have always an eye on "Qt Style Sheets Reference":http://qt-project.org/doc/qt-5.0/qtwidgets/stylesheet-reference.html and doc's examples
It's the other way around! I want to have an application/a single window that contains all the widgets that are included in Qt, each one being a proper representative of its class. And then I want to load a stylesheet, to see if everything is coherent or not. Loading the stylesheet is not the problem, however.
You would need to create a code generator that would go through Qt's includes and find all class derived from QWidget that are not abstract, not an easy task at all. You should rather create your gallery with the widgets you need and add others when useful.
I was hoping there was some kind of "gallery" already. Qt should definitely come with one.
I'll see what I do next. Thanks so far. :)