I have an app that I am trying to get the toolbar in the header to work. In the documentation I've noticed a property called head
that seems to create and add items to the header toolbar.
What is the difference between this and the toolbaritems
?
Also, related, in trying to use this head property, I get the error: Cannot assign to non-existent property "head" (similar to question Why am I getting the error “Cannot assign to non-existent property ”head"?)
Which one is the correct (or better) way?
Thank you
Randy
Best Answer
toolbaritems
has been deprecated inUbuntu.Components 1.1
, so its use is strongly discouraged. It is maintained for backward compatibility, but the right way to add items to the header toolbar is now usinghead.actions
.The main difference between
head.actions
andtoolbaritems
is that you don't need anymore to addToolbarButton
items and then set theiraction
property. All you need withhead.actions
is to specify a list of actions and then they will be automatically shown according to Ubuntu Touch patterns.An example that shows how to use
head
property is the following (from official documentation):There are some other useful settings for
PageHead
(e.g. customItem
to show instead of the title), so I'd suggest you to take a look at this page.If you are running Ubuntu 14.04 LTS, these new APIs are not available, due to their dependence on Qt 5.3. You can solve this issue following this link .