summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-07-16 01:52:12 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-07-16 01:52:12 (GMT)
commit24b0ad11174118e327a778bbdf16fa64a5eb640c (patch)
treecd5145da4b07ff51f240ec8d57f11a461ac0ab20
parent84637da766fe1e3a4b4240601a6002f94f1b07c9 (diff)
parentc9a868fecbe08f78c9fc5dc763a5ad178808ad77 (diff)
downloadQt-24b0ad11174118e327a778bbdf16fa64a5eb640c.zip
Qt-24b0ad11174118e327a778bbdf16fa64a5eb640c.tar.gz
Qt-24b0ad11174118e327a778bbdf16fa64a5eb640c.tar.bz2
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r--examples/declarative/loader/Browser.qml62
-rw-r--r--examples/declarative/loader/images/fileopen.pngbin0 -> 953 bytes
-rw-r--r--examples/declarative/loader/images/up.pngbin0 -> 662 bytes
-rw-r--r--examples/declarative/loader/loader.qrc2
-rw-r--r--examples/declarative/loader/main.cpp2
-rw-r--r--src/declarative/extra/qmlfolderlistmodel.cpp4
-rw-r--r--src/declarative/util/qmlpalette.cpp10
-rw-r--r--src/declarative/util/qmlpalette.h3
8 files changed, 65 insertions, 18 deletions
diff --git a/examples/declarative/loader/Browser.qml b/examples/declarative/loader/Browser.qml
index 280273b..aec373b 100644
--- a/examples/declarative/loader/Browser.qml
+++ b/examples/declarative/loader/Browser.qml
@@ -2,6 +2,7 @@ Rect {
id: Root
width: parent.width
height: parent.height
+ color: activePalette.base
FolderListModel {
id: folders
nameFilters: [ "*.qml" ]
@@ -13,12 +14,26 @@ Rect {
Rect {
id: Wrapper
width: Root.width
- height: NameText.height
+ height: 32
+ color: activePalette.base
+ Rect {
+ id: Highlight; visible: false
+ anchors.fill: parent
+ gradient: Gradient {
+ GradientStop { id: t1; position: 0.0; color: activePalette.highlight }
+ GradientStop { id: t2; position: 1.0; color: activePalette.lighter(activePalette.highlight) }
+ }
+ }
+ Item {
+ width: 32; height: 32
+ Image { source: "images/fileopen.png"; anchors.centeredIn: parent; visible: folders.isFolder(index)}
+ }
Text {
id: NameText
- text: fileName
- font.bold: true
- font.size: 12
+ anchors.fill: parent; vAlign: "AlignVCenter"
+ text: fileName; anchors.leftMargin: 32
+ font.size: 10
+ color: activePalette.windowText
}
MouseRegion {
id: Mouse
@@ -35,7 +50,8 @@ Rect {
State {
name: "pressed"
when: Mouse.pressed
- SetProperties { target: Wrapper; color: "#bbbbbb" }
+ SetProperties { target: Highlight; visible: true }
+ SetProperties { target: NameText; color: activePalette.highlightedText }
}
]
}
@@ -48,19 +64,8 @@ Rect {
}
}
- 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: UpButton.bottom
+ anchors.top: TitleBar.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: parent.bottom
@@ -68,4 +73,27 @@ Rect {
delegate: FolderDelegate
clip: true
}
+
+ Rect {
+ id: TitleBar
+ width: parent.width
+ height: 32
+ color: activePalette.button; pen.color: activePalette.mid
+
+ Rect {
+ id: UpButton
+ width: 30
+ height: TitleBar.height
+ pen.color: activePalette.mid; color: "transparent"
+ MouseRegion { anchors.fill: parent; onClicked: folders.folder = up(folders.folder) }
+ Image { anchors.centeredIn: parent; source: "images/up.png" }
+ }
+
+ Text {
+ anchors.left: UpButton.right; anchors.right: parent.right; height: parent.height
+ anchors.leftMargin: 4; anchors.rightMargin: 4
+ text: folders.folder; color: activePalette.buttonText
+ elide: "ElideLeft"; hAlign: "AlignRight"; vAlign: "AlignVCenter"
+ }
+ }
}
diff --git a/examples/declarative/loader/images/fileopen.png b/examples/declarative/loader/images/fileopen.png
new file mode 100644
index 0000000..4aaf149
--- /dev/null
+++ b/examples/declarative/loader/images/fileopen.png
Binary files differ
diff --git a/examples/declarative/loader/images/up.png b/examples/declarative/loader/images/up.png
new file mode 100644
index 0000000..b05f802
--- /dev/null
+++ b/examples/declarative/loader/images/up.png
Binary files differ
diff --git a/examples/declarative/loader/loader.qrc b/examples/declarative/loader/loader.qrc
index 1f0925f..bdbcd5c 100644
--- a/examples/declarative/loader/loader.qrc
+++ b/examples/declarative/loader/loader.qrc
@@ -2,5 +2,7 @@
<qresource prefix="/">
<file>loader.qml</file>
<file>Browser.qml</file>
+ <file>images/fileopen.png</file>
+ <file>images/up.png</file>
</qresource>
</RCC>
diff --git a/examples/declarative/loader/main.cpp b/examples/declarative/loader/main.cpp
index 23125ce..aa86f8f 100644
--- a/examples/declarative/loader/main.cpp
+++ b/examples/declarative/loader/main.cpp
@@ -5,6 +5,7 @@
#include <QmlContext>
#include <QmlComponent>
#include <qfxview.h>
+#include "qmlpalette.h"
QFxView *canvas = 0;
@@ -61,6 +62,7 @@ int main(int argc, char *argv[])
canvas = new QFxView;
QmlContext *ctxt = canvas->rootContext();
ctxt->setContextProperty("qmlLauncher", launcher);
+ ctxt->setContextProperty("activePalette", new QmlPalette);
canvas->setUrl(QUrl("qrc:/loader.qml"));
canvas->execute();
canvas->show();
diff --git a/src/declarative/extra/qmlfolderlistmodel.cpp b/src/declarative/extra/qmlfolderlistmodel.cpp
index acee5e1..4a71109 100644
--- a/src/declarative/extra/qmlfolderlistmodel.cpp
+++ b/src/declarative/extra/qmlfolderlistmodel.cpp
@@ -161,7 +161,9 @@ void QmlFolderListModel::classComplete()
bool QmlFolderListModel::isFolder(int index) const
{
Q_D(const QmlFolderListModel);
- return d->model.isDir(d->model.index(index, 0, d->folderIndex));
+ if (index != -1)
+ return d->model.isDir(d->model.index(index, 0, d->folderIndex));
+ return false;
}
void QmlFolderListModel::refresh()
diff --git a/src/declarative/util/qmlpalette.cpp b/src/declarative/util/qmlpalette.cpp
index eda0ded..40cfa71 100644
--- a/src/declarative/util/qmlpalette.cpp
+++ b/src/declarative/util/qmlpalette.cpp
@@ -151,6 +151,16 @@ QColor QmlPalette::highlightedText() const
return d->palette.color(d->group, QPalette::HighlightedText);
}
+QColor QmlPalette::lighter(const QColor& color) const
+{
+ return color.lighter();
+}
+
+QColor QmlPalette::darker(const QColor& color) const
+{
+ return color.darker();
+}
+
void QmlPalette::setColorGroup(QPalette::ColorGroup colorGroup)
{
Q_D(QmlPalette);
diff --git a/src/declarative/util/qmlpalette.h b/src/declarative/util/qmlpalette.h
index 1401ad1..7f26f9a 100644
--- a/src/declarative/util/qmlpalette.h
+++ b/src/declarative/util/qmlpalette.h
@@ -101,6 +101,9 @@ public:
bool virtual eventFilter(QObject *watched, QEvent *event);
bool virtual event(QEvent *event);
+ Q_INVOKABLE QColor lighter(const QColor&) const;
+ Q_INVOKABLE QColor darker(const QColor&) const;
+
Q_SIGNALS:
void paletteChanged();
};