[SailfishDevel] Context menu of a grid view

Andrey Kozhevnikov coderusinbox at gmail.com
Mon Nov 21 17:52:16 UTC 2016


Check how sailfish-gallery works. It have additional propery in 
delegates altering y-position for elements on next linex after activated 
one.


------ Исходное сообщение ------
От: "Marcin Mielniczuk" <marmistrzmar at gmail.com>
Кому: "Sailfish OS Developers" <devel at lists.sailfishos.org>
Отправлено: 21.11.2016 20:49:46
Тема: [SailfishDevel] Context menu of a grid view

>Hi,
>
>In my app I show the user a grid view. It's elements should be
>interactive and its state can be modified.
>
>I'd like to use a context menu for this. My current approach is
>
>             SilicaGridView {
>                 id: diceView
>
>                 Layout.preferredWidth: parent.width
>                 Layout.fillHeight: true
>
>                 model: myModel
>
>                 cellWidth: width / gridDimension
>                 cellHeight: height / gridDimension
>
>                 delegate: BackgroundItem {
>
>                     id: bgItem
>                     width: diceView.cellWidth
>                     height: diceView.cellHeight
>
>                     /* contents */
>
>                     ContextMenu {
>                         id: contextMenu
>                         parent: bgItem
>                         anchors {
>                             left: bgItem.left
>                             right: bgItem.right
>                             bottom: bgItem.bottom
>                         }
>
>                         RemorseItem {
>                             id: remorse
>                             wrapMode: Text.WordWrap
>                             horizontalAlignment: Text.AlignHCenter
>                         }
>
>                         MenuItem {
>                             text: qsTr("foo")
>                         }
>
>                         MenuItem {
>                             text: qsTr("bar")
>                         }
>                     }
>
>                     onPressAndHold: contextMenu.show(this)
>                 }
>
>The problem is that with two elements, the context menu that overlaps
>the delegate content, which makes the MenuItems illegible.
>
>What is the recommended UX solution for this? Seems that ContextMenu
>works out-of-the-box for SilicaListViews but not for SilicaGridViews.
>
>--
>Marcin
>
>
>_______________________________________________
>SailfishOS.org Devel mailing list
>To unsubscribe, please send a mail to 
>devel-unsubscribe at lists.sailfishos.org



More information about the Devel mailing list