[Interest] qml repeater ordering

Damian Ivanov damianatorrpm at gmail.com
Fri Jun 28 11:52:20 CEST 2013

Thanks Shawn you rock! :)
The only problem left for me then is why qmldir is not working...

2013/6/28 Rutledge Shawn <Shawn.Rutledge at digia.com>:
> On 28 Jun 2013, at 9:24 AM, Damian Ivanov wrote:
>> Hi all,
>> sorry but I will spam you a bit with my questions I don't have
>> experience with C and Qt with python and bash only :(
>> So as my learning objective I want to create a panel with a clock a
>> startmenu and a taskbar. The clock is easy, but I have some questions:
>> 1) Is there an OS independent way I can create the taskbar and
>> startmenu using QML and javascript?
> I'd like to do something similar.  IMO an API to list all the windows on the desktop with their icons and PIDs would be useful, but we don't even have that in C++ AFAIK.  It's a little tricky to implement because the list of windows can include a lot of widget sub-windows, desktop fixtures like docks and taskbars, etc. which are not interesting to a task manager. Every window manager needs such a feature, so it's been done plenty of times, but it's easier for a window manager to implement because it already has more information about the histories and types of all the windows than what you can query via the window management protocol.  But I think it's possible.  If we added the cross-platform C++ API, it could perhaps be exposed as a list model to QtQuick.
>> 2) how should I handle if I want to rearrange the items e.g standard:
>> menu left ; taskbar middle ; clock right
>>    how should I properly handle if I want it to be possible to
>> rearrange them  via a context menu / config file
>>    I'm trying to create a separate plugin.qml file for each (clock,
>> menu, taskbar) and a Repeater that Repeats each of these items but how
>> should I properly rearrange them?
> The model for the repeater can be an object list, e.g. there is this example in the docs:
> Column {
>     Repeater {
>         model: ["apples", "oranges", "pears"]
>         Text { text: "Data: " + modelData }
>     }
> }
> so you could have a config.js to provide the list.  But if you don't mind editing a config file, you could put the Row { StartMenu { } Clock { } … } QML in a separate file so it's easy to edit, and then you wouldn't need a repeater .  Parsing QML is more optimal than handling some kind of config file.
> For dynamic rearranging, you could re-generate that QML programmatically.  But you'd probably have to do it in C++ because we don't yet have a way to write files from QML or JS.  Then just reload the top-level QML into the engine, and it will also reload the dependent QML which is the generated one.  I haven't tried such a thing but I think it might work.

More information about the Interest mailing list