[Interest] Accessing listview index in an extensible QML application

Daniel França daniel.franca at gmail.com
Mon Mar 2 05:58:51 CET 2015


Hi guys,

I'm doing an extensible QML application, it means that some of the
components are loaded according to the "plugins" loaded on the application.

One of the situations is the following.

I've a ListView, and some of the elements shown on the ListView delegate
are loaded based on the plugins. To create the component/object I use the
functions: *Qt.createComponent* *and component.createObject*

It works great, and I can see and interact with the qml components loaded.

However, for some of the features I need to change the listview index from
inside a plugin qml file (that is loaded on a delegated), but the index is
not accessible from there, and I get a simple *index is not defined* When
trying to.

The code is on github: The extension file is this one:
https://github.com/danielfranca/procrastinationkiller/blob/master/extensions/timerTasks/taskRow.qml

The specific part I need to access the index is on the *clicked* signal of
mousearea of element with id *playpause*.

I also tried finding the ListView element, and calling the function
*indexAt* with the x, y mouse coordinates, but it's always returning 0.

The specific code that loads the component is this one:
http://pastebin.com/n5W7Em1S

And the function that this code calls is a javascript function that is in
this file:
https://github.com/danielfranca/procrastinationkiller/blob/master/extensions.js

Let me know if you need more details, and I would love to understand why
QML don't expose the index to loaded components and why it can't find the
index even with x,y coordinates.

I'm using Qt5.4, Ubuntu 14.10, Qt Creator 3.3.1
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20150302/f3e2b12b/attachment.html>


More information about the Interest mailing list