[SailfishDevel] Silica QML objects that can have a menu property

David Llewellyn-Jones david at flypig.co.uk
Fri Oct 11 13:01:54 UTC 2019


On 10/10/2019 07:30, E.S. Rosenberg wrote:
> My question may be very simple - is ListItem the only type of object
> that may display a text on a page that can have a "menu" property? I
> went over the Silica reference quickly and I didn't find any other
> similar items.
> 
> The reason I ask this is that I have a single item I am displaying to
> which I am adding a context menu and semantically it just seemed weird
> that I would have to put that inside of a ListItem to be able to add a
> menu: ContextMenu property.
> 
> Or did I miss some other object that does support this property?

Hi Eli,

I don't think there's anything particularly wrong with using a ListItem
in this way. For example it's used to contain the avatar image and
header on contact pages, which doesn't really form part of a list as such.

See line 79 of /usr/lib/qt5/qml/Sailfish/Contacts/ContactHeader.qml

But it's not the only way to create a context menu. For example, when
you press and hold a date in the Calendar app a context menu with
"Change year" appears, and this is implemented without a ListItem:

Line 153 of /usr/share/jolla-calendar/pages/DatePickerPanel.qml

I'm not sure whether this exactly answers your question, but hopefully
it helps.

David
-- 
Website: http://www.flypig.co.uk


More information about the Devel mailing list