[Qt-qml] How to update item within a Row
mathias.malmqvist at nokia.com
mathias.malmqvist at nokia.com
Tue Jan 4 15:30:45 CET 2011
Mark,
You can give each of your Desk elements an id and use that to access the element.
> FWIW I switch between them like this below
For the key navigation maybe this will help
http://doc.qt.nokia.com/4.7/qml-keynavigation.html
> I don't want to use ListElements which are destroyed when they are
> out of view
You should be able to avoid that. See
http://doc.qt.nokia.com/4.7/qml-gridview.html#cacheBuffer-prop
or
http://doc.qt.nokia.com/4.7/qml-gridview.html#delayRemove-prop
Cheers
Mathias
________________________________________
From: qt-qml-bounces+mathias.malmqvist=nokia.com at qt.nokia.com [qt-qml-bounces+mathias.malmqvist=nokia.com at qt.nokia.com] on behalf of ext Mark Constable [markc at renta.net]
Sent: Tuesday, January 04, 2011 5:08 AM
To: qt-qml at qt.nokia.com
Subject: Re: [Qt-qml] How to update item within a Row
On 2011-01-03, Abhishek wrote:
> As i understand(check qt/src/graphicsitems/qdeclarativerepeater.cpp)
> *Repeater* will create all element dynamically so no Id for each
> item and also there is no method or property which returns the list
> of item created by Repeater and same goes to Row, it also doesn't
> have any method or property to give the list of Item in Row so one
> cant Iterate over and find the Item at given Index.
Newb attempt #2. So if I at least avoid using Repeater and hard
wire some Components then how do I reference any one of them
from the outside? I want to dynamically load up these "desktop"
containers with "applications" ie; the demos/declarative/rssnews
example into, say, "Desktop 2".
Row {
id: desk
width: rootWidth
height: rootHeight
Desk { x: rootWidth * 0; deskTitle: "<h1>Desktop 1</h1>" }
Desk { x: rootWidth * 1; deskTitle: "<h1>Desktop 2</h1>" }
Desk { x: rootWidth * 2; deskTitle: "<h1>Desktop 3</h1>" }
// [... * 10]
}
// Desk.qml
import QtQuick 1.0
Rectangle {
property alias deskTitle: title.text
width: rootWidth
height: rootHeight
color: "#3f3f3f"
Text {
id: title
anchors.centerIn: parent
}
}
FWIW I switch between them like this below. I don't want to use
ListElements which are destroyed when they are out of view because
the "applications" could still be active and pulling in feeds in
the case of rssnews.
property int current: 0
Keys.onPressed: {
switch(event.key) {
case Qt.Key_Right: {
current = (current == 9) ? 0 : current+1
desk.x = -(rootWidth * current) } break;
case Qt.Key_Left: {
current = (current == 0) ? 9 : current-1
desk.x = -(rootWidth * current) } break;
}
}
--markc
_______________________________________________
Qt-qml mailing list
Qt-qml at qt.nokia.com
http://lists.qt.nokia.com/mailman/listinfo/qt-qml
More information about the Qt-qml
mailing list