summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2011-04-01 03:43:27 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2011-04-01 03:43:27 (GMT)
commit14de8cecfa5b5428d597c9cca111ee0f3f89502f (patch)
tree1106e55230630e9c801079280cc674ade9bfc625
parent56ca8ea340aa55071c7d616e421d67a3d3622058 (diff)
parent538a415b8296db36355609d6e84137b9354967a7 (diff)
downloadQt-14de8cecfa5b5428d597c9cca111ee0f3f89502f.zip
Qt-14de8cecfa5b5428d597c9cca111ee0f3f89502f.tar.gz
Qt-14de8cecfa5b5428d597c9cca111ee0f3f89502f.tar.bz2
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/qt-qml into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/qt-qml: Add missing test file. Changing width of RTL positioner doesn't relayout Fix TextInput auto test failure on mac. PinchArea and Flickable don't work well enough together Fix auto test failure. Once Image sourceSize is set there is no way to clear it. Rotation transform with NaN angle can cause crash Canceling image download while reading causes crash Fix width of TextInput micro focus rectangle.
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp9
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp3
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase.cpp15
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimagebase_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativepincharea.cpp236
-rw-r--r--src/declarative/graphicsitems/qdeclarativepincharea_p.h7
-rw-r--r--src/declarative/graphicsitems/qdeclarativepincharea_p_p.h5
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners.cpp10
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp6
-rw-r--r--src/declarative/util/qdeclarativepixmapcache.cpp3
-rw-r--r--src/gui/graphicsview/qgraphicstransform.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicsview.cpp2
-rw-r--r--tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp22
-rw-r--r--tests/auto/declarative/qdeclarativepincharea/data/flickresize.qml50
-rw-r--r--tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp73
-rw-r--r--tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp22
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/data/CursorRect.qml8
-rw-r--r--tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp20
-rw-r--r--tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp50
-rw-r--r--tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp4
21 files changed, 429 insertions, 127 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index 8f37e90..45a03a0 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -300,7 +300,7 @@ void QDeclarativeBorderImage::load()
}
if (d->url.isEmpty()) {
- d->pix.clear();
+ d->pix.clear(this);
d->status = Null;
setImplicitWidth(0);
setImplicitHeight(0);
@@ -340,6 +340,7 @@ void QDeclarativeBorderImage::load()
options |= QDeclarativePixmap::Asynchronous;
if (d->cache)
options |= QDeclarativePixmap::Cache;
+ d->pix.clear(this);
d->pix.load(qmlEngine(this), d->url, options);
if (d->pix.isLoading()) {
@@ -472,6 +473,7 @@ void QDeclarativeBorderImage::setGridScaledImage(const QDeclarativeGridScaledIma
options |= QDeclarativePixmap::Asynchronous;
if (d->cache)
options |= QDeclarativePixmap::Cache;
+ d->pix.clear(this);
d->pix.load(qmlEngine(this), d->sciurl, options);
if (d->pix.isLoading()) {
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 511f789..7e73a37 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -1339,7 +1339,9 @@ void QDeclarativeFlickable::resizeContent(qreal w, qreal h, QPointF center)
Q_D(QDeclarativeFlickable);
if (w != d->hData.viewSize) {
qreal oldSize = d->hData.viewSize;
- setContentWidth(w);
+ d->hData.viewSize = w;
+ d->contentItem->setWidth(w);
+ emit contentWidthChanged();
if (center.x() != 0) {
qreal pos = center.x() * w / oldSize;
setContentX(contentX() + pos - center.x());
@@ -1347,12 +1349,15 @@ void QDeclarativeFlickable::resizeContent(qreal w, qreal h, QPointF center)
}
if (h != d->vData.viewSize) {
qreal oldSize = d->vData.viewSize;
- setContentHeight(h);
+ d->vData.viewSize = h;
+ d->contentItem->setHeight(h);
+ emit contentHeightChanged();
if (center.y() != 0) {
qreal pos = center.y() * h / oldSize;
setContentY(contentY() + pos - center.y());
}
}
+ d->updateBeginningEnd();
}
/*!
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index ed5d5fc..a62d3d2 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -377,6 +377,9 @@ qreal QDeclarativeImage::paintedHeight() const
If the source is a non-scalable image (eg. JPEG), the loaded image will
be no greater than this property specifies. For some formats (currently only JPEG),
the whole image will never actually be loaded into memory.
+
+ Since QtQuick 1.1 the sourceSize can be cleared to the natural size of the image
+ by setting sourceSize to \c undefined.
\note \e {Changing this property dynamically causes the image source to be reloaded,
potentially even from the network, if it is not in the disk cache.}
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
index 2de3ba0..daebac4 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp
@@ -133,6 +133,18 @@ QSize QDeclarativeImageBase::sourceSize() const
return QSize(width != -1 ? width : d->pix.width(), height != -1 ? height : d->pix.height());
}
+void QDeclarativeImageBase::resetSourceSize()
+{
+ Q_D(QDeclarativeImageBase);
+ if (!d->explicitSourceSize)
+ return;
+ d->explicitSourceSize = false;
+ d->sourcesize = QSize();
+ emit sourceSizeChanged();
+ if (isComponentComplete())
+ load();
+}
+
bool QDeclarativeImageBase::cache() const
{
Q_D(const QDeclarativeImageBase);
@@ -176,7 +188,7 @@ void QDeclarativeImageBase::load()
Q_D(QDeclarativeImageBase);
if (d->url.isEmpty()) {
- d->pix.clear();
+ d->pix.clear(this);
d->status = Null;
d->progress = 0.0;
setImplicitWidth(0);
@@ -191,6 +203,7 @@ void QDeclarativeImageBase::load()
options |= QDeclarativePixmap::Asynchronous;
if (d->cache)
options |= QDeclarativePixmap::Cache;
+ d->pix.clear(this);
d->pix.load(qmlEngine(this), d->url, d->explicitSourceSize ? sourceSize() : QSize(), options);
if (d->pix.isLoading()) {
diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
index abee25d..1763bba 100644
--- a/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeimagebase_p.h
@@ -59,7 +59,7 @@ class Q_AUTOTEST_EXPORT QDeclarativeImageBase : public QDeclarativeImplicitSizeI
Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged)
Q_PROPERTY(bool asynchronous READ asynchronous WRITE setAsynchronous NOTIFY asynchronousChanged)
Q_PROPERTY(bool cache READ cache WRITE setCache NOTIFY cacheChanged REVISION 1)
- Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize NOTIFY sourceSizeChanged)
+ Q_PROPERTY(QSize sourceSize READ sourceSize WRITE setSourceSize RESET resetSourceSize NOTIFY sourceSizeChanged)
Q_PROPERTY(bool mirror READ mirror WRITE setMirror NOTIFY mirrorChanged REVISION 1)
public:
@@ -80,6 +80,7 @@ public:
virtual void setSourceSize(const QSize&);
QSize sourceSize() const;
+ void resetSourceSize();
virtual void setMirror(bool mirror);
bool mirror() const;
diff --git a/src/declarative/graphicsitems/qdeclarativepincharea.cpp b/src/declarative/graphicsitems/qdeclarativepincharea.cpp
index 9bc3d8d..c30ff8c 100644
--- a/src/declarative/graphicsitems/qdeclarativepincharea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepincharea.cpp
@@ -138,6 +138,14 @@ QT_BEGIN_NAMESPACE
ignored.
*/
+/*!
+ \qmlproperty int PinchEvent::pointCount
+
+ Holds the number of points currently touched. The PinchArea will not react
+ until two touch points have initited a gesture, but will remain active until
+ all touch points have been released.
+*/
+
QDeclarativePinch::QDeclarativePinch()
: m_target(0), m_minScale(1.0), m_maxScale(1.0)
, m_minRotation(0.0), m_maxRotation(0.0)
@@ -295,7 +303,7 @@ bool QDeclarativePinchArea::event(QEvent *event)
void QDeclarativePinchArea::updatePinch()
{
Q_D(QDeclarativePinchArea);
- if (d->touchPoints.count() != 2) {
+ if (d->touchPoints.count() == 0) {
if (d->inPinch) {
d->stealMouse = false;
setKeepMouseGrab(false);
@@ -308,127 +316,141 @@ void QDeclarativePinchArea::updatePinch()
pe.setPreviousScale(d->pinchLastScale);
pe.setStartPoint1(mapFromScene(d->sceneStartPoint1));
pe.setStartPoint2(mapFromScene(d->sceneStartPoint2));
- pe.setPoint1(d->lastPoint1);
- pe.setPoint2(d->lastPoint2);
+ pe.setPoint1(mapFromScene(d->lastPoint1));
+ pe.setPoint2(mapFromScene(d->lastPoint2));
emit pinchFinished(&pe);
d->pinchStartDist = 0;
+ d->pinchActivated = false;
if (d->pinch && d->pinch->target())
d->pinch->setActive(false);
}
return;
}
- if (d->touchPoints.at(0).state() & Qt::TouchPointPressed
- || d->touchPoints.at(1).state() & Qt::TouchPointPressed) {
- d->sceneStartPoint1 = d->touchPoints.at(0).scenePos();
- d->sceneStartPoint2 = d->touchPoints.at(1).scenePos();
+ QTouchEvent::TouchPoint touchPoint1 = d->touchPoints.at(0);
+ QTouchEvent::TouchPoint touchPoint2 = d->touchPoints.at(d->touchPoints. count() >= 2 ? 1 : 0);
+ if (d->touchPoints.count() == 2
+ && (touchPoint1.state() & Qt::TouchPointPressed || touchPoint2.state() & Qt::TouchPointPressed)) {
+ d->id1 = touchPoint1.id();
+ d->sceneStartPoint1 = touchPoint1.scenePos();
+ d->sceneStartPoint2 = touchPoint2.scenePos();
d->inPinch = false;
d->pinchRejected = false;
- } else if (!d->pinchRejected){
- QDeclarativeItem *grabber = scene() ? qobject_cast<QDeclarativeItem*>(scene()->mouseGrabberItem()) : 0;
- if (grabber == this || !grabber || !grabber->keepMouseGrab()) {
- const int dragThreshold = QApplication::startDragDistance();
- QPointF p1 = d->touchPoints.at(0).scenePos();
- QPointF p2 = d->touchPoints.at(1).scenePos();
- qreal dx = p1.x() - p2.x();
- qreal dy = p1.y() - p2.y();
- qreal dist = sqrt(dx*dx + dy*dy);
- QPointF sceneCenter = (p1 + p2)/2;
- qreal angle = QLineF(p1, p2).angle();
- if (angle > 180)
- angle -= 360;
- if (!d->inPinch) {
- if (qAbs(p1.x()-d->sceneStartPoint1.x()) > dragThreshold
- || qAbs(p1.y()-d->sceneStartPoint1.y()) > dragThreshold
- || qAbs(p2.x()-d->sceneStartPoint2.x()) > dragThreshold
- || qAbs(p2.y()-d->sceneStartPoint2.y()) > dragThreshold) {
- d->sceneStartCenter = sceneCenter;
- d->sceneLastCenter = sceneCenter;
- d->pinchStartCenter = mapFromScene(sceneCenter);
- d->pinchStartDist = dist;
- d->pinchStartAngle = angle;
- d->pinchLastScale = 1.0;
- d->pinchLastAngle = angle;
- d->pinchRotation = 0.0;
- d->lastPoint1 = d->touchPoints.at(0).pos();
- d->lastPoint2 = d->touchPoints.at(1).pos();
- QDeclarativePinchEvent pe(d->pinchStartCenter, 1.0, angle, 0.0);
- pe.setStartCenter(d->pinchStartCenter);
- pe.setPreviousCenter(d->pinchStartCenter);
- pe.setPreviousAngle(d->pinchLastAngle);
- pe.setPreviousScale(d->pinchLastScale);
- pe.setStartPoint1(mapFromScene(d->sceneStartPoint1));
- pe.setStartPoint2(mapFromScene(d->sceneStartPoint2));
- pe.setPoint1(d->lastPoint1);
- pe.setPoint2(d->lastPoint2);
- emit pinchStarted(&pe);
- if (pe.accepted()) {
- d->inPinch = true;
- d->stealMouse = true;
- QGraphicsScene *s = scene();
- if (s && s->mouseGrabberItem() != this)
- grabMouse();
- setKeepMouseGrab(true);
- if (d->pinch && d->pinch->target()) {
- d->pinchStartPos = pinch()->target()->pos();
- d->pinchStartScale = d->pinch->target()->scale();
- d->pinchStartRotation = d->pinch->target()->rotation();
- d->pinch->setActive(true);
- }
- } else {
- d->pinchRejected = true;
- }
- }
- } else if (d->pinchStartDist > 0) {
- qreal scale = dist / d->pinchStartDist;
- qreal da = d->pinchLastAngle - angle;
- if (da > 180)
- da -= 360;
- else if (da < -180)
- da += 360;
- d->pinchRotation += da;
- QPointF pinchCenter = mapFromScene(sceneCenter);
- QDeclarativePinchEvent pe(pinchCenter, scale, angle, d->pinchRotation);
+ d->pinchActivated = true;
+ } else if (d->pinchActivated && !d->pinchRejected) {
+ const int dragThreshold = QApplication::startDragDistance();
+ QPointF p1 = touchPoint1.scenePos();
+ QPointF p2 = touchPoint2.scenePos();
+ qreal dx = p1.x() - p2.x();
+ qreal dy = p1.y() - p2.y();
+ qreal dist = sqrt(dx*dx + dy*dy);
+ QPointF sceneCenter = (p1 + p2)/2;
+ qreal angle = QLineF(p1, p2).angle();
+ if (d->touchPoints.count() == 1) {
+ // If we only have one point then just move the center
+ if (d->id1 == touchPoint1.id())
+ sceneCenter = d->sceneLastCenter + touchPoint1.scenePos() - d->lastPoint1;
+ else
+ sceneCenter = d->sceneLastCenter + touchPoint2.scenePos() - d->lastPoint2;
+ angle = d->pinchLastAngle;
+ }
+ d->id1 = touchPoint1.id();
+ if (angle > 180)
+ angle -= 360;
+ if (!d->inPinch) {
+ if (d->touchPoints.count() >= 2
+ && (qAbs(p1.x()-d->sceneStartPoint1.x()) > dragThreshold
+ || qAbs(p1.y()-d->sceneStartPoint1.y()) > dragThreshold
+ || qAbs(p2.x()-d->sceneStartPoint2.x()) > dragThreshold
+ || qAbs(p2.y()-d->sceneStartPoint2.y()) > dragThreshold)) {
+ d->sceneStartCenter = sceneCenter;
+ d->sceneLastCenter = sceneCenter;
+ d->pinchStartCenter = mapFromScene(sceneCenter);
+ d->pinchStartDist = dist;
+ d->pinchStartAngle = angle;
+ d->pinchLastScale = 1.0;
+ d->pinchLastAngle = angle;
+ d->pinchRotation = 0.0;
+ d->lastPoint1 = p1;
+ d->lastPoint2 = p2;
+ QDeclarativePinchEvent pe(d->pinchStartCenter, 1.0, angle, 0.0);
pe.setStartCenter(d->pinchStartCenter);
- pe.setPreviousCenter(mapFromScene(d->sceneLastCenter));
+ pe.setPreviousCenter(d->pinchStartCenter);
pe.setPreviousAngle(d->pinchLastAngle);
pe.setPreviousScale(d->pinchLastScale);
pe.setStartPoint1(mapFromScene(d->sceneStartPoint1));
pe.setStartPoint2(mapFromScene(d->sceneStartPoint2));
- pe.setPoint1(d->touchPoints.at(0).pos());
- pe.setPoint2(d->touchPoints.at(1).pos());
- d->pinchLastScale = scale;
- d->sceneLastCenter = sceneCenter;
- d->pinchLastAngle = angle;
- d->lastPoint1 = d->touchPoints.at(0).pos();
- d->lastPoint2 = d->touchPoints.at(1).pos();
- emit pinchUpdated(&pe);
- if (d->pinch && d->pinch->target()) {
- qreal s = d->pinchStartScale * scale;
- s = qMin(qMax(pinch()->minimumScale(),s), pinch()->maximumScale());
- pinch()->target()->setScale(s);
- QPointF pos = sceneCenter - d->sceneStartCenter + d->pinchStartPos;
- if (pinch()->axis() & QDeclarativePinch::XAxis) {
- qreal x = pos.x();
- if (x < pinch()->xmin())
- x = pinch()->xmin();
- else if (x > pinch()->xmax())
- x = pinch()->xmax();
- pinch()->target()->setX(x);
- }
- if (pinch()->axis() & QDeclarativePinch::YAxis) {
- qreal y = pos.y();
- if (y < pinch()->ymin())
- y = pinch()->ymin();
- else if (y > pinch()->ymax())
- y = pinch()->ymax();
- pinch()->target()->setY(y);
- }
- if (d->pinchStartRotation >= pinch()->minimumRotation()
- && d->pinchStartRotation <= pinch()->maximumRotation()) {
- qreal r = d->pinchRotation + d->pinchStartRotation;
- r = qMin(qMax(pinch()->minimumRotation(),r), pinch()->maximumRotation());
- pinch()->target()->setRotation(r);
+ pe.setPoint1(mapFromScene(d->lastPoint1));
+ pe.setPoint2(mapFromScene(d->lastPoint2));
+ pe.setPointCount(d->touchPoints.count());
+ emit pinchStarted(&pe);
+ if (pe.accepted()) {
+ d->inPinch = true;
+ d->stealMouse = true;
+ QGraphicsScene *s = scene();
+ if (s && s->mouseGrabberItem() != this)
+ grabMouse();
+ setKeepMouseGrab(true);
+ if (d->pinch && d->pinch->target()) {
+ d->pinchStartPos = pinch()->target()->pos();
+ d->pinchStartScale = d->pinch->target()->scale();
+ d->pinchStartRotation = d->pinch->target()->rotation();
+ d->pinch->setActive(true);
}
+ } else {
+ d->pinchRejected = true;
+ }
+ }
+ } else if (d->pinchStartDist > 0) {
+ qreal scale = dist ? dist / d->pinchStartDist : d->pinchLastScale;
+ qreal da = d->pinchLastAngle - angle;
+ if (da > 180)
+ da -= 360;
+ else if (da < -180)
+ da += 360;
+ d->pinchRotation += da;
+ QPointF pinchCenter = mapFromScene(sceneCenter);
+ QDeclarativePinchEvent pe(pinchCenter, scale, angle, d->pinchRotation);
+ pe.setStartCenter(d->pinchStartCenter);
+ pe.setPreviousCenter(mapFromScene(d->sceneLastCenter));
+ pe.setPreviousAngle(d->pinchLastAngle);
+ pe.setPreviousScale(d->pinchLastScale);
+ pe.setStartPoint1(mapFromScene(d->sceneStartPoint1));
+ pe.setStartPoint2(mapFromScene(d->sceneStartPoint2));
+ pe.setPoint1(touchPoint1.pos());
+ pe.setPoint2(touchPoint2.pos());
+ pe.setPointCount(d->touchPoints.count());
+ d->pinchLastScale = scale;
+ d->sceneLastCenter = sceneCenter;
+ d->pinchLastAngle = angle;
+ d->lastPoint1 = touchPoint1.scenePos();
+ d->lastPoint2 = touchPoint2.scenePos();
+ emit pinchUpdated(&pe);
+ if (d->pinch && d->pinch->target()) {
+ qreal s = d->pinchStartScale * scale;
+ s = qMin(qMax(pinch()->minimumScale(),s), pinch()->maximumScale());
+ pinch()->target()->setScale(s);
+ QPointF pos = sceneCenter - d->sceneStartCenter + d->pinchStartPos;
+ if (pinch()->axis() & QDeclarativePinch::XAxis) {
+ qreal x = pos.x();
+ if (x < pinch()->xmin())
+ x = pinch()->xmin();
+ else if (x > pinch()->xmax())
+ x = pinch()->xmax();
+ pinch()->target()->setX(x);
+ }
+ if (pinch()->axis() & QDeclarativePinch::YAxis) {
+ qreal y = pos.y();
+ if (y < pinch()->ymin())
+ y = pinch()->ymin();
+ else if (y > pinch()->ymax())
+ y = pinch()->ymax();
+ pinch()->target()->setY(y);
+ }
+ if (d->pinchStartRotation >= pinch()->minimumRotation()
+ && d->pinchStartRotation <= pinch()->maximumRotation()) {
+ qreal r = d->pinchRotation + d->pinchStartRotation;
+ r = qMin(qMax(pinch()->minimumRotation(),r), pinch()->maximumRotation());
+ pinch()->target()->setRotation(r);
}
}
}
diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p.h
index 6d04708..b5afea9 100644
--- a/src/declarative/graphicsitems/qdeclarativepincharea_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepincharea_p.h
@@ -203,11 +203,13 @@ class Q_AUTOTEST_EXPORT QDeclarativePinchEvent : public QObject
Q_PROPERTY(QPointF startPoint1 READ startPoint1)
Q_PROPERTY(QPointF point2 READ point2)
Q_PROPERTY(QPointF startPoint2 READ startPoint2)
+ Q_PROPERTY(int pointCount READ pointCount)
Q_PROPERTY(bool accepted READ accepted WRITE setAccepted)
public:
QDeclarativePinchEvent(QPointF c, qreal s, qreal a, qreal r)
- : QObject(), m_center(c), m_scale(s), m_angle(a), m_rotation(r), m_accepted(true) {}
+ : QObject(), m_center(c), m_scale(s), m_angle(a), m_rotation(r)
+ , m_pointCount(0), m_accepted(true) {}
QPointF center() const { return m_center; }
QPointF startCenter() const { return m_startCenter; }
@@ -229,6 +231,8 @@ public:
void setPoint2(QPointF p) { m_point2 = p; }
QPointF startPoint2() const { return m_startPoint2; }
void setStartPoint2(QPointF p) { m_startPoint2 = p; }
+ int pointCount() const { return m_pointCount; }
+ void setPointCount(int count) { m_pointCount = count; }
bool accepted() const { return m_accepted; }
void setAccepted(bool a) { m_accepted = a; }
@@ -246,6 +250,7 @@ private:
QPointF m_point2;
QPointF m_startPoint1;
QPointF m_startPoint2;
+ int m_pointCount;
bool m_accepted;
};
diff --git a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h
index cd5cf2a..3264948 100644
--- a/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepincharea_p_p.h
@@ -68,7 +68,8 @@ class QDeclarativePinchAreaPrivate : public QDeclarativeItemPrivate
public:
QDeclarativePinchAreaPrivate()
: absorb(true), stealMouse(false), inPinch(false)
- , pinchRejected(false), pinch(0), pinchStartDist(0), pinchStartScale(1.0)
+ , pinchRejected(false), pinchActivated(false)
+ , pinch(0), pinchStartDist(0), pinchStartScale(1.0)
, pinchLastScale(1.0), pinchStartRotation(0.0), pinchStartAngle(0.0)
, pinchLastAngle(0.0), pinchRotation(0.0)
{
@@ -88,6 +89,7 @@ public:
bool stealMouse : 1;
bool inPinch : 1;
bool pinchRejected : 1;
+ bool pinchActivated : 1;
QDeclarativePinch *pinch;
QPointF sceneStartPoint1;
QPointF sceneStartPoint2;
@@ -105,6 +107,7 @@ public:
QPointF sceneLastCenter;
QPointF pinchStartPos;
QList<QTouchEvent::TouchPoint> touchPoints;
+ int id1;
};
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
index 8a9bdb3..e76fc03 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
@@ -609,6 +609,11 @@ void QDeclarativeRow::setLayoutDirection(Qt::LayoutDirection layoutDirection)
QDeclarativeBasePositionerPrivate *d = static_cast<QDeclarativeBasePositionerPrivate* >(QDeclarativeBasePositionerPrivate::get(this));
if (d->layoutDirection != layoutDirection) {
d->layoutDirection = layoutDirection;
+ // For RTL layout the positioning changes when the width changes.
+ if (d->layoutDirection == Qt::RightToLeft)
+ d->addItemChangeListener(d, QDeclarativeItemPrivate::Geometry);
+ else
+ d->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry);
prePositioning();
emit layoutDirectionChanged();
emit effectiveLayoutDirectionChanged();
@@ -907,6 +912,11 @@ void QDeclarativeGrid::setLayoutDirection(Qt::LayoutDirection layoutDirection)
QDeclarativeBasePositionerPrivate *d = static_cast<QDeclarativeBasePositionerPrivate*>(QDeclarativeBasePositionerPrivate::get(this));
if (d->layoutDirection != layoutDirection) {
d->layoutDirection = layoutDirection;
+ // For RTL layout the positioning changes when the width changes.
+ if (d->layoutDirection == Qt::RightToLeft)
+ d->addItemChangeListener(d, QDeclarativeItemPrivate::Geometry);
+ else
+ d->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry);
prePositioning();
emit layoutDirectionChanged();
emit effectiveLayoutDirectionChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index af18c90..e1c2107 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -555,8 +555,10 @@ QRect QDeclarativeTextInput::cursorRectangle() const
{
Q_D(const QDeclarativeTextInput);
QRect r = d->control->cursorRect();
- r.setHeight(r.height()-1); // Make consistent with TextEdit (QLineControl inexplicably adds 1)
- r.moveLeft(r.x() - d->hscroll);
+ // Scroll and make consistent with TextEdit
+ // QLineControl inexplicably adds 1 to the height and horizontal padding
+ // for unicode direction markers.
+ r.adjust(5 - d->hscroll, 0, -4 - d->hscroll, -1);
return r;
}
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp
index 5190eab..9221d78 100644
--- a/src/declarative/util/qdeclarativepixmapcache.cpp
+++ b/src/declarative/util/qdeclarativepixmapcache.cpp
@@ -426,7 +426,8 @@ void QDeclarativePixmapReader::processJobs()
replies.remove(reply);
reply->close();
}
- delete job;
+ // deleteLater, since not owned by this thread
+ job->deleteLater();
}
cancelled.clear();
}
diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp
index 06df788..513c41f 100644
--- a/src/gui/graphicsview/qgraphicstransform.cpp
+++ b/src/gui/graphicsview/qgraphicstransform.cpp
@@ -92,6 +92,7 @@
#include "qgraphicstransform_p.h"
#include <QDebug>
#include <QtCore/qmath.h>
+#include <QtCore/qnumeric.h>
#ifndef QT_NO_GRAPHICSVIEW
QT_BEGIN_NAMESPACE
@@ -467,6 +468,7 @@ void QGraphicsRotation::setOrigin(const QVector3D &point)
item will be rotated counter-clockwise. Normally the rotation angle will be
in the range (-360, 360), but you can also provide numbers outside of this
range (e.g., a angle of 370 degrees gives the same result as 10 degrees).
+ Setting the angle to NaN results in no rotation.
\sa origin
*/
@@ -570,7 +572,7 @@ void QGraphicsRotation::applyTo(QMatrix4x4 *matrix) const
{
Q_D(const QGraphicsRotation);
- if (d->angle == 0. || d->axis.isNull())
+ if (d->angle == 0. || d->axis.isNull() || qIsNaN(d->angle))
return;
matrix->translate(d->origin);
diff --git a/src/gui/graphicsview/qgraphicsview.cpp b/src/gui/graphicsview/qgraphicsview.cpp
index 2b129d7..16268a8 100644
--- a/src/gui/graphicsview/qgraphicsview.cpp
+++ b/src/gui/graphicsview/qgraphicsview.cpp
@@ -2498,7 +2498,7 @@ QVariant QGraphicsView::inputMethodQuery(Qt::InputMethodQuery query) const
else if (value.type() == QVariant::PointF)
value = mapFromScene(value.toPointF());
else if (value.type() == QVariant::Rect)
- value = mapFromScene(value.toRect()).boundingRect();
+ value = d->mapRectFromScene(value.toRect()).toRect();
else if (value.type() == QVariant::Point)
value = mapFromScene(value.toPoint());
return value;
diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
index 9e090d2..c5a3d14 100644
--- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
+++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp
@@ -91,6 +91,7 @@ private slots:
void sourceSize_QTBUG_14303();
void sourceSize_QTBUG_16389();
void nullPixmapPaint();
+ void resetSourceSize();
void testQtQuick11Attributes();
void testQtQuick11Attributes_data();
@@ -693,6 +694,27 @@ void tst_qdeclarativeimage::nullPixmapPaint()
delete image;
}
+void tst_qdeclarativeimage::resetSourceSize()
+{
+ QString src = QUrl::fromLocalFile(SRCDIR "/data/heart200.png").toString();
+ QString componentStr = "import QtQuick 1.1\nImage { function reset() { sourceSize = undefined }\nsource: \"" + src + "\"; sourceSize: Qt.size(100,100) }";
+
+ QDeclarativeComponent component(&engine);
+ component.setData(componentStr.toLatin1(), QUrl::fromLocalFile(""));
+ QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create());
+ QVERIFY(obj != 0);
+ QCOMPARE(obj->pixmap().width(), 100);
+ QCOMPARE(obj->pixmap().height(), 100);
+ QCOMPARE(obj->sourceSize().height(), 100);
+ QCOMPARE(obj->sourceSize().width(), 100);
+
+ QMetaObject::invokeMethod(obj, "reset");
+ QCOMPARE(obj->pixmap().width(), 200);
+ QCOMPARE(obj->pixmap().height(), 200);
+ QCOMPARE(obj->sourceSize().height(), 200);
+ QCOMPARE(obj->sourceSize().width(), 200);
+}
+
void tst_qdeclarativeimage::testQtQuick11Attributes()
{
QFETCH(QString, code);
diff --git a/tests/auto/declarative/qdeclarativepincharea/data/flickresize.qml b/tests/auto/declarative/qdeclarativepincharea/data/flickresize.qml
new file mode 100644
index 0000000..2da58fc
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativepincharea/data/flickresize.qml
@@ -0,0 +1,50 @@
+import QtQuick 1.1
+
+Flickable {
+ id: flick
+ property real scale: 1.0
+ width: 640
+ height: 360
+ contentWidth: 500
+ contentHeight: 500
+
+ PinchArea {
+ objectName: "pincharea"
+ width: Math.max(flick.contentWidth, flick.width)
+ height: Math.max(flick.contentHeight, flick.height)
+
+ property real initialWidth
+ property real initialHeight
+ onPinchStarted: {
+ initialWidth = flick.contentWidth
+ initialHeight = flick.contentHeight
+ }
+
+ onPinchUpdated: {
+ // adjust content pos due to drag
+ flick.contentX += pinch.previousCenter.x - pinch.center.x
+ flick.contentY += pinch.previousCenter.y - pinch.center.y
+
+ // resize content
+ flick.resizeContent(initialWidth * pinch.scale, initialHeight * pinch.scale, pinch.center)
+ flick.scale = pinch.scale
+ }
+
+ onPinchFinished: {
+ // Move its content within bounds.
+ flick.returnToBounds()
+ }
+
+ Rectangle {
+ width: flick.contentWidth
+ height: flick.contentHeight
+ color: "white"
+ Rectangle {
+ anchors.centerIn: parent
+ width: parent.width-40
+ height: parent.height-40
+ color: "blue"
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
index f175033..90506ba 100644
--- a/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
+++ b/tests/auto/declarative/qdeclarativepincharea/tst_qdeclarativepincharea.cpp
@@ -43,6 +43,7 @@
#include <QtTest/QSignalSpy>
#include <private/qdeclarativepincharea_p.h>
#include <private/qdeclarativerectangle_p.h>
+#include <private/qdeclarativeflickable_p.h>
#include <QtDeclarative/qdeclarativeview.h>
#include <QtDeclarative/qdeclarativecontext.h>
@@ -58,6 +59,7 @@ private slots:
void pinchProperties();
void scale();
void pan();
+ void flickable();
private:
QDeclarativeView *createView();
@@ -301,6 +303,77 @@ void tst_QDeclarativePinchArea::pan()
delete canvas;
}
+void tst_QDeclarativePinchArea::flickable()
+{
+ QDeclarativeView *canvas = createView();
+ canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/flickresize.qml"));
+ canvas->show();
+ canvas->setFocus();
+ QTest::qWaitForWindowShown(canvas);
+ QVERIFY(canvas->rootObject() != 0);
+ qApp->processEvents();
+
+ QDeclarativePinchArea *pinchArea = canvas->rootObject()->findChild<QDeclarativePinchArea*>("pincharea");
+ QDeclarativePinch *pinch = pinchArea->pinch();
+ QVERIFY(pinchArea != 0);
+ QVERIFY(pinch != 0);
+
+ QDeclarativeFlickable *root = qobject_cast<QDeclarativeFlickable*>(canvas->rootObject());
+ QVERIFY(root != 0);
+
+ QWidget *vp = canvas->viewport();
+
+ QPoint p1(110, 80);
+ QPoint p2(100, 100);
+
+ // begin by moving one touch point (mouse)
+ QTest::mousePress(vp, Qt::LeftButton, 0, canvas->mapFromScene(p1));
+ QTest::touchEvent(vp).press(0, p1);
+ {
+ p1 -= QPoint(10,10);
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(p1), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(canvas->viewport(), &mv);
+ QTest::touchEvent(vp).move(0, p1);
+ }
+ {
+ p1 -= QPoint(10,10);
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(p1), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(vp, &mv);
+ QTest::touchEvent(vp).move(0, p1);
+ }
+ {
+ p1 -= QPoint(10,10);
+ QMouseEvent mv(QEvent::MouseMove, canvas->mapFromScene(p1), Qt::LeftButton, Qt::LeftButton,Qt::NoModifier);
+ QApplication::sendEvent(vp, &mv);
+ QTest::touchEvent(vp).move(0, p1);
+ }
+
+ // Flickable has reacted to the gesture
+ QVERIFY(root->isMoving());
+ QVERIFY(root->property("scale").toReal() == 1.0);
+
+ // add another touch point and continue moving
+ QTest::touchEvent(vp).stationary(0).press(1, p2);
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ QTest::touchEvent(vp).move(0, p1).move(1, p2);
+
+ QCOMPARE(root->property("scale").toReal(), 1.0);
+
+ p1 -= QPoint(10,10);
+ p2 += QPoint(10,10);
+ QTest::touchEvent(vp).move(0, p1).move(1, p2);
+
+ // PinchArea has stolen the gesture.
+ QVERIFY(!root->isMoving());
+ QVERIFY(root->property("scale").toReal() > 1.0);
+
+ QTest::mouseRelease(vp, Qt::LeftButton, 0, canvas->mapFromScene(p1));
+ QTest::touchEvent(vp).release(0, p1).release(1, p2);
+
+ delete canvas;
+}
+
QDeclarativeView *tst_QDeclarativePinchArea::createView()
{
QDeclarativeView *canvas = new QDeclarativeView(0);
diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
index 92ab722..78821cb 100644
--- a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
+++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp
@@ -154,6 +154,15 @@ void tst_QDeclarativePositioners::test_horizontal_rtl()
QCOMPARE(row->width(), 110.0);
QCOMPARE(row->height(), 50.0);
+ // Change the width of the row and check that items stay to the right
+ row->setWidth(200);
+ QCOMPARE(one->x(), 150.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 130.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 90.0);
+ QCOMPARE(three->y(), 0.0);
+
delete canvas;
}
@@ -527,6 +536,19 @@ void tst_QDeclarativePositioners::test_grid_rightToLeft()
QCOMPARE(grid->width(), 100.0);
QCOMPARE(grid->height(), 100.0);
+ // Change the width of the grid and check that items stay to the right
+ grid->setWidth(200);
+ QCOMPARE(one->x(), 150.0);
+ QCOMPARE(one->y(), 0.0);
+ QCOMPARE(two->x(), 130.0);
+ QCOMPARE(two->y(), 0.0);
+ QCOMPARE(three->x(), 100.0);
+ QCOMPARE(three->y(), 0.0);
+ QCOMPARE(four->x(), 150.0);
+ QCOMPARE(four->y(), 50.0);
+ QCOMPARE(five->x(), 140.0);
+ QCOMPARE(five->y(), 50.0);
+
delete canvas;
}
diff --git a/tests/auto/declarative/qdeclarativetextedit/data/CursorRect.qml b/tests/auto/declarative/qdeclarativetextedit/data/CursorRect.qml
new file mode 100644
index 0000000..3af0313
--- /dev/null
+++ b/tests/auto/declarative/qdeclarativetextedit/data/CursorRect.qml
@@ -0,0 +1,8 @@
+import QtQuick 1.0
+
+TextEdit {
+ focus: true
+ objectName: "myEdit"
+ width: 50
+ text: "This is a long piece of text"
+}
diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
index 04ecf91..8f1be6f 100644
--- a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
+++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp
@@ -148,6 +148,7 @@ private slots:
void preeditMicroFocus();
void inputContextMouseHandler();
void inputMethodComposing();
+ void cursorRectangleSize();
private:
void simulateKey(QDeclarativeView *, int key, Qt::KeyboardModifiers modifiers = 0);
@@ -2421,6 +2422,25 @@ void tst_qdeclarativetextedit::inputMethodComposing()
QCOMPARE(spy.count(), 2);
}
+void tst_qdeclarativetextedit::cursorRectangleSize()
+{
+ QDeclarativeView *canvas = createView(SRCDIR "/data/CursorRect.qml");
+ QVERIFY(canvas->rootObject() != 0);
+ canvas->show();
+ canvas->setFocus();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+
+ QDeclarativeTextEdit *textEdit = qobject_cast<QDeclarativeTextEdit *>(canvas->rootObject());
+ QVERIFY(textEdit != 0);
+ textEdit->setFocus(Qt::OtherFocusReason);
+ QRectF cursorRect = textEdit->positionToRectangle(textEdit->cursorPosition());
+ QRectF microFocusFromScene = canvas->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
+ QRectF microFocusFromApp= QApplication::focusWidget()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
+
+ QCOMPARE(microFocusFromScene.size(), cursorRect.size());
+ QCOMPARE(microFocusFromApp.size(), cursorRect.size());
+}
QTEST_MAIN(tst_qdeclarativetextedit)
#include "tst_qdeclarativetextedit.moc"
diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
index a35a2c9..ef32ee3 100644
--- a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
+++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp
@@ -135,6 +135,7 @@ private slots:
void preeditMicroFocus();
void inputContextMouseHandler();
void inputMethodComposing();
+ void cursorRectangleSize();
private:
void simulateKey(QDeclarativeView *, int key);
@@ -1628,12 +1629,11 @@ void tst_qdeclarativetextinput::cursorDelegate()
//Test Delegate gets moved
for(int i=0; i<= textInputObject->text().length(); i++){
textInputObject->setCursorPosition(i);
- //+5 is because the TextInput cursorRectangle is just a 10xHeight area centered on cursor position
- QCOMPARE(textInputObject->cursorRectangle().x() + 5, qRound(delegateObject->x()));
+ QCOMPARE(textInputObject->cursorRectangle().x(), qRound(delegateObject->x()));
QCOMPARE(textInputObject->cursorRectangle().y(), qRound(delegateObject->y()));
}
textInputObject->setCursorPosition(0);
- QCOMPARE(textInputObject->cursorRectangle().x()+5, qRound(delegateObject->x()));
+ QCOMPARE(textInputObject->cursorRectangle().x(), qRound(delegateObject->x()));
QCOMPARE(textInputObject->cursorRectangle().y(), qRound(delegateObject->y()));
//Test Delegate gets deleted
textInputObject->setCursorDelegate(0);
@@ -1722,19 +1722,26 @@ void tst_qdeclarativetextinput::cursorRectangle()
QRect r;
+ // some tolerance for different fonts.
+#ifdef Q_OS_LINUX
+ const int error = 2;
+#else
+ const int error = 5;
+#endif
+
for (int i = 0; i <= 5; ++i) {
input.setCursorPosition(i);
r = input.cursorRectangle();
int textWidth = fm.width(text.mid(0, i));
- QVERIFY(r.left() < textWidth);
- QVERIFY(r.right() > textWidth);
+ QVERIFY(r.left() < textWidth + error);
+ QVERIFY(r.right() > textWidth - error);
QCOMPARE(input.inputMethodQuery(Qt::ImMicroFocus).toRect(), r);
}
// Check the cursor rectangle remains within the input bounding rect when auto scrolling.
QVERIFY(r.left() < input.boundingRect().width());
- QVERIFY(r.right() >= input.width());
+ QVERIFY(r.right() >= input.width() - error);
for (int i = 6; i < text.length(); ++i) {
input.setCursorPosition(i);
@@ -2235,18 +2242,25 @@ void tst_qdeclarativetextinput::preeditAutoScroll()
QCOMPARE(input.positionAt(0), 0);
QCOMPARE(input.positionAt(input.width()), 5);
+ // some tolerance for different fonts.
+#ifdef Q_OS_LINUX
+ const int error = 2;
+#else
+ const int error = 5;
+#endif
+
// test if the preedit is larger than the text input that the
// character preceding the cursor is still visible.
qreal x = input.positionToRectangle(0).x();
for (int i = 0; i < 3; ++i) {
ic.sendPreeditText(preeditText, i + 1);
- QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)));
+ QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)) - error);
QVERIFY(input.positionToRectangle(0).x() < x);
x = input.positionToRectangle(0).x();
}
for (int i = 1; i >= 0; --i) {
ic.sendPreeditText(preeditText, i + 1);
- QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)));
+ QVERIFY(input.cursorRectangle().right() >= fm.width(preeditText.at(i)) - error);
QVERIFY(input.positionToRectangle(0).x() > x);
x = input.positionToRectangle(0).x();
}
@@ -2484,6 +2498,26 @@ void tst_qdeclarativetextinput::inputMethodComposing()
QCOMPARE(spy.count(), 2);
}
+void tst_qdeclarativetextinput::cursorRectangleSize()
+{
+ QDeclarativeView *canvas = createView(SRCDIR "/data/positionAt.qml");
+ QVERIFY(canvas->rootObject() != 0);
+ canvas->show();
+ canvas->setFocus();
+ QApplication::setActiveWindow(canvas);
+ QTest::qWaitForWindowShown(canvas);
+
+ QDeclarativeTextInput *textInput = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject());
+ QVERIFY(textInput != 0);
+ textInput->setFocus(Qt::OtherFocusReason);
+ QRectF cursorRect = textInput->positionToRectangle(textInput->cursorPosition());
+ QRectF microFocusFromScene = canvas->scene()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
+ QRectF microFocusFromApp= QApplication::focusWidget()->inputMethodQuery(Qt::ImMicroFocus).toRectF();
+
+ QCOMPARE(microFocusFromScene.size(), cursorRect.size());
+ QCOMPARE(microFocusFromApp.size(), cursorRect.size());
+}
+
QTEST_MAIN(tst_qdeclarativetextinput)
#include "tst_qdeclarativetextinput.moc"
diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
index 9434a0b..903d7e7 100644
--- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
+++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp
@@ -225,6 +225,10 @@ void tst_QGraphicsTransform::rotation()
rotation.setAngle(90);
QCOMPARE(transform2D(rotation).map(QPointF(10, 10)), QPointF(10, 10));
QCOMPARE(transform2D(rotation).map(QPointF(20, 10)), QPointF(10, 20));
+
+ rotation.setOrigin(QVector3D(0, 0, 0));
+ rotation.setAngle(qQNaN());
+ QCOMPARE(transform2D(rotation).map(QPointF(20, 10)), QPointF(20, 10));
}
Q_DECLARE_METATYPE(Qt::Axis);