MerginMaps / mobile

Mobile app for Mergin Maps 📲. Open QGIS projects and manage vector data on your phone, even offline 📶 (Android/iOS/Windows app)
https://merginmaps.com
GNU General Public License v2.0
294 stars 64 forks source link

Use a custom model for relation editor form widget #3310

Open wonder-sk opened 5 months ago

wonder-sk commented 5 months ago

The relation editor form widget shows a couple of related features, with a button to show a full list ("N more") if not all related features can be shown. The current implementation uses Flow+Repeater and some logic to hide extra items (and count number of hidden items) if there are too many items. This is however a bit complicated, and it may be slow when there are many related features, because Repeater will create an item for each feature even if it is hidden. The idea is to move all this complexity to a custom item model that would be also responsible for layout decisions (it will need some basic visual parameters from QML - e.g. font metrics, number of rows, spacing). Such model should be then faster, easier to auto-test and QML code would be without much logic.

tomasMizera commented 5 months ago

++ we might consider if something like this should be used for the gallery too - I understand that ListView is smarter in instantiating delegates, but we will want to show only the first N features and then show x more too :)