[SailfishDevel] ColumnView is not scaling properly with ComboBox including ContextMenu.

Joona Petrell joona.petrell at jolla.com
Mon Aug 6 18:38:12 UTC 2018


Hi Riku,

ColumnView is a very limited component, created to work-around limitations in Qt Quick views. But you are right, there is a bug in ColumnView. ColumnView doesn't behave nicely when delegates are ComboBoxes, the dynamic sizing of ContextMenu only works with ListItems. I created a bug for the issue in our internal bug tracking database.

Adding similar kind of special-case handling to ComboBox as we have in ListItem seems ot fix the issue:

sailfish-silica/components/ComboBox.qml:
+    on_MenuOpenChanged: {
+        var viewItem = comboBox.ListView.view || comboBox.GridView.view
+        if (viewItem && ('__silica_contextmenu_instance' in viewItem)) {
+            viewItem.__silica_contextmenu_instance = _menuOpen ? menu : null
+        }
+    }

The design you are creating is a bit unusual, ComboBoxes are normally used in Settings views with fixed number of settings components.

Cheers,

Joona

________________________________________
From: Devel [devel-bounces at lists.sailfishos.org] on behalf of Riku [rikul.lajolla at kiu.as]
Sent: 06 August 2018 17:49
To: devel at lists.sailfishos.org
Subject: [SailfishDevel] ColumnView is not scaling properly with ComboBox including ContextMenu.

Hi,

When developing my 'At work' app I used ColumnView with ComboBox including ContextMenu. I noticed that ColumnView is not scaling properly in that case.

E.g I have 10 items in a listmodel for ColumnView. For each listmodel item there  are three menu items. In the column view first items can be handled properly but the last items not  because ContextMenu will be hidden by the fixed size ColumnView.

I explored the ColumnView implementation and noticed there to be an attempt to deal ContextMenu by affecting the implicitHeight of the ColumnView. https://github.com/dm8tbr/sailfishsilica-qt5/blob/master/usr/lib/qt5/qml/Sailfish/Silica/ColumnView.qml

Have anybody met similar problems? Is the ComboBox preventing the scalability?

The app 'At work' is in the  harbour and the page code is in github: https://github.com/Rikujolla/oontoissa/blob/master/qml/pages/ShowDay.qml

Regards, Riku Lahtinen

--
Lähetetty Jollastani
_______________________________________________
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