← Back to team overview

ubuntu-phone team mailing list archive

Re: Add image for toolbar buttons?

 

On 31 October 2013 21:24, Sam Bull <sam.hacking@xxxxxxxx> wrote:
>
> OK, so how do I actually use this in a toolbar button? The documentation
> says it only has an iconSource attribute, which doesn't support an Icon
> component, and all the examples use Qt.resolvedUrl("foo.png").

Hi Sam,

I had the same problem - I don't think the docs are very clear on how
to use the theme icons with toolbar buttons.

After some experimentation, I got the following to work:

    tools: ToolbarItems {
        ToolbarButton {
            action: Action {
                text: 'Refresh'
                iconSource: Qt.resolvedUrl('image://theme/reload')
                onTriggered: {}
            }
        }
    }

I can replace 'reload' with any of the standard ubuntu mobile icons
(located at: /usr/share/icons/ubuntu-mobile ) - just remember to leave
off the the file extension.

Also be aware that it won't work on your desktop machine, as the
ubuntu mobile theme isn't in use - the icons only displayed on the
device itself when I was testing.


-- 
Matt
mail@xxxxxxxxxxxxxxxx
http://mattaustin.me.uk/


Follow ups

References