diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-07-08 06:00:36 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-07-08 06:00:36 (GMT) |
commit | f727b2fd8d29907f59e11fc18c48329588fa4284 (patch) | |
tree | 744d9dd91af131b430d5f11f3ba9aeb67ff2813f | |
parent | 2283f0d39dfc0ffde1ac5fdb2928a534e164bef3 (diff) | |
download | Qt-f727b2fd8d29907f59e11fc18c48329588fa4284.zip Qt-f727b2fd8d29907f59e11fc18c48329588fa4284.tar.gz Qt-f727b2fd8d29907f59e11fc18c48329588fa4284.tar.bz2 |
Browser UI improvements.
-rw-r--r-- | examples/declarative/loader/Browser.qml | 42 |
1 files changed, 36 insertions, 6 deletions
diff --git a/examples/declarative/loader/Browser.qml b/examples/declarative/loader/Browser.qml index 640ea0c..280273b 100644 --- a/examples/declarative/loader/Browser.qml +++ b/examples/declarative/loader/Browser.qml @@ -5,17 +5,23 @@ Rect { FolderListModel { id: folders nameFilters: [ "*.qml" ] +// folder: "E:" } Component { id: FolderDelegate - Text { + Rect { id: Wrapper width: Root.width - text: fileName - font.bold: true - font.size: 14 + height: NameText.height + Text { + id: NameText + text: fileName + font.bold: true + font.size: 12 + } MouseRegion { + id: Mouse anchors.fill: parent onClicked: { if (folders.isFolder(index)) { @@ -25,17 +31,41 @@ Rect { } } } + states: [ + State { + name: "pressed" + when: Mouse.pressed + SetProperties { target: Wrapper; color: "#bbbbbb" } + } + ] } } - Text { id: DirText; text: folders.folder } + Script { + function up(path) { + var pos = path.toString().lastIndexOf("/"); + return path.toString().substring(0, pos); + } + } + + Rect { + id: UpButton + width: 30 + height: UpText.height + color: "grey" + MouseRegion { anchors.fill: parent; onClicked: folders.folder = up(folders.folder) } + Text { id: UpText; text: "Up" } + } + + Text { anchors.left: UpButton.right; text: folders.folder } ListView { - anchors.top: DirText.bottom + anchors.top: UpButton.bottom anchors.left: parent.left anchors.right: parent.right anchors.bottom: parent.bottom model: folders delegate: FolderDelegate + clip: true } } |