← Back to team overview

ubuntu-phone team mailing list archive

Re: [SDK][Theming] Styling a compound widget

 

Hi Zsombor,

Thanks for the detailed reply! There's still some things I'm confused about, but this may reflect more my lack of understanding of QML. So don't be afraid to tell me that these are stupid questions.

On Mon, Sep 9, 2013 at 8:41 AM, Zsombor Egri <zsombor.egri@xxxxxxxxxxxxx> wrote:
2) If not (and I haven't found one), should there be?


Perhaps. It all depends on the use cases and UX. But for sure there
would be use cases where having such a feature in theme engine would
be beneficial.


If you're going to ask for a use case for each feature, you're dooming yourself to a long game of Whack-a-Mole, where you have to keep adding features each time someone comes up for a reasonable use for them. IMO, you should either declare none of them will be allowed (a mistake, I think) or allow access to everything and trust us devs to use that power responsibly.

(And by 'you', I mean the Ubuntu SDK in general, not Zsombor specifically!)

2) I would have to inherit from a specific theme.  If that changes
in the future, due to system changes or user choice, my styling
would be completely wrong.


Themes provided by the SDK will always be in sync with the
components. So if you need to override some properties from the
style, you will be most likely on the safe side.

Does this mean that users won't be able to choose their own themes? If so, what does this mean for our vision-impaired users that need bold white text on a black background to be able to use their devices?

CustomStyle.qml in Ubuntu.Components.Themes.Ambiance

Item {
    property string firstLabelFamily: "Ubuntu"
    property string secondLabelFamily: "Courrier New"
}

CustomComponent.qml

StyledItem {
    id: custom
    Label {
        font.family: __styleInstance.firstLabelFamily
        text: "First line"
    }
    Label {
        font.family: __styleInstance.secondLabelFamily
        text: "Second line"
    }
    style: Theme.createStyleComponent("CustomStyle.qml", custom)
}

In this way the CustomStyle doesn't do anything else but styles the two labels inside the CustomComponent. Same thing is needed in OptionSelectorDelegate.

Maybe I'm just being dense, but I don't see how this helps me out. I don't want to implement a CustomOptionSelectorDelegate that uses the same style as the default one; I want to take the existing one and tweak one aspect of its style. It seems to me that either (1) there has to be a property (whether in the Delegate itself or in its associated Style) that sets the font for me to tweak (but then you're back to Whack-a-Mole trying to expose the appropriate things), or (2) there needs to be access to the sub-widgets (whether in the Delegate itself or in its associated Style) for me to adjust directly.

Robert


Follow ups

References