Ableton / aqt-stylesheets

Apply CSS style sheets to QML applications
Other
215 stars 39 forks source link

Inheritence between classes has no effect on properties. #18

Open gck-ableton opened 9 years ago

gck-ableton commented 9 years ago

Selectors matching on a base class are not matched by subclasses.

For example:

// in: TitleBar.qml
Item {
  property color color: root.StyleSet.props.color("color")
}

// in: HorizontalTitleBar.qml
TitleBar {
  // ... things
}

// in: styles.css
TitleBar {
  color: "white";
}

HorizontalTitleBar {
//  color: "green";
}

When using HorizontalTitleBar the color property (from the TitleBar selector) is not matched.

To achieve this the rule matcher has not only to match rules for the class' type proper but also for it's super classes. This should be fairly trivial to do, but needs some thoughts on specificity. E.g. for a class setup like

C is-a B is-a A
Z is-a Y is-a X

which rule is more specific:

A Z { }
B Y { }
C X { }

One possible solution is to give all of them the same specificity and let the css-writer resolve ambiguities in the normal way (order, classnames, etc.)