aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-03-14 09:30:12 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-03-14 09:30:12 +0100
commit11484c7f64b5942994a1d1a07f4e7f4d86e94e83 (patch)
treef0c901d1d15d0bcb8ce572a04b094e510cd86ddd /src/quick
parenta1a7679028eda395d74cd1247a8c3ed46ac3bef1 (diff)
parentb58953fae3dc80c52e846d2d87856dd20b8986ab (diff)
Merge remote-tracking branch 'origin/stable' into dev
Conflicts: tests/auto/qml/debugger/qv8profilerservice/qv8profilerservice.pro Change-Id: I2fd99ed8bd03302b9bbf31e6f21990f6455c4f1c
Diffstat (limited to 'src/quick')
-rw-r--r--src/quick/items/qquickflickable.cpp19
-rw-r--r--src/quick/items/qquickgridview.cpp2
-rw-r--r--src/quick/items/qquickloader.cpp61
-rw-r--r--src/quick/items/qquicktextedit.cpp2
-rw-r--r--src/quick/scenegraph/coreapi/qsggeometry.h2
-rw-r--r--src/quick/scenegraph/coreapi/qsgmaterial.h2
-rw-r--r--src/quick/scenegraph/qsgdefaultglyphnode_p.cpp2
-rw-r--r--src/quick/scenegraph/util/qsgflatcolormaterial.h2
-rw-r--r--src/quick/scenegraph/util/qsgtexture.h4
-rw-r--r--src/quick/util/qquicksmoothedanimation.cpp4
10 files changed, 56 insertions, 44 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 3482db0dfe..9346c79847 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -1014,6 +1014,12 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
bool prevHMoved = hMoved;
bool prevVMoved = vMoved;
+ bool moveY = false;
+ bool moveX = false;
+
+ qreal newY = 0;
+ qreal newX = 0;
+
qint64 elapsedSincePress = computeCurrentTime(event) - lastPressTime;
if (q->yflick()) {
qreal dy = event->localPos().y() - pressPos.y();
@@ -1021,7 +1027,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
if (vData.dragStartOffset == 0)
vData.dragStartOffset = dy;
if (overThreshold || elapsedSincePress > 200) {
- qreal newY = dy + vData.pressPos - vData.dragStartOffset;
+ newY = dy + vData.pressPos - vData.dragStartOffset;
// Recalculate bounds in case margins have changed, but use the content
// size estimate taken at the start of the drag in case the drag causes
// the estimate to be altered
@@ -1041,8 +1047,8 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
}
if (!rejectY && stealMouse && dy != 0.0) {
clearTimeline();
- vData.move.setValue(newY);
vMoved = true;
+ moveY = true;
}
if (!rejectY && overThreshold)
stealY = true;
@@ -1055,7 +1061,7 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
if (hData.dragStartOffset == 0)
hData.dragStartOffset = dx;
if (overThreshold || elapsedSincePress > 200) {
- qreal newX = dx + hData.pressPos - hData.dragStartOffset;
+ newX = dx + hData.pressPos - hData.dragStartOffset;
const qreal minX = hData.dragMinBound + hData.startMargin;
const qreal maxX = hData.dragMaxBound - hData.endMargin;
if (newX > minX)
@@ -1073,8 +1079,8 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
if (!rejectX && stealMouse && dx != 0.0) {
clearTimeline();
- hData.move.setValue(newX);
hMoved = true;
+ moveX = true;
}
if (!rejectX && overThreshold)
@@ -1102,6 +1108,11 @@ void QQuickFlickablePrivate::handleMouseMoveEvent(QMouseEvent *event)
q->movementStarting();
}
+ if (moveY)
+ vData.move.setValue(newY);
+ if (moveX)
+ hData.move.setValue(newX);
+
qint64 currentTimestamp = computeCurrentTime(event);
qreal elapsed = qreal(currentTimestamp - (lastPos.isNull() ? lastPressTime : lastPosTime)) / 1000.;
if (elapsed <= 0)
diff --git a/src/quick/items/qquickgridview.cpp b/src/quick/items/qquickgridview.cpp
index ea8badb584..e40d21b498 100644
--- a/src/quick/items/qquickgridview.cpp
+++ b/src/quick/items/qquickgridview.cpp
@@ -463,7 +463,7 @@ void QQuickGridViewPrivate::resetColumns()
{
Q_Q(QQuickGridView);
qreal length = flow == QQuickGridView::FlowLeftToRight ? q->width() : q->height();
- columns = (int)qMax((length + colSize()/2) / colSize(), qreal(1.));
+ columns = qMax(1, qFloor(length / colSize()));
}
FxViewItem *QQuickGridViewPrivate::newViewItem(int modelIndex, QQuickItem *item)
diff --git a/src/quick/items/qquickloader.cpp b/src/quick/items/qquickloader.cpp
index 61f9a27d3b..0434c2af41 100644
--- a/src/quick/items/qquickloader.cpp
+++ b/src/quick/items/qquickloader.cpp
@@ -335,41 +335,42 @@ bool QQuickLoader::active() const
void QQuickLoader::setActive(bool newVal)
{
Q_D(QQuickLoader);
- if (d->active != newVal) {
- d->active = newVal;
- if (newVal == true) {
- if (d->loadingFromSource) {
- loadFromSource();
- } else {
- loadFromSourceComponent();
- }
+ if (d->active == newVal)
+ return;
+
+ d->active = newVal;
+ if (newVal == true) {
+ if (d->loadingFromSource) {
+ loadFromSource();
} else {
- // cancel any current incubation
- if (d->incubator) {
- d->incubator->clear();
- delete d->itemContext;
- d->itemContext = 0;
- }
+ loadFromSourceComponent();
+ }
+ } else {
+ // cancel any current incubation
+ if (d->incubator) {
+ d->incubator->clear();
+ delete d->itemContext;
+ d->itemContext = 0;
+ }
- if (d->item) {
- QQuickItemPrivate *p = QQuickItemPrivate::get(d->item);
- p->removeItemChangeListener(d, watchedChanges);
+ if (d->item) {
+ QQuickItemPrivate *p = QQuickItemPrivate::get(d->item);
+ p->removeItemChangeListener(d, watchedChanges);
- // We can't delete immediately because our item may have triggered
- // the Loader to load a different item.
- d->item->setParentItem(0);
- d->item->setVisible(false);
- d->item = 0;
- }
- if (d->object) {
- d->object->deleteLater();
- d->object = 0;
- emit itemChanged();
- }
- emit statusChanged();
+ // We can't delete immediately because our item may have triggered
+ // the Loader to load a different item.
+ d->item->setParentItem(0);
+ d->item->setVisible(false);
+ d->item = 0;
+ }
+ if (d->object) {
+ d->object->deleteLater();
+ d->object = 0;
+ emit itemChanged();
}
- emit activeChanged();
+ emit statusChanged();
}
+ emit activeChanged();
}
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 0fe5458c34..dabbc96614 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -1097,7 +1097,7 @@ void QQuickTextEdit::setFocusOnPress(bool on)
\qmlproperty bool QtQuick2::TextEdit::persistentSelection
Whether the TextEdit should keep the selection visible when it loses active focus to another
- item in the scene. By default this is set to true;
+ item in the scene. By default this is set to false.
*/
bool QQuickTextEdit::persistentSelection() const
{
diff --git a/src/quick/scenegraph/coreapi/qsggeometry.h b/src/quick/scenegraph/coreapi/qsggeometry.h
index 679b773fc8..78ad03e411 100644
--- a/src/quick/scenegraph/coreapi/qsggeometry.h
+++ b/src/quick/scenegraph/coreapi/qsggeometry.h
@@ -44,7 +44,7 @@
#include <QtQuick/qtquickglobal.h>
#include <QtGui/qopengl.h>
-#include <QRectF>
+#include <QtCore/QRectF>
QT_BEGIN_NAMESPACE
diff --git a/src/quick/scenegraph/coreapi/qsgmaterial.h b/src/quick/scenegraph/coreapi/qsgmaterial.h
index 238bf83111..38862e694d 100644
--- a/src/quick/scenegraph/coreapi/qsgmaterial.h
+++ b/src/quick/scenegraph/coreapi/qsgmaterial.h
@@ -43,7 +43,7 @@
#define QSGMATERIAL_H
#include <QtQuick/qtquickglobal.h>
-#include <qopenglshaderprogram.h>
+#include <QtGui/qopenglshaderprogram.h>
QT_BEGIN_NAMESPACE
diff --git a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
index b65686e628..9e0cfca069 100644
--- a/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
+++ b/src/quick/scenegraph/qsgdefaultglyphnode_p.cpp
@@ -96,7 +96,7 @@ const char *QSGTextMaskMaterialData::fragmentShader() const {
"uniform sampler2D texture; \n"
"uniform lowp vec4 color; \n"
"void main() { \n"
- " gl_FragColor = vec4(texture2D(texture, sampleCoord).rgb, 1.0); \n"
+ " gl_FragColor = vec4(texture2D(texture, sampleCoord).rgb * color.a, 1.0); \n"
"}";
}
diff --git a/src/quick/scenegraph/util/qsgflatcolormaterial.h b/src/quick/scenegraph/util/qsgflatcolormaterial.h
index f0a3a3741d..12a37f2ae2 100644
--- a/src/quick/scenegraph/util/qsgflatcolormaterial.h
+++ b/src/quick/scenegraph/util/qsgflatcolormaterial.h
@@ -43,7 +43,7 @@
#define QSGFLATCOLORMATERIAL_H
#include <QtQuick/qsgmaterial.h>
-#include <qcolor.h>
+#include <QtGui/qcolor.h>
QT_BEGIN_NAMESPACE
diff --git a/src/quick/scenegraph/util/qsgtexture.h b/src/quick/scenegraph/util/qsgtexture.h
index ace29cd9a0..299ffc27e8 100644
--- a/src/quick/scenegraph/util/qsgtexture.h
+++ b/src/quick/scenegraph/util/qsgtexture.h
@@ -43,8 +43,8 @@
#define QSGTEXTURE_H
#include <QtQuick/qtquickglobal.h>
-#include <QObject>
-#include <QImage>
+#include <QtCore/QObject>
+#include <QtGui/QImage>
QT_BEGIN_NAMESPACE
diff --git a/src/quick/util/qquicksmoothedanimation.cpp b/src/quick/util/qquicksmoothedanimation.cpp
index 021ff75f03..9dd9aa2e6d 100644
--- a/src/quick/util/qquicksmoothedanimation.cpp
+++ b/src/quick/util/qquicksmoothedanimation.cpp
@@ -153,10 +153,10 @@ bool QSmoothedAnimation::recalc()
s = (invert? -1.0: 1.0) * s;
- if (userDuration > 0 && velocity > 0) {
+ if (userDuration >= 0 && velocity > 0) {
tf = s / velocity;
if (tf > (userDuration / 1000.)) tf = (userDuration / 1000.);
- } else if (userDuration > 0) {
+ } else if (userDuration >= 0) {
tf = userDuration / 1000.;
} else if (velocity > 0) {
tf = s / velocity;