-
Notifications
You must be signed in to change notification settings - Fork 39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is the QSS model not possible? #47
Comments
Hi, yes that would be the better situation. Actually I don't understand why CSS (or QSS) hasn't be extended to QtQuick in the first place, but there are some hints in various readmes or forum threads that this was not by accident, but wanted. Anyway. Supporting CSS/QSS natively (i.e. without properties) would require quite some changes to the QML kernel itself. Compared to this projects (a) this would be a major undertaking (b) it is unclear whether it would be accepted upstream (see above) and (c) if not, would require custom Qt builds to work. So I guess for now, it will stay this way ¯_(ツ)_/¯ |
I suppose you're right. It's too bad... Thanks for the explanation. If you happen to come across those readmes or forum threads, it would be so helpful if you sent them my way (or attached them here...) |
I'm trying out Aqt-Stylesheets right now and I thought exactly the same. Defining the properties is redundant. It should be possible to auto-infer the CSS/property names from the underlying QtObject via the property() API and maybe a little bit of QMetaObject fiddling. Here is how I would do it:
Does this sound reasonable? |
I looked into this a little bit. Inside the attached QML component you can do something along the lines of: for (int i = 0; i < object->metaObject()->propertyCount(); ++i) {
const auto property = object->metaObject()->property(i);
qDebug() << property.name();
} Which gives you access to all the properties of an object. Then continue with step 3 of the steps above. Of course, this will only work for QML items where we attach a property. So in case we don't set a |
This is a question, not an issue. With the understanding that perfect is the enemy of good...
Is there a technical reason why the QSS approach could not have worked here? Specifically, it is super redundant to define selectors in CSS files and then request the property values in the appropriate elements (what if you get that wrong?) With Qt Style Sheets, you do not need to change your widget code to apply the new properties.
Thank you for making your code available.
The text was updated successfully, but these errors were encountered: