[SailfishDevel] Context menu of a grid view

Andrey Kozhevnikov coderusinbox at gmail.com
Tue Nov 22 15:10:16 UTC 2016


I mean jolla-gallery. You can get qml files from device in 
/usr/share/jolla-gallery and /usr/lib/qt5/qml/Sailfish/Gallery folders


22.11.2016 17:04, Marcin Mielniczuk пишет:
> You mean jolla-gallery or the Components gallery?
>
> this is what pkcon search name gallery returned.
>
> Marcin
>
> On 21.11.2016 18:52, Andrey Kozhevnikov wrote:
>> 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
>> _______________________________________________
>> 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