diff --git a/components/TableView.qml b/components/TableView.qml index 3b958df1e85e69fdf49842a05522d1b21f584074..22de87e5735e6cd8de1ef4b3db1e958091a2212f 100644 --- a/components/TableView.qml +++ b/components/TableView.qml @@ -95,7 +95,6 @@ FocusScope{ Component { id: standardDelegate Item { - clip: true property int implicitWidth: sizehint.paintedWidth + 4 Text { width: parent.width diff --git a/examples/Gallery.qml b/examples/Gallery.qml index 77f03554b2d1fc3149009981275f115607c82931..6f3a73eab928678e12673c5cea61afd8891d9020 100644 --- a/examples/Gallery.qml +++ b/examples/Gallery.qml @@ -1,5 +1,6 @@ import QtQuick 1.0 import "../components" +import "content" Rectangle { diff --git a/examples/ItemViewGallery.qml b/examples/ItemViewGallery.qml index 906c8082d7430cb34785f9954e31623589041a71..ff356551304cf53852d450a5376086349b0c12d5 100644 --- a/examples/ItemViewGallery.qml +++ b/examples/ItemViewGallery.qml @@ -11,21 +11,21 @@ Rectangle { width: parent.width height: 40 - ContextMenu { - id: editmenu - model: ListModel { - id: menu - ListElement { text: "Copy" } - ListElement { text: "Cut" } - ListElement { text: "Paste" } - } - } MouseArea { anchors.fill: parent acceptedButtons: Qt.RightButton onPressed: editmenu.show(mouseX, mouseY) } + ChoiceList { + id: delegateChooser + enabled: frame.current == 3 ? 1 : 0 + model: delegatemenu + anchors.left: parent.left + anchors.leftMargin: 8 + anchors.verticalCenter: parent.verticalCenter + } + CheckBox { id: enabledCheck text: "Enabled" @@ -39,10 +39,6 @@ Rectangle { QStyleItem{ id: styleitem} color: syspal.window - - - - XmlListModel { id: flickerModel source: "http://api.flickr.com/services/feeds/photos_public.gne?format=rss2&tags=" + "Qt" @@ -76,8 +72,8 @@ Rectangle { ListModel { id: largeModel Component.onCompleted: { - for (var i=0 ; i< 500 ; ++i) - largeModel.append({"name":"Person "+i , "age": Math.round(Math.random()*100)}) + for (var i=0 ; i< 80 ; ++i) + largeModel.append({"name":"Person "+i , "age": Math.round(Math.random()*100), "sex": Math.random()>0.5 ? "Male" : "Female"}) } } @@ -188,6 +184,69 @@ Rectangle { Tab { title: "Custom delegate" + ListModel { + id: delegatemenu + ListElement { text: "Gray" } + ListElement { text: "hover" } + ListElement { text: "Apple" } + ListElement { text: "Coconut" } + } + + + Component { + id: delegate1 + Item { + clip: true + Text { + width: parent.width + anchors.margins: 4 + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + elide: itemElideMode + text: itemValue ? itemValue : "" + color: itemForeground + } + } + } + + Component { + id: delegate2 + Item { + height: itemSelected? 60 : 20 + Behavior on height{ NumberAnimation{}} + Text { + width: parent.width + anchors.margins: 4 + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + elide: itemElideMode + text: itemValue ? itemValue : "" + color: itemForeground + } + } + } + + Component { + id: delegate3 + Item { + Text { + width: parent.width + anchors.margins: 4 + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + elide: itemElideMode + text: itemValue ? itemValue : "" + color: itemForeground + visible: columnIndex == 0 + } + TextInput{ + color:"#333" + anchors.fill: parent + anchors.margins: 4 + visible: columnIndex == 1 + } + } + } TableView { model: largeModel anchors.margins: 12 @@ -207,6 +266,11 @@ Rectangle { caption: "Age" width: 120 } + TableColumn { + property: "sex" + caption: "Sex" + width: 120 + } headerDelegate: Rectangle { color: "#555" @@ -233,16 +297,14 @@ Rectangle { } } - itemDelegate: Item { - clip: true - Text { - width: parent.width - anchors.margins: 4 - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - elide: itemElideMode - text: itemValue ? itemValue : "" - color: itemForeground + itemDelegate: { + switch(delegateChooser.currentIndex) { + case 0: + return delegate1 + case 1: + return delegate2 + case 2: + return delegate3 } } } diff --git a/examples/Panel.qml b/examples/content/Panel.qml similarity index 96% rename from examples/Panel.qml rename to examples/content/Panel.qml index 178643a9096487488d30d5b1273595b15a581879..358b5749d56ac851198b85b115a575b60e5df0f1 100644 --- a/examples/Panel.qml +++ b/examples/content/Panel.qml @@ -1,5 +1,5 @@ import QtQuick 1.0 -import "../components" +import "../../components" Rectangle { id:root @@ -16,7 +16,7 @@ Rectangle { height:600 BorderImage { id: page - source: "images/page.png" + source: "../images/page.png" y:10; x:50 width: 400; height: 400 border.left: 12; border.top: 12 @@ -39,7 +39,7 @@ Rectangle { BorderImage { id: sidebar - source: "images/panel.png" + source: "../images/panel.png" anchors.left: parent.left anchors.top: parent.top width: show ? 160 : 40