[Qt-qml] QML Questions

Jason H scorp1us at yahoo.com
Fri Jul 9 04:02:28 CEST 2010


1. wordWrap or wrap? 

Wrap is in the docs, the autocomplete gives me  wordWrap

2. True and False or true and false?
lower case is int he  docs, but only the upper case works.

3 Is there any way to use a ListView to iterate over items one at a time and 
only 

display 1 item?
Given 
ModelData: 1 2 3
List View: [ x ]
Where X is 1,2 or 3.
Then animate between them. I suppose you could set it to be centered, then put a 

clip rect over it?

4 Also, I am not having any luck wrapping text.

5  Maybe I'm used to the Qt Layout way, but when I don't specify a size, I'd 
like it to be the extent of its children. It seems like QML wants me to specify 
parent sizes. In the code below it only "works" when I specify a height for the 
delegate Item.
It should automatically be the sum of the items in the column.

My QML is below:

importQt4.7 
Rectangle {
    width: 1024
    height: 768
    gradient {
        Gradient {
            GradientStop { position: 0; color: "Navy"}
            GradientStop { position: 1; color: "Black"}
        }
    }
    XmlListModel {
        id: feedModel
        source: "http://rss.news.yahoo.com/rss/oceania";
        query: "/rss/channel/item"
        XmlRole { name: "title"; query: "title/string()" }
        XmlRole { name: "pubDate"; query: "pubDate/string()" }
        XmlRole { name: "description"; query: "description/string()" }
    }
    VisualDataModel {
        id: visualModel
        model: feedModel
        delegate: Component {
            Item {
                id: item
            Rectangle {
                color: "Purple"
                radius: 25
                opacity: .5
                width: 1000
                Column {
                    Text {
                        width: 400
                        id: t
                        text: title
                        color: "Red"
                        wrapMode: True
                        font.pixelSize: 24
                    }
                    Text {
                        id: desc
                        width: 400
                        wrapMode: True
                        text: description
                        color: "Yellow"
                        font.pixelSize: 24
                    }
                    Rectangle {
                        height: 10
                    }
                }
            }}
        }
    }
    ListView {
        width: 1000
        height: 700
        anchors.fill: parent
        model: visualModel
        highlightFollowsCurrentItem: true
    }
}


      




More information about the Qt-qml mailing list