← Back to team overview

ubuntu-phone team mailing list archive

Re: theme.name and qrc

 

It depends what do you want to do there. Do you really want to have a
different visual for your button? ( I saw you have ButtonStyle declared
there).

If you want your own palette, or only few colors changed in your palette,
you can declare those in your application's root component:

MainView {
....
    theme: ThemeSettings {
        name: "Ubuntu.Components.Themes.Ambiance" // the theme you want to
derive from
        palette: Palette {
            // this will only change the colors you specify here, the rest
will come from the theme
            normal.background: UbuntuColors.blue
        }
    }
}

Then if you want some custom style for the Button, you can specify that as
follows:

Button {
    style: CustomButtonStyle {
        ...
    }
}

You may also want to read this tutorial:
https://developer.ubuntu.com/api/apps/qml/sdk-15.04.1/UbuntuUserInterfaceToolkit.ubuntu-theming/
Hopefully once it will be included in between the main tutorial links.


On Tue, Mar 1, 2016 at 4:03 PM, Petr Štětka <stetka.peta@xxxxxxxxx> wrote:

> So, how can I theming my app, when I want use qrc?
> Dne 1. 3. 2016 11:53 napsal uživatel "Zsombor Egri" <
> zsombor.egri@xxxxxxxxxxxxx>:
>
> The simple answer is: you cannot. The theme.name is not a file path, it's
>> a URL.
>>
>> On Mon, Feb 29, 2016 at 1:30 PM, Petr Štětka <stetka.peta@xxxxxxxxx>
>> wrote:
>>
>>> Hi,
>>> I want to load my theme that I have with other files in
>>> qml.qrc (Resource Collection Files)
>>> like this:
>>>
>>> <RCC>
>>>     <qresource prefix="/">
>>>         <file>qml/main.qml</file>
>>>         <file>qml/LightTheme/parent_theme</file>
>>>         <file>qml/LightTheme/ButtonStyle.qml</file>
>>>         <file>qml/LightTheme/Palette.qml</file>
>>>     </qresource>
>>> </RCC>
>>>
>>>
>>> Unfortunately, when I try to load it with this:
>>>
>>> theme.name = "qrc:///qml/LightTheme"
>>>
>>> or with:
>>>
>>> theme.name = "LightTheme"
>>>
>>>
>>> It does not work:
>>>
>>> Theme not found: "qrc:///qml/LightTheme"
>>>
>>> So how can I load a my theme from qrc?
>>>
>>> Petr Štětka
>>>
>>> --
>>> Mailing list: https://launchpad.net/~ubuntu-phone
>>> Post to     : ubuntu-phone@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~ubuntu-phone
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>

References