![]() |
JS/QML/Silica: Dynamic PullDownMenu?
(tldr: partly somewhat technical stuff, partly me blabbering on about submenus and ninjablocks)
Since my previous Phone died a few weeks ago (back to N900 for me) and the next one is apparently somewhere in a Warehouse in Finland*, I thought I'd put my insomnia to good use and take the Sailfish SDK for a spin. I do quite a bit of Javascript stuff, so I try to code most of it to included JS files. After half a night of poking here and there, I've got some rudimentary excuse for a NinjaBlocks app running (it controls 433Mhz actuators and the Block's rgb/rgb8 LEDs), but I could not figure out how to append Items to a PullDownMenu dynamically from Javascript. When I "onPressAndHold" an Actuator's SilicaListView Item (which, in real life, might correspond to a wall socket command, like 'switch on living room light 1'), I add or remove a favourite (right now via LocalStorage SQL, which on first glance does not seem to be that persistent, at least for SDK deployments – alternatives are always welcome, if you'd like to share). I really would like those favourite Items to be available in the "Pulley" PullDownMenu, but I have not figured out how to feed a Model (which is pretty easy to manipulate from JS, perfect for me) there – funny, because for SilicaListView it just did what I wanted instantly without me needing a clue about… anything, to be honest. Have I missed something really obvious? It surely seems like it. Also, what should be the expected outcome of a long press on a List Item in your opinion? Should there be a sub section popping out containing more options? Should I push a whole new Page to the Stack? I feel that functionally a ContextMenu could suffice, but it's rather limited in displaying information like that appropriately, because it would have to tell the user the name, current state (enabled/disabled) and that you can actually toggle it. (Am I wrong? Please correct me!) A normal click on those Items triggers the action directly, and I wouldn't want to complicate this primary function. That's why I immediately went for long click. If this is against best practices – well, I'm about a day into this whole topic and ready for suggestions. Thanks :) http://i.imgur.com/41BYLSc.jpg *) Fingers crossed. |
Re: JS/QML/Silica: Dynamic PullDownMenu?
Quote:
There was a bug in Qt[1] that we fixed a while ago that may have caused this. I'm not yet sure if it made it to SDK releases. 1: https://codereview.qt-project.org/#change,67498 |
Re: JS/QML/Silica: Dynamic PullDownMenu?
Quote:
Code:
PullDownMenu { Quote:
|
Re: JS/QML/Silica: Dynamic PullDownMenu?
Wow! A ninjablocks app for sailfish! If you plan to open source it I might spend some time with it, time permitting.
|
Re: JS/QML/Silica: Dynamic PullDownMenu?
Great Responses, you're awesome!
Quote:
Quote:
Quote:
Quote:
|
All times are GMT. The time now is 10:59. |
vBulletin® Version 3.8.8