diff options
author | Martin Jones <martin.jones@nokia.com> | 2009-09-11 05:32:42 (GMT) |
---|---|---|
committer | Martin Jones <martin.jones@nokia.com> | 2009-09-11 05:32:42 (GMT) |
commit | 6065187899b88ce6593077eea5e93737ba31b84e (patch) | |
tree | 0499526791ec0aff804db3cbf6d18543b9bf5ad0 | |
parent | 2984be68041afc154fab2a0b9eb6618caf26cf71 (diff) | |
parent | df478cf9577c766a0a8d0bcb7b4da6c9c0be0171 (diff) | |
download | Qt-6065187899b88ce6593077eea5e93737ba31b84e.zip Qt-6065187899b88ce6593077eea5e93737ba31b84e.tar.gz Qt-6065187899b88ce6593077eea5e93737ba31b84e.tar.bz2 |
Merge branch 'kinetic-declarativeui' of git@scm.dev.nokia.troll.no:qt/kinetic into kinetic-declarativeui
-rw-r--r-- | examples/declarative/listview/content/ClickAutoRepeating.qml | 29 | ||||
-rw-r--r-- | examples/declarative/listview/dynamic.qml | 7 | ||||
-rw-r--r-- | src/declarative/fx/qfximage.cpp | 36 | ||||
-rw-r--r-- | src/declarative/util/qmllistmodel.cpp | 5 |
4 files changed, 44 insertions, 33 deletions
diff --git a/examples/declarative/listview/content/ClickAutoRepeating.qml b/examples/declarative/listview/content/ClickAutoRepeating.qml new file mode 100644 index 0000000..19dd6f6 --- /dev/null +++ b/examples/declarative/listview/content/ClickAutoRepeating.qml @@ -0,0 +1,29 @@ +import Qt 4.6 + +Item { + id: Page + property int repeatdelay: 300 + property int repeatperiod: 75 + property bool pressed: false + signal pressed + signal released + signal clicked + pressed: SequentialAnimation { + id: AutoRepeat + PropertyAction { target: Page; property: "pressed"; value: true } + ScriptAction { script: Page.onPressed } + ScriptAction { script: Page.onClicked } + PauseAnimation { duration: repeatdelay } + SequentialAnimation { + repeat: true + ScriptAction { script: Page.onClicked } + PauseAnimation { duration: repeatperiod } + } + } + MouseRegion { + id: MR + anchors.fill: parent + onPressed: AutoRepeat.start() + onReleased: { AutoRepeat.stop(); parent.pressed = false; Page.released } + } +} diff --git a/examples/declarative/listview/dynamic.qml b/examples/declarative/listview/dynamic.qml index f615c24..dde24f6 100644 --- a/examples/declarative/listview/dynamic.qml +++ b/examples/declarative/listview/dynamic.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import "content" Item { width: 320 @@ -75,10 +76,12 @@ Item { anchors.right: parent.right width: childrenRect.width Image { source: "content/pics/add.png" - MouseRegion { anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Number(cost)+0.25) } + ClickAutoRepeating { id: ClickUp; anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Number(cost)+0.25) } + scale: ClickUp.pressed ? 0.9 : 1 } Image { source: "content/pics/del.png" - MouseRegion { anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Number(cost)-0.25) } + ClickAutoRepeating { id: ClickDown; anchors.fill: parent; onClicked: FruitModel.set(index,"cost",Math.max(0,Number(cost)-0.25)) } + scale: ClickDown.pressed ? 0.9 : 1 } Image { source: "content/pics/trash.png" MouseRegion { anchors.fill: parent; onClicked: FruitModel.remove(index) } diff --git a/src/declarative/fx/qfximage.cpp b/src/declarative/fx/qfximage.cpp index 99e1b72..79b3ae1 100644 --- a/src/declarative/fx/qfximage.cpp +++ b/src/declarative/fx/qfximage.cpp @@ -255,36 +255,12 @@ void QFxImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) p->save(); p->setClipRect(0, 0, width(), height(), Qt::IntersectClip); - if (d->fillMode == Tile) { - const int pw = d->pix.width(); - const int ph = d->pix.height(); - int yy = 0; - - while(yy < height()) { - int xx = 0; - while(xx < width()) { - p->drawPixmap(xx, yy, d->pix); - xx += pw; - } - yy += ph; - } - } else if (d->fillMode == TileVertically) { - const int ph = d->pix.height(); - int yy = 0; - - while(yy < height()) { - p->drawPixmap(QRect(0, yy, width(), ph), d->pix); - yy += ph; - } - } else { - const int pw = d->pix.width(); - int xx = 0; - - while(xx < width()) { - p->drawPixmap(QRect(xx, 0, pw, height()), d->pix); - xx += pw; - } - } + if (d->fillMode == Tile) + p->drawTiledPixmap(QRectF(0,0,width(),height()), d->pix); + else if (d->fillMode == TileVertically) + p->drawTiledPixmap(QRectF(0,0,d->pix.width(),height()), d->pix); + else + p->drawTiledPixmap(QRectF(0,0,width(),d->pix.height()), d->pix); p->restore(); } else { diff --git a/src/declarative/util/qmllistmodel.cpp b/src/declarative/util/qmllistmodel.cpp index 345bc3b..69bed25 100644 --- a/src/declarative/util/qmllistmodel.cpp +++ b/src/declarative/util/qmllistmodel.cpp @@ -499,6 +499,9 @@ void QmlListModel::move(int from, int to, int n) { if (from+n > count() || to+n > count() || n==0 || from==to || from < 0 || to < 0) return; + int origfrom=from; // preserve actual move, so any animations are correct + int origto=to; + int orign=n; if (from > to) { // Only move forwards - flip if backwards moving int tfrom = from; @@ -524,7 +527,7 @@ void QmlListModel::move(int from, int to, int n) for (; f != replaced.end(); ++f, ++t) *t = *f; } - emit itemsMoved(from,to,n); + emit itemsMoved(origfrom,origto,orign); } /*! |