Hi,

> 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

Unfortunately Silica doesn't have convenience API for adding a context menu to 
any item as it needs to make sure the surrounding view layout makes room for 
the opening menu and that the menu is positioned correctly in relation to 
display. So far adding menus for anything other than a list item has been a 
unnecessarily painful.

We now finally got around developing GridItem, which provides menus and 
remorses like ListItem, but takes care of the different positioning rules of a 
grid. GridItem works with Grid and SilicaGridView. We are targeting to get the 
new component out with 3.2.1.

Note GridItem does not work in vanilla GridView, we need to do some adjustments 
to workaround GridView limitation that assumes each grid delegate has the same 
dimensions. I hope some day Qt gains more sophisticated views, which allow 
aggregating content from multiple models, supports dynamically sized grid 
items, more natural stacking flows, and so on.

Br,

Joona Petrell

________________________________
From: Devel [devel-boun...@lists.sailfishos.org] on behalf of E.S. Rosenberg 
[es.rosenberg+sailfishos....@gmail.com]
Sent: 13 October 2019 00:52
To: Sailfish OS Developers
Subject: Re: [SailfishDevel] Silica QML objects that can have a menu property

Hi Thomas,

Thanks for your long answer and the many references, I guess my main point was 
a bit nit-picking in the sense that Semantically/Linguistically it does not 
seem to make sense to me to use a ListItem (yes it works, but if you were to 
tell anyone that is what you need to use I think they would also say "huh?")

Container and Item and are not documented here: 
https://sailfishos.org/develop/docs/silica/sailfish-silica-all.html/
To me using Item or Container for this would make most sense actually.

Thanks again for your time,
Eli

Op vr 11 okt. 2019 om 16:16 schreef Thomas Tanghus 
<tho...@tanghus.net<mailto:tho...@tanghus.net>>:
On torsdag den 10. oktober 2019 06.30.33 CEST E.S. Rosenberg wrote:
> Hi all,
> 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?

You can set the 'container' property to the parent of the menu as done in:
https://github.com/tanghus/kitchen-timer-qml/blob/master/qml/pages/TimerPage.qml#L220

There it's a BackgroundItem:
https://github.com/tanghus/kitchen-timer-qml/blob/master/qml/pages/TimerPage.qml#L124

Or did I misunderstand you?

--


/Thomas_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to 
devel-unsubscr...@lists.sailfishos.org<mailto:devel-unsubscr...@lists.sailfishos.org>
_______________________________________________
SailfishOS.org Devel mailing list
To unsubscribe, please send a mail to devel-unsubscr...@lists.sailfishos.org

Reply via email to