Merge branch 'qtquick2' of scm.dev.nokia.troll.no:qt/qtdeclarative-staging into qtquick2

This commit is contained in:
Alan Alpert 2011-05-05 11:29:03 +10:00
commit 5f46c8e70f
51 changed files with 889 additions and 614 deletions

1
.gitattributes vendored Normal file
View File

@ -0,0 +1 @@
.tag ident

1
.tag Normal file
View File

@ -0,0 +1 @@
$Id$

View File

@ -29,6 +29,12 @@
\title What's new in Qt Quick
\page qtquick-whatsnew.html
\section1 Qt 5.0.0 includes QtQuick 2.0
QtQuick 2.0 is a major update.
MouseArea now propagates clicked, doubleClicked and pressAndHold differently.
\section1 Qt 4.7.4 includes QtQuick 1.1
QtQuick 1.1 is a minor feature update. \e {import QtQuick 1.1} to use the new features.

View File

@ -47,6 +47,11 @@ class MyPaintItem : public QSGPaintedItem
{
Q_OBJECT
public:
MyPaintItem() : QSGPaintedItem()
{
setAntialiasing(true);
}
virtual void paint(QPainter *p)
{
QRectF rect(0, 0, width(), height());

View File

@ -1,12 +1,12 @@
QT_DECLARATIVE_VERSION = $$QT_VERSION
QT_DECLARATIVE_MAJOR_VERSION = $$QT_MAJOR_VERSION
QT_DECLARATIVE_MINOR_VERSION = $$QT_MINOR_VERSION
QT_DECLARATIVE_PATCH_VERSION = $$QT_PATCH_VERSION
QT.declarative.VERSION = 4.8.0
QT.declarative.MAJOR_VERSION = 4
QT.declarative.MINOR_VERSION = 8
QT.declarative.PATCH_VERSION = 0
QT.declarative.name = QtDeclarative
QT.declarative.bins = $$QT_MODULE_BIN_BASE
QT.declarative.includes = $$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/QtDeclarative
QT.declarative.private_includes = $$QT_MODULE_INCLUDE_BASE/QtDeclarative/private
QT.declarative.private_includes = $$QT_MODULE_INCLUDE_BASE/QtDeclarative/$$QT.declarative.VERSION
QT.declarative.sources = $$QT_MODULE_BASE/src/declarative
QT.declarative.libs = $$QT_MODULE_LIB_BASE
QT.declarative.plugins = $$QT_MODULE_PLUGIN_BASE

View File

@ -2,7 +2,11 @@ load(qt_module)
TARGET = QtDeclarative
QPRO_PWD = $$PWD
QT = core gui script network
CONFIG += module
MODULE_PRI += ../../modules/qt_declarative.pri
QT = core-private gui-private script-private network script opengl-private
contains(QT_CONFIG, svg): QT += svg
DEFINES += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING
win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000

View File

@ -48,6 +48,8 @@
#include <private/qsgrenderer_p.h>
#include <private/qsgflashnode_p.h>
#include <private/qabstractanimation_p.h>
#include <QtGui/qpainter.h>
#include <QtGui/qgraphicssceneevent.h>
#include <QtGui/qmatrix4x4.h>
@ -60,6 +62,7 @@
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(qmlThreadedRenderer, QML_THREADED_RENDERER)
DEFINE_BOOL_CONFIG_OPTION(qmlFixedAnimationStep, QML_FIXED_ANIMATION_STEP)
/*
Focus behavior
@ -332,8 +335,8 @@ void QSGCanvasPrivate::renderSceneGraph()
#ifdef FRAME_TIMING
int pixel;
glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
// int pixel;
// glReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &pixel);
readbackTime = frameTimer.elapsed();
#endif
@ -477,6 +480,8 @@ QSGCanvasPrivate::~QSGCanvasPrivate()
void QSGCanvasPrivate::init(QSGCanvas *c)
{
QUnifiedTimer::instance(true)->setConsistentTiming(qmlFixedAnimationStep());
q_ptr = c;
Q_Q(QSGCanvas);

View File

@ -1,4 +1,4 @@
// Commit: ee767e8c16742316068e83323374ea54f2b939cb
// Commit: d4fa1878ff1e7628d3e984d54f8a93810353c71b
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -48,9 +48,41 @@
#include <QtDeclarative/qdeclarativeinfo.h>
#include <QtGui/qgraphicssceneevent.h>
#include <QtGui/qapplication.h>
#include "qplatformdefs.h"
QT_BEGIN_NAMESPACE
// The maximum number of pixels a flick can overshoot
#ifndef QML_FLICK_OVERSHOOT
#define QML_FLICK_OVERSHOOT 200
#endif
// The number of samples to use in calculating the velocity of a flick
#ifndef QML_FLICK_SAMPLEBUFFER
#define QML_FLICK_SAMPLEBUFFER 3
#endif
// The number of samples to discard when calculating the flick velocity.
// Touch panels often produce inaccurate results as the finger is lifted.
#ifndef QML_FLICK_DISCARDSAMPLES
#define QML_FLICK_DISCARDSAMPLES 1
#endif
// The default maximum velocity of a flick.
#ifndef QML_FLICK_DEFAULTMAXVELOCITY
#define QML_FLICK_DEFAULTMAXVELOCITY 2500
#endif
// The default deceleration of a flick.
#ifndef QML_FLICK_DEFAULTDECELERATION
#define QML_FLICK_DEFAULTDECELERATION 1500
#endif
// How much faster to decelerate when overshooting
#ifndef QML_FLICK_OVERSHOOTFRICTION
#define QML_FLICK_OVERSHOOTFRICTION 8
#endif
// FlickThreshold determines how far the "mouse" must have moved
// before we perform a flick.
static const int FlickThreshold = 20;
@ -137,14 +169,15 @@ void QSGFlickableVisibleArea::updateVisible()
QSGFlickablePrivate::QSGFlickablePrivate()
: contentItem(new QSGItem)
, hData(this, &QSGFlickablePrivate::setRoundedViewportX)
, vData(this, &QSGFlickablePrivate::setRoundedViewportY)
, hData(this, &QSGFlickablePrivate::setViewportX)
, vData(this, &QSGFlickablePrivate::setViewportY)
, flickingHorizontally(false), flickingVertically(false)
, hMoved(false), vMoved(false)
, movingHorizontally(false), movingVertically(false)
, stealMouse(false), pressed(false), interactive(true), calcVelocity(false)
, deceleration(500), maxVelocity(2000), reportedVelocitySmoothing(100)
, delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(600)
, deceleration(QML_FLICK_DEFAULTDECELERATION)
, maxVelocity(QML_FLICK_DEFAULTMAXVELOCITY), reportedVelocitySmoothing(100)
, delayedPressEvent(0), delayedPressTarget(0), pressDelay(0), fixupDuration(400)
, fixupMode(Normal), vTime(0), visibleArea(0)
, flickableDirection(QSGFlickable::AutoFlickDirection)
, boundsBehavior(QSGFlickable::DragAndOvershootBounds)
@ -181,16 +214,36 @@ void QSGFlickablePrivate::init()
Returns the amount to overshoot by given a velocity.
Will be roughly in range 0 - size/4
*/
qreal QSGFlickablePrivate::overShootDistance(qreal velocity, qreal size)
qreal QSGFlickablePrivate::overShootDistance(qreal size)
{
if (maxVelocity <= 0)
return 0.0;
velocity = qAbs(velocity);
if (velocity > maxVelocity)
velocity = maxVelocity;
qreal dist = size / 4 * velocity / maxVelocity;
return dist;
return qMin(qreal(QML_FLICK_OVERSHOOT), size/3);
}
void QSGFlickablePrivate::AxisData::addVelocitySample(qreal v, qreal maxVelocity)
{
if (v > maxVelocity)
v = maxVelocity;
else if (v < -maxVelocity)
v = -maxVelocity;
velocityBuffer.append(v);
if (velocityBuffer.count() > QML_FLICK_SAMPLEBUFFER)
velocityBuffer.remove(0);
}
void QSGFlickablePrivate::AxisData::updateVelocity()
{
if (velocityBuffer.count() > QML_FLICK_DISCARDSAMPLES) {
velocity = 0;
int count = velocityBuffer.count()-QML_FLICK_DISCARDSAMPLES;
for (int i = 0; i < count; ++i) {
qreal v = velocityBuffer.at(i);
velocity += v;
}
velocity /= count;
}
}
void QSGFlickablePrivate::itemGeometryChanged(QSGItem *item, const QRectF &newGeom, const QRectF &oldGeom)
@ -216,21 +269,18 @@ void QSGFlickablePrivate::flickY(qreal velocity)
flick(vData, q->minYExtent(), q->maxYExtent(), q->height(), fixupY_callback, velocity);
}
void QSGFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent, qreal vSize,
void QSGFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent, qreal,
QDeclarativeTimeLineCallback::Callback fixupCallback, qreal velocity)
{
Q_Q(QSGFlickable);
qreal maxDistance = -1;
data.fixingUp = false;
bool overShoot = boundsBehavior == QSGFlickable::DragAndOvershootBounds;
// -ve velocity means list is moving up
if (velocity > 0) {
if (data.move.value() < minExtent)
maxDistance = qAbs(minExtent - data.move.value() + (overShoot?overShootDistance(velocity,vSize):0));
maxDistance = qAbs(minExtent - data.move.value());
data.flickTarget = minExtent;
} else {
if (data.move.value() > maxExtent)
maxDistance = qAbs(maxExtent - data.move.value()) + (overShoot?overShootDistance(velocity,vSize):0);
maxDistance = qAbs(maxExtent - data.move.value());
data.flickTarget = maxExtent;
}
if (maxDistance > 0) {
@ -242,6 +292,9 @@ void QSGFlickablePrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent
v = maxVelocity;
}
timeline.reset(data.move);
if (boundsBehavior == QSGFlickable::DragAndOvershootBounds)
timeline.accel(data.move, v, deceleration);
else
timeline.accel(data.move, v, deceleration, maxDistance);
timeline.callback(QDeclarativeTimeLineCallback(&data.move, fixupCallback, this));
if (!flickingHorizontally && q->xflick()) {
@ -329,6 +382,7 @@ void QSGFlickablePrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent
}
}
}
data.inOvershoot = false;
fixupMode = Normal;
vTime = timeline.time();
}
@ -537,16 +591,13 @@ void QSGFlickablePrivate::handleMousePressEvent(QGraphicsSceneMouseEvent *event)
q->setKeepMouseGrab(stealMouse);
pressed = true;
timeline.clear();
hData.velocity = 0;
vData.velocity = 0;
hData.dragStartOffset = 0;
vData.dragStartOffset = 0;
hData.reset();
vData.reset();
hData.dragMinBound = q->minXExtent();
vData.dragMinBound = q->minYExtent();
hData.dragMaxBound = q->maxXExtent();
vData.dragMaxBound = q->maxYExtent();
hData.fixingUp = false;
vData.fixingUp = false;
fixupMode = Normal;
lastPos = QPoint();
QSGItemPrivate::start(lastPosTime);
pressPos = event->pos();
@ -638,33 +689,33 @@ void QSGFlickablePrivate::handleMouseMoveEvent(QGraphicsSceneMouseEvent *event)
if (stealMouse)
q->setKeepMouseGrab(true);
if (!lastPos.isNull()) {
qreal elapsed = qreal(QSGItemPrivate::restart(lastPosTime)) / 1000.;
if (elapsed <= 0)
elapsed = 1;
if (q->yflick()) {
qreal diff = event->pos().y() - lastPos.y();
// average to reduce the effect of spurious moves
vData.velocity += diff / elapsed;
vData.velocity /= 2;
if (rejectY) {
vData.velocityBuffer.clear();
vData.velocity = 0;
}
if (q->xflick()) {
qreal diff = event->pos().x() - lastPos.x();
// average to reduce the effect of spurious moves
hData.velocity += diff / elapsed;
hData.velocity /= 2;
if (rejectX) {
hData.velocityBuffer.clear();
hData.velocity = 0;
}
}
if (rejectY) vData.velocity = 0;
if (rejectX) hData.velocity = 0;
if (hMoved || vMoved) {
q->movementStarting();
q->viewportMoved();
}
if (!lastPos.isNull()) {
qreal elapsed = qreal(QSGItemPrivate::elapsed(lastPosTime)) / 1000.;
if (elapsed <= 0)
return;
QSGItemPrivate::restart(lastPosTime);
qreal dy = event->pos().y()-lastPos.y();
if (q->yflick() && !rejectY)
vData.addVelocitySample(dy/elapsed, maxVelocity);
qreal dx = event->pos().x()-lastPos.x();
if (q->xflick() && !rejectX)
hData.addVelocitySample(dx/elapsed, maxVelocity);
}
lastPos = event->pos();
}
@ -677,25 +728,33 @@ void QSGFlickablePrivate::handleMouseReleaseEvent(QGraphicsSceneMouseEvent *even
if (!lastPosTime.isValid())
return;
if (QSGItemPrivate::elapsed(lastPosTime) > 100) {
// if we drag then pause before release we should not cause a flick.
if (QSGItemPrivate::elapsed(lastPosTime) < 100) {
vData.updateVelocity();
hData.updateVelocity();
} else {
hData.velocity = 0.0;
vData.velocity = 0.0;
}
vTime = timeline.time();
if (qAbs(vData.velocity) > MinimumFlickVelocity && qAbs(event->pos().y() - pressPos.y()) > FlickThreshold)
flickY(vData.velocity);
qreal velocity = vData.velocity;
if (vData.atBeginning || vData.atEnd)
velocity /= 2;
if (qAbs(velocity) > MinimumFlickVelocity && qAbs(event->pos().y() - pressPos.y()) > FlickThreshold)
flickY(velocity);
else
fixupY();
if (qAbs(hData.velocity) > MinimumFlickVelocity && qAbs(event->pos().x() - pressPos.x()) > FlickThreshold)
flickX(hData.velocity);
velocity = hData.velocity;
if (hData.atBeginning || hData.atEnd)
velocity /= 2;
if (qAbs(velocity) > MinimumFlickVelocity && qAbs(event->pos().x() - pressPos.x()) > FlickThreshold)
flickX(velocity);
else
fixupX();
lastPosTime.invalidate();
if (!timeline.isActive())
q->movementEnding();
}
@ -742,10 +801,15 @@ void QSGFlickable::wheelEvent(QGraphicsSceneWheelEvent *event)
if (!d->interactive) {
QSGItem::wheelEvent(event);
} else if (yflick() && event->orientation() == Qt::Vertical) {
if (event->delta() > 0)
d->vData.velocity = qMax(event->delta() - d->vData.smoothVelocity.value(), qreal(250.0));
else
d->vData.velocity = qMin(event->delta() - d->vData.smoothVelocity.value(), qreal(-250.0));
bool valid = false;
if (event->delta() > 0 && contentY() > -minYExtent()) {
d->vData.velocity = qMax(event->delta()*2 - d->vData.smoothVelocity.value(), qreal(d->maxVelocity/4));
valid = true;
} else if (event->delta() < 0 && contentY() < -maxYExtent()) {
d->vData.velocity = qMin(event->delta()*2 - d->vData.smoothVelocity.value(), qreal(-d->maxVelocity/4));
valid = true;
}
if (valid) {
d->flickingVertically = false;
d->flickY(d->vData.velocity);
if (d->flickingVertically) {
@ -753,11 +817,17 @@ void QSGFlickable::wheelEvent(QGraphicsSceneWheelEvent *event)
movementStarting();
}
event->accept();
}
} else if (xflick() && event->orientation() == Qt::Horizontal) {
if (event->delta() > 0)
d->hData.velocity = qMax(event->delta() - d->hData.smoothVelocity.value(), qreal(250.0));
else
d->hData.velocity = qMin(event->delta() - d->hData.smoothVelocity.value(), qreal(-250.0));
bool valid = false;
if (event->delta() > 0 && contentX() > -minXExtent()) {
d->hData.velocity = qMax(event->delta()*2 - d->hData.smoothVelocity.value(), qreal(d->maxVelocity/4));
valid = true;
} else if (event->delta() < 0 && contentX() < -maxXExtent()) {
d->hData.velocity = qMin(event->delta()*2 - d->hData.smoothVelocity.value(), qreal(-d->maxVelocity/4));
valid = true;
}
if (valid) {
d->flickingHorizontally = false;
d->flickX(d->hData.velocity);
if (d->flickingHorizontally) {
@ -765,6 +835,7 @@ void QSGFlickable::wheelEvent(QGraphicsSceneWheelEvent *event)
movementStarting();
}
event->accept();
}
} else {
QSGItem::wheelEvent(event);
}
@ -823,14 +894,14 @@ void QSGFlickablePrivate::clearDelayedPress()
}
}
void QSGFlickablePrivate::setRoundedViewportX(qreal x)
void QSGFlickablePrivate::setViewportX(qreal x)
{
contentItem->setX(qRound(x));
contentItem->setX(x);
}
void QSGFlickablePrivate::setRoundedViewportY(qreal y)
void QSGFlickablePrivate::setViewportY(qreal y)
{
contentItem->setY(qRound(y));
contentItem->setY(y);
}
void QSGFlickable::timerEvent(QTimerEvent *event)
@ -901,6 +972,27 @@ void QSGFlickable::viewportMoved()
}
}
if (!d->vData.inOvershoot && !d->vData.fixingUp && d->flickingVertically
&& (d->vData.move.value() > minYExtent() || d->vData.move.value() < maxYExtent())
&& qAbs(d->vData.smoothVelocity.value()) > 100) {
// Increase deceleration if we've passed a bound
d->vData.inOvershoot = true;
qreal maxDistance = d->overShootDistance(height());
d->timeline.reset(d->vData.move);
d->timeline.accel(d->vData.move, -d->vData.smoothVelocity.value(), d->deceleration*QML_FLICK_OVERSHOOTFRICTION, maxDistance);
d->timeline.callback(QDeclarativeTimeLineCallback(&d->vData.move, d->fixupY_callback, d));
}
if (!d->hData.inOvershoot && !d->hData.fixingUp && d->flickingHorizontally
&& (d->hData.move.value() > minXExtent() || d->hData.move.value() < maxXExtent())
&& qAbs(d->hData.smoothVelocity.value()) > 100) {
// Increase deceleration if we've passed a bound
d->hData.inOvershoot = true;
qreal maxDistance = d->overShootDistance(width());
d->timeline.reset(d->hData.move);
d->timeline.accel(d->hData.move, -d->hData.smoothVelocity.value(), d->deceleration*QML_FLICK_OVERSHOOTFRICTION, maxDistance);
d->timeline.callback(QDeclarativeTimeLineCallback(&d->hData.move, d->fixupX_callback, d));
}
d->lastFlickablePosition = QPointF(d->hData.move.value(), d->vData.move.value());
d->vTime = d->timeline.time();
@ -1071,7 +1163,9 @@ void QSGFlickable::resizeContent(qreal w, qreal h, QPointF center)
Q_D(QSGFlickable);
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());
@ -1079,12 +1173,15 @@ void QSGFlickable::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();
}
void QSGFlickable::returnToBounds()
@ -1148,8 +1245,9 @@ bool QSGFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
QSGCanvas *c = canvas();
QSGItem *grabber = c ? c->mouseGrabberItem() : 0;
bool disabledItem = grabber && !grabber->isEnabled();
bool stealThisEvent = d->stealMouse;
if ((stealThisEvent || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab())) {
if ((stealThisEvent || myRect.contains(event->scenePos().toPoint())) && (!grabber || !grabber->keepMouseGrab() || disabledItem)) {
mouseEvent.setAccepted(false);
for (int i = 0x1; i <= 0x10; i <<= 1) {
if (event->buttons() & i) {
@ -1196,12 +1294,12 @@ bool QSGFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event)
break;
}
grabber = qobject_cast<QSGItem*>(c->mouseGrabberItem());
if (grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) {
if ((grabber && stealThisEvent && !grabber->keepMouseGrab() && grabber != this) || disabledItem) {
d->clearDelayedPress();
grabMouse();
}
return stealThisEvent || d->delayedPressEvent;
return stealThisEvent || d->delayedPressEvent || disabledItem;
} else if (d->lastPosTime.isValid()) {
d->lastPosTime.invalidate();
}

View File

@ -1,4 +1,4 @@
// Commit: cb0a6844705802564c81b581f24a76c5d5adf6d1
// Commit: 160f1867868cdea916923652b00484ed11f90aaa
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -96,9 +96,19 @@ public:
struct AxisData {
AxisData(QSGFlickablePrivate *fp, void (QSGFlickablePrivate::*func)(qreal))
: move(fp, func), viewSize(-1), smoothVelocity(fp), atEnd(false), atBeginning(true)
, fixingUp(false)
, fixingUp(false), inOvershoot(false)
{}
void reset() {
velocityBuffer.clear();
dragStartOffset = 0;
fixingUp = false;
inOvershoot = false;
}
void addVelocitySample(qreal v, qreal maxVelocity);
void updateVelocity();
QDeclarativeTimeLineValueProxy<QSGFlickablePrivate> move;
qreal viewSize;
qreal pressPos;
@ -108,9 +118,11 @@ public:
qreal velocity;
qreal flickTarget;
QSGFlickablePrivate::Velocity smoothVelocity;
QPODVector<qreal,10> velocityBuffer;
bool atEnd : 1;
bool atBeginning : 1;
bool fixingUp : 1;
bool inOvershoot : 1;
};
void flickX(qreal velocity);
@ -128,10 +140,10 @@ public:
void captureDelayedPress(QGraphicsSceneMouseEvent *event);
void clearDelayedPress();
void setRoundedViewportX(qreal x);
void setRoundedViewportY(qreal y);
void setViewportX(qreal x);
void setViewportY(qreal y);
qreal overShootDistance(qreal velocity, qreal size);
qreal overShootDistance(qreal size);
void itemGeometryChanged(QSGItem *, const QRectF &, const QRectF &);

View File

@ -1,4 +1,4 @@
// Commit: cc6408ccd5453d1bed9f98b9caa14861cea5742b
// Commit: fda9cc1d8a0e49817d1c6192c52d18dffcecf327
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -581,6 +581,26 @@ void QSGGridViewPrivate::refill(qreal from, qreal to, bool doBuffer)
--i;
modelIndex = visibleItems.at(i)->index + 1;
}
if (visibleItems.count() && (fillFrom > rowPos + rowSize()*2
|| fillTo < rowPosAt(visibleIndex) - rowSize())) {
// We've jumped more than a page. Estimate which items are now
// visible and fill from there.
int count = (fillFrom - (rowPos + rowSize())) / (rowSize()) * columns;
for (int i = 0; i < visibleItems.count(); ++i)
releaseItem(visibleItems.at(i));
visibleItems.clear();
modelIndex += count;
if (modelIndex >= model->count())
modelIndex = model->count() - 1;
else if (modelIndex < 0)
modelIndex = 0;
modelIndex = modelIndex / columns * columns;
visibleIndex = modelIndex;
colPos = colPosAt(visibleIndex);
rowPos = rowPosAt(visibleIndex);
}
int colNum = colPos / colSize();
FxGridItemSG *item = 0;
@ -1112,6 +1132,7 @@ void QSGGridViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent)
} else {
QSGFlickablePrivate::fixup(data, minExtent, maxExtent);
}
data.inOvershoot = false;
fixupMode = Normal;
}
@ -1190,7 +1211,7 @@ void QSGGridViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent,
accel = v2 / (2.0f * qAbs(dist));
} else {
data.flickTarget = velocity > 0 ? minExtent : maxExtent;
overshootDist = overShoot ? overShootDistance(v, vSize) : 0;
overshootDist = overShoot ? overShootDistance(vSize) : 0;
}
timeline.reset(data.move);
timeline.accel(data.move, v, accel, maxDistance + overshootDist);
@ -1869,7 +1890,7 @@ qreal QSGGridView::maxXExtent() const
qreal extent;
qreal highlightStart;
qreal highlightEnd;
qreal lastItemPosition;
qreal lastItemPosition = 0;
if (d->isRightToLeftTopToBottom()){
highlightStart = d->highlightRangeStartValid ? d->highlightRangeEnd : d->size();
highlightEnd = d->highlightRangeEndValid ? d->highlightRangeStart : d->size();
@ -1877,6 +1898,7 @@ qreal QSGGridView::maxXExtent() const
} else {
highlightStart = d->highlightRangeStart;
highlightEnd = d->highlightRangeEnd;
lastItemPosition = 0;
if (d->model && d->model->count())
lastItemPosition = d->rowPosAt(d->model->count()-1);
}
@ -2367,11 +2389,9 @@ void QSGGridView::itemsInserted(int modelIndex, int count)
if (d->currentItem) {
d->currentItem->index = d->currentIndex;
d->currentItem->setPosition(d->colPosAt(d->currentIndex), d->rowPosAt(d->currentIndex));
} else if (!d->currentIndex || (d->currentIndex < 0 && !d->currentIndexCleared)) {
d->updateCurrent(0);
}
emit currentIndexChanged();
} else if (d->itemCount == 0 && d->currentIndex == -1) {
} else if (d->itemCount == 0 && (!d->currentIndex || (d->currentIndex < 0 && !d->currentIndexCleared))) {
setCurrentIndex(0);
}
@ -2439,6 +2459,8 @@ void QSGGridView::itemsRemoved(int modelIndex, int count)
d->currentIndex = -1;
if (d->itemCount)
d->updateCurrent(qMin(modelIndex, d->itemCount-1));
else
emit currentIndexChanged();
}
// update visibleIndex

View File

@ -1,4 +1,4 @@
// Commit: 695a39410c8ce186a2ce78cef51093c55fc32643
// Commit: 051a76c1d65d698f71dc75c89f91ae9021357eae
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -77,12 +77,10 @@ void QSGImagePrivate::setPixmap(const QPixmap &pixmap)
Q_Q(QSGImage);
pix.setPixmap(pixmap);
q->setImplicitWidth(pix.width());
q->setImplicitHeight(pix.height());
q->pixmapChange();
status = pix.isNull() ? QSGImageBase::Null : QSGImageBase::Ready;
q->update();
q->pixmapChange();
}
QSGImage::FillMode QSGImage::fillMode() const
@ -119,8 +117,11 @@ void QSGImage::updatePaintedGeometry()
Q_D(QSGImage);
if (d->fillMode == PreserveAspectFit) {
if (!d->pix.width() || !d->pix.height())
if (!d->pix.width() || !d->pix.height()) {
setImplicitWidth(0);
setImplicitHeight(0);
return;
}
qreal w = widthValid() ? width() : d->pix.width();
qreal widthScale = w / qreal(d->pix.width());
qreal h = heightValid() ? height() : d->pix.height();
@ -134,9 +135,13 @@ void QSGImage::updatePaintedGeometry()
}
if (widthValid() && !heightValid()) {
setImplicitHeight(d->paintedHeight);
} else {
setImplicitHeight(d->pix.height());
}
if (heightValid() && !widthValid()) {
setImplicitWidth(d->paintedWidth);
} else {
setImplicitWidth(d->pix.width());
}
} else if (d->fillMode == PreserveAspectCrop) {
if (!d->pix.width() || !d->pix.height())
@ -280,7 +285,12 @@ QSGNode *QSGImage::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
void QSGImage::pixmapChange()
{
Q_D(QSGImage);
// PreserveAspectFit calculates the implicit size differently so we
// don't call our superclass pixmapChange(), since that would
// result in the implicit size being set incorrectly, then updated
// in updatePaintedGeometry()
if (d->fillMode != PreserveAspectFit)
QSGImageBase::pixmapChange();
updatePaintedGeometry();
d->pixmapChanged = true;
}

View File

@ -1,4 +1,4 @@
// Commit: 462429f5692f810bdd4e04b916db5f9af428d9e4
// Commit: 051a76c1d65d698f71dc75c89f91ae9021357eae
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -134,6 +134,18 @@ QSize QSGImageBase::sourceSize() const
return QSize(width != -1 ? width : d->pix.width(), height != -1 ? height : d->pix.height());
}
void QSGImageBase::resetSourceSize()
{
Q_D(QSGImageBase);
if (!d->explicitSourceSize)
return;
d->explicitSourceSize = false;
d->sourcesize = QSize();
emit sourceSizeChanged();
if (isComponentComplete())
load();
}
bool QSGImageBase::cache() const
{
Q_D(const QSGImageBase);
@ -180,11 +192,9 @@ void QSGImageBase::load()
d->pix.clear(this);
d->status = Null;
d->progress = 0.0;
setImplicitWidth(0);
setImplicitHeight(0);
pixmapChange();
emit progressChanged(d->progress);
emit statusChanged(d->status);
pixmapChange();
update();
} else {
QDeclarativePixmap::Options options;
@ -235,8 +245,7 @@ void QSGImageBase::requestFinished()
d->progress = 1.0;
setImplicitWidth(d->pix.width());
setImplicitHeight(d->pix.height());
pixmapChange();
if (d->sourcesize.width() != d->pix.width() || d->sourcesize.height() != d->pix.height())
emit sourceSizeChanged();
@ -245,7 +254,7 @@ void QSGImageBase::requestFinished()
emit statusChanged(d->status);
if (d->progress != oldProgress)
emit progressChanged(d->progress);
pixmapChange();
update();
}
@ -268,6 +277,9 @@ void QSGImageBase::componentComplete()
void QSGImageBase::pixmapChange()
{
Q_D(QSGImageBase);
setImplicitWidth(d->pix.width());
setImplicitHeight(d->pix.height());
}
QT_END_NAMESPACE

View File

@ -1,4 +1,4 @@
// Commit: ab71df83ba4eb9d749efc0f3a2d4a0fe5486023f
// Commit: af05f64d3edc860c3cf79c7f0bdf2377faae5f40
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -60,7 +60,7 @@ class Q_AUTOTEST_EXPORT QSGImageBase : public QSGImplicitSizeItem
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)
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)
public:
@ -81,6 +81,7 @@ public:
virtual void setSourceSize(const QSize&);
QSize sourceSize() const;
void resetSourceSize();
virtual void setMirror(bool mirror);
bool mirror() const;

View File

@ -1,4 +1,4 @@
// Commit: ce38c6e3a9b7eb336cbd9cd1e9520a5000c8f8ac
// Commit: cce89db1e2555cbca8fc28072e1c6dd737cec6c4
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -743,6 +743,27 @@ void QSGListViewPrivate::refill(qreal from, qreal to, bool doBuffer)
modelIndex = visibleItems.at(i)->index + 1;
}
if (visibleItems.count() && (fillFrom > itemEnd+averageSize+spacing
|| fillTo < visiblePos - averageSize - spacing)) {
// We've jumped more than a page. Estimate which items are now
// visible and fill from there.
int count = (fillFrom - itemEnd) / (averageSize + spacing);
for (int i = 0; i < visibleItems.count(); ++i)
releaseItem(visibleItems.at(i));
visibleItems.clear();
modelIndex += count;
if (modelIndex >= model->count()) {
count -= modelIndex - model->count() + 1;
modelIndex = model->count() - 1;
} else if (modelIndex < 0) {
count -= modelIndex;
modelIndex = 0;
}
visibleIndex = modelIndex;
visiblePos = itemEnd + count * (averageSize + spacing) + 1;
itemEnd = visiblePos-1;
}
bool changed = false;
FxListItemSG *item = 0;
qreal pos = itemEnd + 1;
@ -1353,6 +1374,7 @@ void QSGListViewPrivate::fixup(AxisData &data, qreal minExtent, qreal maxExtent)
} else {
QSGFlickablePrivate::fixup(data, minExtent, maxExtent);
}
data.inOvershoot = false;
fixupMode = Normal;
}
@ -1425,10 +1447,10 @@ void QSGListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent,
data.flickTarget = isRightToLeft() ? -data.flickTarget+size() : data.flickTarget;
if (overShoot) {
if (data.flickTarget >= minExtent) {
overshootDist = overShootDistance(v, vSize);
overshootDist = overShootDistance(vSize);
data.flickTarget += overshootDist;
} else if (data.flickTarget <= maxExtent) {
overshootDist = overShootDistance(v, vSize);
overshootDist = overShootDistance(vSize);
data.flickTarget -= overshootDist;
}
}
@ -1448,10 +1470,10 @@ void QSGListViewPrivate::flick(AxisData &data, qreal minExtent, qreal maxExtent,
} else if (overShoot) {
data.flickTarget = data.move.value() - dist;
if (data.flickTarget >= minExtent) {
overshootDist = overShootDistance(v, vSize);
overshootDist = overShootDistance(vSize);
data.flickTarget += overshootDist;
} else if (data.flickTarget <= maxExtent) {
overshootDist = overShootDistance(v, vSize);
overshootDist = overShootDistance(vSize);
data.flickTarget -= overshootDist;
}
}
@ -1831,9 +1853,11 @@ void QSGListView::setOrientation(QSGListView::Orientation orientation)
if (d->orient == QSGListView::Vertical) {
setContentWidth(-1);
setFlickableDirection(VerticalFlick);
setContentX(0);
} else {
setContentHeight(-1);
setFlickableDirection(HorizontalFlick);
setContentY(0);
}
d->regenerate();
emit orientationChanged();
@ -2131,7 +2155,7 @@ void QSGListView::viewportMoved()
d->inFlickCorrection = true;
// Near an end and it seems that the extent has changed?
// Recalculate the flick so that we don't end up in an odd position.
if (yflick()) {
if (yflick() && !d->vData.inOvershoot) {
if (d->vData.velocity > 0) {
const qreal minY = minYExtent();
if ((minY - d->vData.move.value() < height()/2 || d->vData.flickTarget - d->vData.move.value() < height()/2)
@ -2147,7 +2171,7 @@ void QSGListView::viewportMoved()
}
}
if (xflick()) {
if (xflick() && !d->hData.inOvershoot) {
if (d->hData.velocity > 0) {
const qreal minX = minXExtent();
if ((minX - d->hData.move.value() < width()/2 || d->hData.flickTarget - d->hData.move.value() < width()/2)
@ -2311,7 +2335,7 @@ void QSGListView::keyPressEvent(QKeyEvent *event)
{
Q_D(QSGListView);
if (d->model && d->model->count() && d->interactive) {
if ((!d->isRightToLeft() && event->key() == Qt::Key_Left)
if ((d->orient == QSGListView::Horizontal && !d->isRightToLeft() && event->key() == Qt::Key_Left)
|| (d->orient == QSGListView::Horizontal && d->isRightToLeft() && event->key() == Qt::Key_Right)
|| (d->orient == QSGListView::Vertical && event->key() == Qt::Key_Up)) {
if (currentIndex() > 0 || (d->wrap && !event->isAutoRepeat())) {
@ -2322,7 +2346,7 @@ void QSGListView::keyPressEvent(QKeyEvent *event)
event->accept();
return;
}
} else if ((!d->isRightToLeft() && event->key() == Qt::Key_Right)
} else if ((d->orient == QSGListView::Horizontal && !d->isRightToLeft() && event->key() == Qt::Key_Right)
|| (d->orient == QSGListView::Horizontal && d->isRightToLeft() && event->key() == Qt::Key_Left)
|| (d->orient == QSGListView::Vertical && event->key() == Qt::Key_Down)) {
if (currentIndex() < d->model->count() - 1 || (d->wrap && !event->isAutoRepeat())) {

View File

@ -1,4 +1,4 @@
// Commit: f0f6deb9a5e8bd078047dd090a3857290c8b4ea4
// Commit: e1ffbc04131dc6f76fa76821c297d08162e4b1ee
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -179,6 +179,8 @@ QSGMouseAreaPrivate::QSGMouseAreaPrivate()
: absorb(true), hovered(false), pressed(false), longPress(false),
moved(false), stealMouse(false), doubleClick(false), preventStealing(false), drag(0)
{
Q_Q(QSGMouseArea);
forwardTo = QDeclarativeListProperty<QSGItem>(q, forwardToList);
}
QSGMouseAreaPrivate::~QSGMouseAreaPrivate()
@ -202,6 +204,18 @@ void QSGMouseAreaPrivate::saveEvent(QGraphicsSceneMouseEvent *event)
lastModifiers = event->modifiers();
}
void QSGMouseAreaPrivate::forwardEvent(QGraphicsSceneMouseEvent* event)
{
Q_Q(QSGMouseArea);
for(int i=0; i < forwardToList.count(); i++){
event->setPos(forwardToList[i]->mapFromScene(event->scenePos()));
forwardToList[i]->canvas()->sendEvent(forwardToList[i], event);
if(event->isAccepted())
break;
}
event->setPos(q->mapFromScene(event->scenePos()));
}
bool QSGMouseAreaPrivate::isPressAndHoldConnected()
{
Q_Q(QSGMouseArea);
@ -382,6 +396,9 @@ void QSGMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event)
d->pressAndHoldTimer.start(PressAndHoldDelay, this);
setKeepMouseGrab(d->stealMouse);
event->setAccepted(setPressed(true));
if(!event->isAccepted() && d->forwardToList.count())
d->forwardEvent(event);
}
}
@ -459,6 +476,9 @@ void QSGMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
me.setX(d->lastPos.x());
me.setY(d->lastPos.y());
emit positionChanged(&me);
if(!event->isAccepted() && d->forwardToList.count())
d->forwardEvent(event);
}
void QSGMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
@ -479,6 +499,9 @@ void QSGMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (c && c->mouseGrabberItem() == this)
ungrabMouse();
setKeepMouseGrab(false);
if(!event->isAccepted() && d->forwardToList.count())
d->forwardEvent(event);
}
d->doubleClick = false;
}
@ -768,4 +791,10 @@ QSGDrag *QSGMouseArea::drag()
return d->drag;
}
QDeclarativeListProperty<QSGItem> QSGMouseArea::forwardTo()
{
Q_D(QSGMouseArea);
return d->forwardTo;
}
QT_END_NAMESPACE

View File

@ -1,4 +1,4 @@
// Commit: 57676c237992e0aa5a93a4e8fa66b3e7b90c2c90
// Commit: c6e6a35aeb8794d68a3ca0c4e27a3a1181c066b5
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -131,6 +131,7 @@ class Q_AUTOTEST_EXPORT QSGMouseArea : public QSGItem
Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
Q_PROPERTY(QSGDrag *drag READ drag CONSTANT) //### add flicking to QSGDrag or add a QDeclarativeFlick ???
Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged)
Q_PROPERTY(QDeclarativeListProperty<QSGItem> forwardTo READ forwardTo);
public:
QSGMouseArea(QSGItem *parent=0);
@ -158,6 +159,8 @@ public:
bool preventStealing() const;
void setPreventStealing(bool prevent);
QDeclarativeListProperty<QSGItem> forwardTo();
Q_SIGNALS:
void hoveredChanged();
void pressedChanged();

View File

@ -1,4 +1,4 @@
// Commit: 57676c237992e0aa5a93a4e8fa66b3e7b90c2c90
// Commit: c6e6a35aeb8794d68a3ca0c4e27a3a1181c066b5
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -80,6 +80,7 @@ public:
};
void propagate(QSGMouseEvent* event, PropagateType);
bool propagateHelper(QSGMouseEvent*, QSGItem*,const QPointF &, PropagateType);
void forwardEvent(QGraphicsSceneMouseEvent* event);
bool isPressAndHoldConnected();
bool isDoubleClickConnected();
@ -105,6 +106,8 @@ public:
Qt::MouseButtons lastButtons;
Qt::KeyboardModifiers lastModifiers;
QBasicTimer pressAndHoldTimer;
QDeclarativeListProperty<QSGItem> forwardTo;
QList<QSGItem*> forwardToList;
};
QT_END_NAMESPACE

View File

@ -186,6 +186,37 @@ void QSGPaintedItem::setOpaquePainting(bool opaque)
QSGItem::update();
}
/*!
Returns true if antialiased painting is enabled; otherwise, false is returned.
By default, antialiasing is not enabled.
\sa setAntialiasing()
*/
bool QSGPaintedItem::antialiasing() const
{
Q_D(const QSGPaintedItem);
return d->antialiasing;
}
/*!
If \a enable is true, antialiased painting is enabled.
By default, antialiasing is not enabled.
\sa antialiasing()
*/
void QSGPaintedItem::setAntialiasing(bool enable)
{
Q_D(QSGPaintedItem);
if (d->antialiasing == enable)
return;
d->antialiasing = enable;
update();
}
QSize QSGPaintedItem::contentsSize() const
{
// XXX todo
@ -213,28 +244,6 @@ void QSGPaintedItem::setContentsScale(qreal)
// XXX todo
}
int QSGPaintedItem::pixelCacheSize() const
{
// XXX todo
return 0;
}
void QSGPaintedItem::setPixelCacheSize(int)
{
// XXX todo
}
bool QSGPaintedItem::smoothCache() const
{
// XXX todo
return false;
}
void QSGPaintedItem::setSmoothCache(bool)
{
// XXX todo
}
/*!
\property QSGPaintedItem::fillColor
\brief The item's background fill color.
@ -337,7 +346,7 @@ QSGNode *QSGPaintedItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
node->setPreferredRenderTarget(d->renderTarget);
node->setSize(QSize(d->width, d->height));
node->setSmoothPainting(d->smooth);
node->setSmoothPainting(d->antialiasing);
node->setLinearFiltering(d->smooth);
node->setOpaquePainting(d->opaquePainting);
node->setFillColor(d->fillColor);

View File

@ -57,8 +57,6 @@ class Q_DECLARATIVE_EXPORT QSGPaintedItem : public QSGItem
Q_PROPERTY(QSize contentsSize READ contentsSize WRITE setContentsSize NOTIFY contentsSizeChanged)
Q_PROPERTY(QColor fillColor READ fillColor WRITE setFillColor NOTIFY fillColorChanged)
Q_PROPERTY(int pixelCacheSize READ pixelCacheSize WRITE setPixelCacheSize)
Q_PROPERTY(bool smoothCache READ smoothCache WRITE setSmoothCache)
Q_PROPERTY(qreal contentsScale READ contentsScale WRITE setContentsScale NOTIFY contentsScaleChanged)
Q_PROPERTY(RenderTarget renderTarget READ renderTarget WRITE setRenderTarget NOTIFY renderTargetChanged)
public:
@ -75,6 +73,9 @@ public:
bool opaquePainting() const;
void setOpaquePainting(bool opaque);
bool antialiasing() const;
void setAntialiasing(bool enable);
QSize contentsSize() const;
void setContentsSize(const QSize &);
void resetContentsSize();
@ -82,12 +83,6 @@ public:
qreal contentsScale() const;
void setContentsScale(qreal);
int pixelCacheSize() const;
void setPixelCacheSize(int pixels);
bool smoothCache() const;
void setSmoothCache(bool on);
QColor fillColor() const;
void setFillColor(const QColor&);

View File

@ -60,6 +60,7 @@ public:
bool geometryDirty : 1;
bool contentsDirty : 1;
bool opaquePainting: 1;
bool antialiasing: 1;
};
QT_END_NAMESPACE

View File

@ -1,4 +1,4 @@
// Commit: ac704e9f682378a5ec56e3f5c195dcf2f2dfa1ac
// Commit: 8878e2c53a0c9408d4b468e2dad485743c32f58b
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -1213,6 +1213,8 @@ void QSGPathView::itemsRemoved(int modelIndex, int count)
} else {
d->regenerate();
d->updateCurrent();
if (!d->flicking && !d->moving && d->haveHighlightRange && d->highlightRangeMode == QSGPathView::StrictlyEnforceRange)
d->snapToCurrent();
}
if (changedOffset)
emit offsetChanged();

View File

@ -1,4 +1,4 @@
// Commit: 2ec2dc55ddf424f5a7acd0a4729ddd9af2d7c398
// Commit: f707672eb4c51ea82fbd98e1da16ece61a74c690
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -121,7 +121,7 @@ void QSGPinchArea::touchEvent(QTouchEvent *event)
void QSGPinchArea::updatePinch()
{
Q_D(QSGPinchArea);
if (d->touchPoints.count() != 2) {
if (d->touchPoints.count() == 0) {
if (d->inPinch) {
d->stealMouse = false;
setKeepMouseGrab(false);
@ -134,39 +134,52 @@ void QSGPinchArea::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){
QSGItem *grabber = canvas() ? canvas()->mouseGrabberItem() : 0;
if (grabber == this || !grabber || !grabber->keepMouseGrab()) {
d->pinchActivated = true;
} else if (d->pinchActivated && !d->pinchRejected){
const int dragThreshold = QApplication::startDragDistance();
QPointF p1 = d->touchPoints.at(0).scenePos();
QPointF p2 = d->touchPoints.at(1).scenePos();
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 (qAbs(p1.x()-d->sceneStartPoint1.x()) > dragThreshold
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) {
|| qAbs(p2.y()-d->sceneStartPoint2.y()) > dragThreshold)) {
d->sceneStartCenter = sceneCenter;
d->sceneLastCenter = sceneCenter;
d->pinchStartCenter = mapFromScene(sceneCenter);
@ -175,8 +188,8 @@ void QSGPinchArea::updatePinch()
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();
d->lastPoint1 = p1;
d->lastPoint2 = p2;
QSGPinchEvent pe(d->pinchStartCenter, 1.0, angle, 0.0);
pe.setStartCenter(d->pinchStartCenter);
pe.setPreviousCenter(d->pinchStartCenter);
@ -184,8 +197,9 @@ void QSGPinchArea::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));
pe.setPointCount(d->touchPoints.count());
emit pinchStarted(&pe);
if (pe.accepted()) {
d->inPinch = true;
@ -205,7 +219,7 @@ void QSGPinchArea::updatePinch()
}
}
} else if (d->pinchStartDist > 0) {
qreal scale = dist / d->pinchStartDist;
qreal scale = dist ? dist / d->pinchStartDist : d->pinchLastScale;
qreal da = d->pinchLastAngle - angle;
if (da > 180)
da -= 360;
@ -220,13 +234,14 @@ void QSGPinchArea::updatePinch()
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());
pe.setPoint1(touchPoint1.pos());
pe.setPoint2(touchPoint2.pos());
pe.setPointCount(d->touchPoints.count());
d->pinchLastScale = scale;
d->sceneLastCenter = sceneCenter;
d->pinchLastAngle = angle;
d->lastPoint1 = d->touchPoints.at(0).pos();
d->lastPoint2 = d->touchPoints.at(1).pos();
d->lastPoint1 = touchPoint1.scenePos();
d->lastPoint2 = touchPoint2.scenePos();
emit pinchUpdated(&pe);
if (d->pinch && d->pinch->target()) {
qreal s = d->pinchStartScale * scale;
@ -258,7 +273,6 @@ void QSGPinchArea::updatePinch()
}
}
}
}
}
void QSGPinchArea::mousePressEvent(QGraphicsSceneMouseEvent *event)

View File

@ -1,4 +1,4 @@
// Commit: ce59628ba366800fe2f3afdadc37be02f98480a7
// Commit: f707672eb4c51ea82fbd98e1da16ece61a74c690
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -204,11 +204,13 @@ class Q_AUTOTEST_EXPORT QSGPinchEvent : 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:
QSGPinchEvent(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; }
@ -230,6 +232,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; }
@ -247,6 +251,7 @@ private:
QPointF m_point2;
QPointF m_startPoint1;
QPointF m_startPoint2;
int m_pointCount;
bool m_accepted;
};

View File

@ -1,4 +1,4 @@
// Commit: 2ec2dc55ddf424f5a7acd0a4729ddd9af2d7c398
// Commit: f707672eb4c51ea82fbd98e1da16ece61a74c690
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -68,7 +68,8 @@ class QSGPinchAreaPrivate : public QSGItemPrivate
public:
QSGPinchAreaPrivate()
: 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)
{
@ -87,6 +88,7 @@ public:
bool stealMouse : 1;
bool inPinch : 1;
bool pinchRejected : 1;
bool pinchActivated : 1;
QSGPinch *pinch;
QPointF sceneStartPoint1;
QPointF sceneStartPoint2;
@ -104,6 +106,7 @@ public:
QPointF sceneLastCenter;
QPointF pinchStartPos;
QList<QTouchEvent::TouchPoint> touchPoints;
int id1;
};
QT_END_NAMESPACE

View File

@ -65,6 +65,7 @@ QSGShaderEffectTexture::QSGShaderEffectTexture(QSGItem *shaderSource)
#ifdef QSG_DEBUG_FBO_OVERLAY
, m_debugOverlay(0)
#endif
, m_mipmap(false)
, m_live(true)
, m_dirtyTexture(true)
, m_multisamplingSupportChecked(false)
@ -95,7 +96,7 @@ bool QSGShaderEffectTexture::hasAlphaChannel() const
bool QSGShaderEffectTexture::hasMipmaps() const
{
return m_mipmapFiltering;
return m_mipmap;
}
@ -114,12 +115,12 @@ bool QSGShaderEffectTexture::updateTexture()
return false;
}
void QSGShaderEffectTexture::setHasMipmaps(QSGTexture::Filtering filtering)
void QSGShaderEffectTexture::setHasMipmaps(bool mipmap)
{
if (filtering == m_mipmapFiltering)
if (mipmap == m_mipmap)
return;
m_mipmapFiltering = filtering;
if (filtering != None && m_fbo && !m_fbo->format().mipmap())
m_mipmap = mipmap;
if (m_mipmap && m_fbo && !m_fbo->format().mipmap())
markDirtyTexture();
}
@ -196,9 +197,8 @@ void QSGShaderEffectTexture::grab()
}
m_renderer->setRootNode(static_cast<QSGRootNode *>(root));
bool mipmap = m_mipmapFiltering != None;
if (!m_fbo || m_fbo->size() != m_size || m_fbo->format().internalTextureFormat() != m_format
|| (!m_fbo->format().mipmap() && mipmap))
|| (!m_fbo->format().mipmap() && m_mipmap))
{
if (!m_multisamplingSupportChecked) {
QList<QByteArray> extensions = QByteArray((const char *)glGetString(GL_EXTENSIONS)).split(' ');
@ -217,7 +217,7 @@ void QSGShaderEffectTexture::grab()
m_multisampledFbo = new QGLFramebufferObject(m_size, format);
format.setAttachment(QGLFramebufferObject::NoAttachment);
format.setMipmap(m_mipmapFiltering);
format.setMipmap(m_mipmap);
format.setSamples(0);
m_fbo = new QGLFramebufferObject(m_size, format);
@ -226,7 +226,7 @@ void QSGShaderEffectTexture::grab()
QGLFramebufferObjectFormat format;
format.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
format.setInternalTextureFormat(m_format);
format.setMipmap(m_mipmapFiltering);
format.setMipmap(m_mipmap);
m_fbo = new QGLFramebufferObject(m_size, format);
}
}
@ -267,7 +267,7 @@ void QSGShaderEffectTexture::grab()
m_renderer->renderScene(BindableFbo(m_fbo));
}
if (mipmap) {
if (m_mipmap) {
glBindTexture(GL_TEXTURE_2D, textureId());
ctx->functions()->glGenerateMipmap(GL_TEXTURE_2D);
}
@ -461,6 +461,8 @@ static void get_wrap_mode(QSGShaderEffectSource::WrapMode mode, QSGTexture::Wrap
*hWrap = *vWrap = QSGTexture::Repeat;
break;
default:
// QSGShaderEffectSource::ClampToEdge
*hWrap = *vWrap = QSGTexture::ClampToEdge;
break;
}
}
@ -504,12 +506,12 @@ QSGNode *QSGShaderEffectSource::updatePaintNode(QSGNode *oldNode, UpdatePaintNod
tex->setSize(textureSize);
tex->setLive(m_live);
tex->setFormat(GLenum(m_format));
tex->setHasMipmaps(m_mipmap);
QSGTexture::Filtering filtering = QSGItemPrivate::get(this)->smooth
? QSGTexture::Linear
: QSGTexture::Nearest;
QSGTexture::Filtering mmFiltering = m_mipmap ? filtering : QSGTexture::None;
tex->setHasMipmaps(mmFiltering);
node->setMipmapFiltering(mmFiltering);
node->setFiltering(filtering);

View File

@ -82,7 +82,7 @@ public:
QSize size() const { return m_size; }
void setSize(const QSize &size);
void setHasMipmaps(QSGTexture::Filtering filtering);
void setHasMipmaps(bool mipmap);
void bind();
@ -120,11 +120,7 @@ private:
QSGRectangleNode *m_debugOverlay;
#endif
uint m_hWrapMode : 1;
uint m_vWrapMode : 1;
uint m_filtering : 2;
uint m_mipmapFiltering : 2;
uint m_mipmap : 1;
uint m_live : 1;
uint m_dirtyTexture : 1;
uint m_multisamplingSupportChecked : 1;

View File

@ -1,4 +1,4 @@
// Commit: a5c3c11e3e2204da6c8be9af98b38929366fafb8
// Commit: cce89db1e2555cbca8fc28072e1c6dd737cec6c4
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -106,7 +106,7 @@ QSGTextPrivate::QSGTextPrivate()
imageCacheDirty(true), updateOnComponentComplete(true),
richText(false), singleline(false), cacheAllTextAsImage(true), internalWidthUpdate(false),
requireImplicitWidth(false), truncated(false), hAlignImplicit(true), rightToLeftText(false),
naturalWidth(0), doc(0), nodeType(NodeIsNull)
layoutTextElided(false), naturalWidth(0), doc(0), nodeType(NodeIsNull)
{
cacheAllTextAsImage = enableImageCache();
}
@ -219,6 +219,7 @@ void QSGTextPrivate::updateLayout()
return;
}
layoutTextElided = false;
// Setup instance of QTextLayout for all cases other than richtext
if (!richText) {
layout.clearLayout();
@ -229,12 +230,15 @@ void QSGTextPrivate::updateLayout()
singleline = !tmp.contains(QChar::LineSeparator);
if (singleline && !maximumLineCountValid && elideMode != QSGText::ElideNone && q->widthValid()) {
QFontMetrics fm(font);
tmp = fm.elidedText(tmp,(Qt::TextElideMode)elideMode,q->width()); // XXX still worth layout...?
if (tmp != text && !truncated) {
tmp = fm.elidedText(tmp,(Qt::TextElideMode)elideMode,q->width());
if (tmp != text) {
layoutTextElided = true;
if (!truncated) {
truncated = true;
emit q->truncatedChanged();
}
}
}
layout.setText(tmp);
} else {
singleline = false;
@ -379,6 +383,12 @@ QRect QSGTextPrivate::setupTextLayout()
if (requireImplicitWidth && q->widthValid()) {
// requires an extra layout
QString elidedText;
if (layoutTextElided) {
// We have provided elided text to the layout, but we must calculate unelided width.
elidedText = layout.text();
layout.setText(text);
}
layout.beginLayout();
forever {
QTextLine line = layout.createLine();
@ -392,6 +402,8 @@ QRect QSGTextPrivate::setupTextLayout()
br = br.united(line.naturalTextRect());
}
naturalWidth = br.width();
if (layoutTextElided)
layout.setText(elidedText);
}
if (maximumLineCountValid) {

View File

@ -1,4 +1,4 @@
// Commit: aeb330e3999ef3d7ae8d94b9330471f2a2a13554
// Commit: 6e5a642c9484536fc173714f560f739944368cf5
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -119,6 +119,7 @@ public:
bool truncated:1;
bool hAlignImplicit:1;
bool rightToLeftText:1;
bool layoutTextElided:1;
QRect layedOutTextRect;
QSize paintedSize;

View File

@ -1,4 +1,4 @@
// Commit: 6980bca15b411f86b9fadb7484a6dd782b9d1403
// Commit: ec40dd2bb51868bca10dbd0c9116f3224ff2b29b
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -318,6 +318,7 @@ void QSGTextEdit::setVAlign(QSGTextEdit::VAlignment alignment)
d->vAlign = alignment;
d->updateDefaultTextOption();
updateSize();
moveCursorDelegate();
emit verticalAlignmentChanged(d->vAlign);
}
@ -496,8 +497,6 @@ void QSGTextEdit::setCursorDelegate(QDeclarativeComponent* c)
Q_D(QSGTextEdit);
if(d->cursorComponent){
if(d->cursor){
disconnect(d->control, SIGNAL(cursorPositionChanged()),
this, SLOT(moveCursorDelegate()));
d->control->setCursorWidth(-1);
update(cursorRectangle());
delete d->cursor;
@ -523,8 +522,6 @@ void QSGTextEdit::loadCursorDelegate()
return;
d->cursor = qobject_cast<QSGItem*>(d->cursorComponent->create(qmlContext(this)));
if(d->cursor){
connect(d->control, SIGNAL(cursorPositionChanged()),
this, SLOT(moveCursorDelegate()));
d->control->setCursorWidth(0);
update(cursorRectangle());
QDeclarative_setParent_noEvent(d->cursor, this);
@ -696,7 +693,7 @@ Qt::TextInteractionFlags QSGTextEdit::textInteractionFlags() const
QRect QSGTextEdit::cursorRectangle() const
{
Q_D(const QSGTextEdit);
return d->control->cursorRect().toRect().translated(0,-d->yoff);
return d->control->cursorRect().toRect().translated(0,d->yoff);
}
bool QSGTextEdit::event(QEvent *event)
@ -985,7 +982,7 @@ void QSGTextEditPrivate::init()
QObject::connect(control, SIGNAL(selectionChanged()), q, SLOT(updateSelectionMarkers()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SLOT(updateSelectionMarkers()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorPositionChanged()));
QObject::connect(control, SIGNAL(cursorPositionChanged()), q, SIGNAL(cursorRectangleChanged()));
QObject::connect(control, SIGNAL(microFocusChanged()), q, SLOT(moveCursorDelegate()));
QObject::connect(control, SIGNAL(linkActivated(QString)), q, SIGNAL(linkActivated(QString)));
#ifndef QT_NO_CLIPBOARD
QObject::connect(q, SIGNAL(readOnlyChanged(bool)), q, SLOT(q_canPasteChanged()));
@ -1010,16 +1007,17 @@ void QSGTextEdit::q_textChanged()
d->updateDefaultTextOption();
updateSize();
updateTotalLines();
updateMicroFocus();
emit textChanged(d->text);
}
void QSGTextEdit::moveCursorDelegate()
{
Q_D(QSGTextEdit);
updateMicroFocus();
emit cursorRectangleChanged();
if(!d->cursor)
return;
QRectF cursorRect = d->control->cursorRect();
QRectF cursorRect = cursorRectangle();
d->cursor->setX(cursorRect.x());
d->cursor->setY(cursorRect.y());
}
@ -1052,7 +1050,6 @@ void QSGTextEdit::updateSelectionMarkers()
d->lastSelectionEnd = d->control->textCursor().selectionEnd();
emit selectionEndChanged();
}
updateMicroFocus();
}
QRectF QSGTextEdit::boundingRect() const

View File

@ -1,4 +1,4 @@
// Commit: b94176e69efc3948696c6774d5a228fc753b5b29
// Commit: 47712d1f330e4b22ce6dd30e7557288ef7f7fca0
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -442,6 +442,20 @@ bool QSGTextInput::hasAcceptableInput() const
return d->control->hasAcceptableInput();
}
void QSGTextInputPrivate::updateInputMethodHints()
{
Q_Q(QSGTextInput);
Qt::InputMethodHints hints = inputMethodHints;
uint echo = control->echoMode();
if (echo == QSGTextInput::Password || echo == QSGTextInput::NoEcho)
hints |= Qt::ImhHiddenText;
else if (echo == QSGTextInput::PasswordEchoOnEdit)
hints &= ~Qt::ImhHiddenText;
if (echo != QSGTextInput::Normal)
hints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
q->setInputMethodHints(hints);
}
QSGTextInput::EchoMode QSGTextInput::echoMode() const
{
Q_D(const QSGTextInput);
@ -453,21 +467,27 @@ void QSGTextInput::setEchoMode(QSGTextInput::EchoMode echo)
Q_D(QSGTextInput);
if (echoMode() == echo)
return;
Qt::InputMethodHints imHints = inputMethodHints();
if (echo == Password || echo == NoEcho)
imHints |= Qt::ImhHiddenText;
else
imHints &= ~Qt::ImhHiddenText;
if (echo != Normal)
imHints |= (Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
else
imHints &= ~(Qt::ImhNoAutoUppercase | Qt::ImhNoPredictiveText);
setInputMethodHints(imHints);
d->control->setEchoMode((uint)echo);
d->updateInputMethodHints();
q_textChanged();
emit echoModeChanged(echoMode());
}
Qt::InputMethodHints QSGTextInput::imHints() const
{
Q_D(const QSGTextInput);
return d->inputMethodHints;
}
void QSGTextInput::setIMHints(Qt::InputMethodHints hints)
{
Q_D(QSGTextInput);
if (d->inputMethodHints == hints)
return;
d->inputMethodHints = hints;
d->updateInputMethodHints();
}
QDeclarativeComponent* QSGTextInput::cursorDelegate() const
{
Q_D(const QSGTextInput);
@ -485,6 +505,8 @@ void QSGTextInput::setCursorDelegate(QDeclarativeComponent* c)
//note that the components are owned by something else
disconnect(d->control, SIGNAL(cursorPositionChanged(int,int)),
this, SLOT(moveCursor()));
disconnect(d->control, SIGNAL(updateMicroFocus()),
this, SLOT(moveCursor()));
delete d->cursorItem;
}else{
d->startCreatingCursor();
@ -497,7 +519,9 @@ void QSGTextInputPrivate::startCreatingCursor()
{
Q_Q(QSGTextInput);
q->connect(control, SIGNAL(cursorPositionChanged(int,int)),
q, SLOT(moveCursor()));
q, SLOT(moveCursor()), Qt::UniqueConnection);
q->connect(control, SIGNAL(updateMicroFocus()),
q, SLOT(moveCursor()), Qt::UniqueConnection);
if(cursorComponent->isReady()){
q->createCursor();
}else if(cursorComponent->isLoading()){
@ -648,9 +672,10 @@ void QSGTextInput::mousePressEvent(QGraphicsSceneMouseEvent *event)
}
if (d->selectByMouse) {
setKeepMouseGrab(false);
d->selectPressed = true;
d->pressPos = event->pos();
}
bool mark = event->modifiers() & Qt::ShiftModifier;
bool mark = (event->modifiers() & Qt::ShiftModifier) && d->selectByMouse;
int cursor = d->xToPos(event->pos().x());
d->control->moveCursor(cursor, mark);
event->setAccepted(true);
@ -661,7 +686,7 @@ void QSGTextInput::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Q_D(QSGTextInput);
if (d->sendMouseEventToInputContext(event, QEvent::MouseMove))
return;
if (d->selectByMouse) {
if (d->selectPressed) {
if (qAbs(int(event->pos().x() - d->pressPos.x())) > QApplication::startDragDistance())
setKeepMouseGrab(true);
moveCursorSelection(d->xToPos(event->pos().x()), d->mouseSelectionMode);
@ -676,8 +701,10 @@ void QSGTextInput::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Q_D(QSGTextInput);
if (d->sendMouseEventToInputContext(event, QEvent::MouseButtonRelease))
return;
if (d->selectByMouse)
if (d->selectPressed) {
d->selectPressed = false;
setKeepMouseGrab(false);
}
if (!d->showInputPanelOnFocus) { // input panel on click
if (d->focusOnPress && !isReadOnly() && boundingRect().contains(event->pos())) {
if (canvas() && canvas() == qApp->focusWidget()) {
@ -731,6 +758,8 @@ bool QSGTextInputPrivate::sendMouseEventToInputContext(
void QSGTextInput::mouseUngrabEvent()
{
Q_D(QSGTextInput);
d->selectPressed = false;
setKeepMouseGrab(false);
}

View File

@ -1,4 +1,4 @@
// Commit: 27e4302b7f45f22180693d26747f419177c81e27
// Commit: 2f173e4945dd8414636c1061acfaf9c2d8b718d8
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -83,7 +83,7 @@ class Q_AUTOTEST_EXPORT QSGTextInput : public QSGImplicitSizePaintedItem
Q_PROPERTY(QValidator* validator READ validator WRITE setValidator NOTIFY validatorChanged)
#endif
Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask NOTIFY inputMaskChanged)
Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ inputMethodHints WRITE setInputMethodHints)
Q_PROPERTY(Qt::InputMethodHints inputMethodHints READ imHints WRITE setIMHints)
Q_PROPERTY(bool acceptableInput READ hasAcceptableInput NOTIFY acceptableInputChanged)
Q_PROPERTY(EchoMode echoMode READ echoMode WRITE setEchoMode NOTIFY echoModeChanged)
@ -212,6 +212,9 @@ public:
bool isInputMethodComposing() const;
Qt::InputMethodHints imHints() const;
void setIMHints(Qt::InputMethodHints hints);
Q_SIGNALS:
void textChanged();
void cursorPositionChanged();

View File

@ -1,4 +1,4 @@
// Commit: 27e4302b7f45f22180693d26747f419177c81e27
// Commit: 47712d1f330e4b22ce6dd30e7557288ef7f7fca0
/****************************************************************************
**
** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
@ -72,10 +72,11 @@ public:
QSGTextInputPrivate() : control(new QLineControl(QString())),
color((QRgb)0), style(QSGText::Normal),
styleColor((QRgb)0), hAlign(QSGTextInput::AlignLeft),
mouseSelectionMode(QSGTextInput::SelectCharacters),
mouseSelectionMode(QSGTextInput::SelectCharacters), inputMethodHints(Qt::ImhNone),
hscroll(0), oldScroll(0), oldValidity(false), focused(false), focusOnPress(true),
showInputPanelOnFocus(true), clickCausedFocus(false), cursorVisible(false),
autoScroll(true), selectByMouse(false), canPaste(false), hAlignImplicit(true)
autoScroll(true), selectByMouse(false), canPaste(false), hAlignImplicit(true),
selectPressed(false)
{
#ifdef Q_OS_SYMBIAN
if (QSysInfo::symbianVersion() == QSysInfo::SV_SF_1 || QSysInfo::symbianVersion() == QSysInfo::SV_SF_3) {
@ -106,6 +107,7 @@ public:
void mirrorChange();
int calculateTextWidth();
bool sendMouseEventToInputContext(QGraphicsSceneMouseEvent *event, QEvent::Type eventType);
void updateInputMethodHints();
QLineControl* control;
@ -118,6 +120,7 @@ public:
QColor styleColor;
QSGTextInput::HAlignment hAlign;
QSGTextInput::SelectionMode mouseSelectionMode;
Qt::InputMethodHints inputMethodHints;
QPointer<QDeclarativeComponent> cursorComponent;
QPointer<QSGItem> cursorItem;
QPointF pressPos;
@ -139,6 +142,7 @@ public:
bool selectByMouse:1;
bool canPaste:1;
bool hAlignImplicit:1;
bool selectPressed:1;
static inline QSGTextInputPrivate *get(QSGTextInput *t) {
return t->d_func();

View File

@ -246,7 +246,7 @@ void QDeclarativeCompiledData::dumpInstructions()
{
if (!name.isEmpty())
qWarning() << name;
qWarning().nospace() << "Index\tLine\tOperation\t\tData1\tData2\tData3\tComments";
qWarning().nospace() << "Index\tOperation\t\tData1\tData2\tData3\tComments";
qWarning().nospace() << "-------------------------------------------------------------------------------";
for (int ii = 0; ii < bytecode.count(); ++ii) {
dump(&bytecode[ii], ii);

View File

@ -323,7 +323,6 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop,
QDeclarativeParser::Value *v)
{
QDeclarativeInstruction instr;
instr.line = v->location.start.line;
if (prop.isEnumType()) {
int value;
if (v->value.isNumber()) {
@ -539,6 +538,7 @@ void QDeclarativeCompiler::genLiteralAssignment(const QMetaProperty &prop,
instr.type = QDeclarativeInstruction::AssignCustomType;
instr.assignCustomType.propertyIndex = prop.propertyIndex();
instr.assignCustomType.valueIndex = index;
instr.assignCustomType.line = v->location.start.line;
QDeclarativeCompiledData::CustomTypeData data;
data.index = output->indexForString(string);
@ -665,7 +665,6 @@ void QDeclarativeCompiler::compileTree(QDeclarativeParser::Object *tree)
QDeclarativeInstruction import;
import.type = QDeclarativeInstruction::StoreImportedScript;
import.line = 0;
import.storeScript.value = output->scripts.count();
QDeclarativeScriptData *scriptData = script.script->scriptData();
@ -687,7 +686,6 @@ void QDeclarativeCompiler::compileTree(QDeclarativeParser::Object *tree)
QDeclarativeInstruction init;
init.type = QDeclarativeInstruction::Init;
init.line = 0;
init.init.bindingsSize = compileState.bindings.count();
init.init.parserStatusSize = compileState.parserStatusCount;
init.init.contextCache = genContextCache();
@ -700,7 +698,6 @@ void QDeclarativeCompiler::compileTree(QDeclarativeParser::Object *tree)
genObject(tree);
QDeclarativeInstruction def;
init.line = 0;
def.type = QDeclarativeInstruction::SetDefault;
output->bytecode << def;
@ -911,10 +908,10 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
QDeclarativeInstruction create;
create.type = QDeclarativeInstruction::CreateSimpleObject;
create.line = obj->location.start.line;
create.createSimple.create = output->types.at(obj->type).type->createFunction();
create.createSimple.typeSize = output->types.at(obj->type).type->createSize();
create.createSimple.type = obj->type;
create.createSimple.line = obj->location.start.line;
create.createSimple.column = obj->location.start.column;
output->bytecode << create;
@ -922,7 +919,7 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
QDeclarativeInstruction create;
create.type = QDeclarativeInstruction::CreateObject;
create.line = obj->location.start.line;
create.create.line = obj->location.start.line;
create.create.column = obj->location.start.column;
create.create.data = -1;
if (!obj->custom.isEmpty())
@ -944,7 +941,6 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
if (!obj->metadata.isEmpty()) {
QDeclarativeInstruction meta;
meta.type = QDeclarativeInstruction::StoreMetaObject;
meta.line = 0;
meta.storeMeta.data = output->indexForByteArray(obj->metadata);
meta.storeMeta.aliasData = output->indexForByteArray(obj->synthdata);
meta.storeMeta.propertyCache = output->propertyCaches.count();
@ -979,7 +975,6 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
if (!obj->id.isEmpty()) {
QDeclarativeInstruction id;
id.type = QDeclarativeInstruction::SetId;
id.line = 0;
id.setId.value = output->indexForString(obj->id);
id.setId.index = obj->idIndex;
output->bytecode << id;
@ -990,7 +985,6 @@ void QDeclarativeCompiler::genObject(QDeclarativeParser::Object *obj)
QDeclarativeInstruction begin;
begin.type = QDeclarativeInstruction::BeginObject;
begin.begin.castValue = obj->parserStatusCast;
begin.line = obj->location.start.line;
output->bytecode << begin;
}
@ -1022,7 +1016,6 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
if (seenDefer) {
QDeclarativeInstruction defer;
defer.type = QDeclarativeInstruction::Defer;
defer.line = 0;
defer.defer.deferCount = 0;
int deferIdx = output->bytecode.count();
output->bytecode << defer;
@ -1055,7 +1048,7 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
QDeclarativeInstruction assign;
assign.type = QDeclarativeInstruction::AssignSignalObject;
assign.line = v->location.start.line;
assign.assignSignalObject.line = v->location.start.line;
assign.assignSignalObject.signal =
output->indexForByteArray(prop->name);
output->bytecode << assign;
@ -1066,12 +1059,12 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
QDeclarativeInstruction store;
store.type = QDeclarativeInstruction::StoreSignal;
store.line = v->location.start.line;
store.storeSignal.signalIndex = prop->index;
store.storeSignal.value =
output->indexForString(v->value.asScript().trimmed());
store.storeSignal.context = ctxt.stack;
store.storeSignal.name = output->indexForByteArray(prop->name);
store.storeSignal.line = v->location.start.line;
output->bytecode << store;
}
@ -1081,15 +1074,14 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
foreach(Property *prop, obj->attachedProperties) {
QDeclarativeInstruction fetch;
fetch.type = QDeclarativeInstruction::FetchAttached;
fetch.line = prop->location.start.line;
fetch.fetchAttached.id = prop->index;
fetch.fetchAttached.line = prop->location.start.line;
output->bytecode << fetch;
genObjectBody(prop->value);
QDeclarativeInstruction pop;
pop.type = QDeclarativeInstruction::PopFetchedObject;
pop.line = prop->location.start.line;
output->bytecode << pop;
}
@ -1097,13 +1089,12 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
QDeclarativeInstruction fetch;
fetch.type = QDeclarativeInstruction::FetchObject;
fetch.fetch.property = prop->index;
fetch.line = prop->location.start.line;
fetch.fetch.line = prop->location.start.line;
output->bytecode << fetch;
if (!prop->value->metadata.isEmpty()) {
QDeclarativeInstruction meta;
meta.type = QDeclarativeInstruction::StoreMetaObject;
meta.line = 0;
meta.storeMeta.data = output->indexForByteArray(prop->value->metadata);
meta.storeMeta.aliasData = output->indexForByteArray(prop->value->synthdata);
meta.storeMeta.propertyCache = -1;
@ -1114,7 +1105,6 @@ void QDeclarativeCompiler::genObjectBody(QDeclarativeParser::Object *obj)
QDeclarativeInstruction pop;
pop.type = QDeclarativeInstruction::PopFetchedObject;
pop.line = prop->location.start.line;
output->bytecode << pop;
}
@ -1143,7 +1133,6 @@ void QDeclarativeCompiler::genValueTypeProperty(QDeclarativeParser::Object *obj,
fetch.fetchValue.property = prop->index;
fetch.fetchValue.type = prop->type;
fetch.fetchValue.bindingSkipList = 0;
fetch.line = prop->location.start.line;
if (obj->type == -1 || output->types.at(obj->type).component) {
// We only have to do this if this is a composite type. If it is a builtin
@ -1167,7 +1156,6 @@ void QDeclarativeCompiler::genValueTypeProperty(QDeclarativeParser::Object *obj,
pop.fetchValue.property = prop->index;
pop.fetchValue.type = prop->type;
pop.fetchValue.bindingSkipList = 0;
pop.line = prop->location.start.line;
output->bytecode << pop;
}
@ -1178,7 +1166,7 @@ void QDeclarativeCompiler::genComponent(QDeclarativeParser::Object *obj)
QDeclarativeInstruction create;
create.type = QDeclarativeInstruction::CreateComponent;
create.line = root->location.start.line;
create.createComponent.line = root->location.start.line;
create.createComponent.column = root->location.start.column;
create.createComponent.endLine = root->location.end.line;
output->bytecode << create;
@ -1196,13 +1184,11 @@ void QDeclarativeCompiler::genComponent(QDeclarativeParser::Object *obj)
init.init.compiledBinding = -1;
else
init.init.compiledBinding = output->indexForByteArray(compileState.compiledBindingData);
init.line = obj->location.start.line;
output->bytecode << init;
genObject(root);
QDeclarativeInstruction def;
init.line = 0;
def.type = QDeclarativeInstruction::SetDefault;
output->bytecode << def;
@ -1214,7 +1200,6 @@ void QDeclarativeCompiler::genComponent(QDeclarativeParser::Object *obj)
if (!obj->id.isEmpty()) {
QDeclarativeInstruction id;
id.type = QDeclarativeInstruction::SetId;
id.line = 0;
id.setId.value = output->indexForString(obj->id);
id.setId.index = obj->idIndex;
output->bytecode << id;
@ -1608,7 +1593,6 @@ void QDeclarativeCompiler::genListProperty(QDeclarativeParser::Property *prop,
QDeclarativeInstruction fetch;
fetch.type = QDeclarativeInstruction::FetchQList;
fetch.line = prop->location.start.line;
fetch.fetchQmlList.property = prop->index;
bool listTypeIsInterface = QDeclarativeMetaType::isInterface(listType);
fetch.fetchQmlList.type = listType;
@ -1623,12 +1607,11 @@ void QDeclarativeCompiler::genListProperty(QDeclarativeParser::Property *prop,
if (listTypeIsInterface) {
QDeclarativeInstruction assign;
assign.type = QDeclarativeInstruction::AssignObjectList;
assign.line = prop->location.start.line;
assign.assignObjectList.line = prop->location.start.line;
output->bytecode << assign;
} else {
QDeclarativeInstruction store;
store.type = QDeclarativeInstruction::StoreObjectQList;
store.line = prop->location.start.line;
output->bytecode << store;
}
@ -1642,7 +1625,6 @@ void QDeclarativeCompiler::genListProperty(QDeclarativeParser::Property *prop,
QDeclarativeInstruction pop;
pop.type = QDeclarativeInstruction::PopQList;
pop.line = prop->location.start.line;
output->bytecode << pop;
}
@ -1665,7 +1647,7 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p
QDeclarativeInstruction store;
store.type = QDeclarativeInstruction::StoreInterface;
store.line = v->object->location.start.line;
store.storeObject.line = v->object->location.start.line;
store.storeObject.propertyIndex = prop->index;
output->bytecode << store;
@ -1673,7 +1655,7 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p
QDeclarativeInstruction store;
store.type = QDeclarativeInstruction::StoreVariantObject;
store.line = v->object->location.start.line;
store.storeObject.line = v->object->location.start.line;
store.storeObject.propertyIndex = prop->index;
output->bytecode << store;
@ -1681,7 +1663,7 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p
QDeclarativeInstruction store;
store.type = QDeclarativeInstruction::StoreObject;
store.line = v->object->location.start.line;
store.storeObject.line = v->object->location.start.line;
store.storeObject.propertyIndex = prop->index;
output->bytecode << store;
@ -1711,7 +1693,6 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p
QDeclarativeInstruction store;
store.type = QDeclarativeInstruction::StoreValueSource;
store.line = v->object->location.start.line;
if (valueTypeProperty) {
store.assignValueSource.property = genValueTypeData(prop, valueTypeProperty);
store.assignValueSource.owner = 1;
@ -1728,7 +1709,6 @@ void QDeclarativeCompiler::genPropertyAssignment(QDeclarativeParser::Property *p
QDeclarativeInstruction store;
store.type = QDeclarativeInstruction::StoreValueInterceptor;
store.line = v->object->location.start.line;
if (valueTypeProperty) {
store.assignValueInterceptor.property = genValueTypeData(prop, valueTypeProperty);
store.assignValueInterceptor.owner = 1;
@ -2835,7 +2815,7 @@ void QDeclarativeCompiler::genBindingAssignment(QDeclarativeParser::Value *bindi
((prop->index & 0xFF) << 24);
else
store.assignBinding.property = prop->index;
store.line = binding->location.start.line;
store.assignBinding.line = binding->location.start.line;
output->bytecode << store;
return;
}
@ -2848,7 +2828,7 @@ void QDeclarativeCompiler::genBindingAssignment(QDeclarativeParser::Value *bindi
store.assignBinding.value = output->indexForByteArray(ref.compiledData);
store.assignBinding.context = ref.bindingContext.stack;
store.assignBinding.owner = ref.bindingContext.owner;
store.line = binding->location.start.line;
store.assignBinding.line = binding->location.start.line;
Q_ASSERT(ref.bindingContext.owner == 0 ||
(ref.bindingContext.owner != 0 && valueTypeProperty));

View File

@ -53,178 +53,168 @@ void QDeclarativeCompiledData::dump(QDeclarativeInstruction *instr, int idx)
Q_UNUSED(instr)
Q_UNUSED(idx)
#else
QByteArray lineNumber = QByteArray::number(instr->line);
if (instr->line == (unsigned short)-1)
lineNumber = "NA";
const char *line = lineNumber.constData();
switch(instr->type) {
case QDeclarativeInstruction::Init:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "INIT\t\t\t" << instr->init.bindingsSize << "\t" << instr->init.parserStatusSize << "\t" << instr->init.contextCache << "\t" << instr->init.compiledBinding;
qWarning().nospace() << idx << "\t\t" << "INIT\t\t\t" << instr->init.bindingsSize << "\t" << instr->init.parserStatusSize << "\t" << instr->init.contextCache << "\t" << instr->init.compiledBinding;
break;
case QDeclarativeInstruction::CreateObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE\t\t\t" << instr->create.type << "\t" << instr->create.bindingBits << "\t\t" << types.at(instr->create.type).className;
qWarning().nospace() << idx << "\t\t" << "CREATE\t\t\t" << instr->create.type << "\t" << instr->create.bindingBits << "\t\t" << types.at(instr->create.type).className;
break;
case QDeclarativeInstruction::CreateSimpleObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE_SIMPLE\t\t" << instr->createSimple.typeSize;
qWarning().nospace() << idx << "\t\t" << "CREATE_SIMPLE\t\t" << instr->createSimple.typeSize;
break;
case QDeclarativeInstruction::SetId:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "SETID\t\t\t" << instr->setId.value << "\t\t\t" << primitives.at(instr->setId.value);
qWarning().nospace() << idx << "\t\t" << "SETID\t\t\t" << instr->setId.value << "\t\t\t" << primitives.at(instr->setId.value);
break;
case QDeclarativeInstruction::SetDefault:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "SET_DEFAULT";
qWarning().nospace() << idx << "\t\t" << "SET_DEFAULT";
break;
case QDeclarativeInstruction::CreateComponent:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "CREATE_COMPONENT\t" << instr->createComponent.count;
qWarning().nospace() << idx << "\t\t" << "CREATE_COMPONENT\t" << instr->createComponent.count;
break;
case QDeclarativeInstruction::StoreMetaObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_META\t\t" << instr->storeMeta.data;
qWarning().nospace() << idx << "\t\t" << "STORE_META\t\t" << instr->storeMeta.data;
break;
case QDeclarativeInstruction::StoreFloat:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_FLOAT\t\t" << instr->storeFloat.propertyIndex << "\t" << instr->storeFloat.value;
qWarning().nospace() << idx << "\t\t" << "STORE_FLOAT\t\t" << instr->storeFloat.propertyIndex << "\t" << instr->storeFloat.value;
break;
case QDeclarativeInstruction::StoreDouble:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value;
qWarning().nospace() << idx << "\t\t" << "STORE_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value;
break;
case QDeclarativeInstruction::StoreInteger:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value;
qWarning().nospace() << idx << "\t\t" << "STORE_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value;
break;
case QDeclarativeInstruction::StoreBool:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value;
qWarning().nospace() << idx << "\t\t" << "STORE_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value;
break;
case QDeclarativeInstruction::StoreString:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_STRING\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value);
qWarning().nospace() << idx << "\t\t" << "STORE_STRING\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value);
break;
case QDeclarativeInstruction::StoreByteArray:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BYTEARRAY" << instr->storeByteArray.propertyIndex << "\t" << instr->storeByteArray.value << "\t\t" << datas.at(instr->storeByteArray.value);
qWarning().nospace() << idx << "\t\t" << "STORE_BYTEARRAY" << instr->storeByteArray.propertyIndex << "\t" << instr->storeByteArray.value << "\t\t" << datas.at(instr->storeByteArray.value);
break;
case QDeclarativeInstruction::StoreUrl:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_URL\t\t" << instr->storeUrl.propertyIndex << "\t" << instr->storeUrl.value << "\t\t" << urls.at(instr->storeUrl.value);
qWarning().nospace() << idx << "\t\t" << "STORE_URL\t\t" << instr->storeUrl.propertyIndex << "\t" << instr->storeUrl.value << "\t\t" << urls.at(instr->storeUrl.value);
break;
case QDeclarativeInstruction::StoreColor:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_COLOR\t\t" << instr->storeColor.propertyIndex << "\t\t\t" << QString::number(instr->storeColor.value, 16);
qWarning().nospace() << idx << "\t\t" << "STORE_COLOR\t\t" << instr->storeColor.propertyIndex << "\t\t\t" << QString::number(instr->storeColor.value, 16);
break;
case QDeclarativeInstruction::StoreDate:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DATE\t\t" << instr->storeDate.propertyIndex << "\t" << instr->storeDate.value;
qWarning().nospace() << idx << "\t\t" << "STORE_DATE\t\t" << instr->storeDate.propertyIndex << "\t" << instr->storeDate.value;
break;
case QDeclarativeInstruction::StoreTime:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_TIME\t\t" << instr->storeTime.propertyIndex << "\t" << instr->storeTime.valueIndex;
qWarning().nospace() << idx << "\t\t" << "STORE_TIME\t\t" << instr->storeTime.propertyIndex << "\t" << instr->storeTime.valueIndex;
break;
case QDeclarativeInstruction::StoreDateTime:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_DATETIME\t\t" << instr->storeDateTime.propertyIndex << "\t" << instr->storeDateTime.valueIndex;
qWarning().nospace() << idx << "\t\t" << "STORE_DATETIME\t\t" << instr->storeDateTime.propertyIndex << "\t" << instr->storeDateTime.valueIndex;
break;
case QDeclarativeInstruction::StorePoint:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_POINT\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
qWarning().nospace() << idx << "\t\t" << "STORE_POINT\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
break;
case QDeclarativeInstruction::StorePointF:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_POINTF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
qWarning().nospace() << idx << "\t\t" << "STORE_POINTF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
break;
case QDeclarativeInstruction::StoreSize:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIZE\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
qWarning().nospace() << idx << "\t\t" << "STORE_SIZE\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
break;
case QDeclarativeInstruction::StoreSizeF:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIZEF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
qWarning().nospace() << idx << "\t\t" << "STORE_SIZEF\t\t" << instr->storeRealPair.propertyIndex << "\t" << instr->storeRealPair.valueIndex;
break;
case QDeclarativeInstruction::StoreRect:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_RECT\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex;
qWarning().nospace() << idx << "\t\t" << "STORE_RECT\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex;
break;
case QDeclarativeInstruction::StoreRectF:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_RECTF\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex;
qWarning().nospace() << idx << "\t\t" << "STORE_RECTF\t\t" << instr->storeRect.propertyIndex << "\t" << instr->storeRect.valueIndex;
break;
case QDeclarativeInstruction::StoreVector3D:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VECTOR3D\t\t" << instr->storeVector3D.propertyIndex << "\t" << instr->storeVector3D.valueIndex;
qWarning().nospace() << idx << "\t\t" << "STORE_VECTOR3D\t\t" << instr->storeVector3D.propertyIndex << "\t" << instr->storeVector3D.valueIndex;
break;
case QDeclarativeInstruction::StoreVariant:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value);
qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT\t\t" << instr->storeString.propertyIndex << "\t" << instr->storeString.value << "\t\t" << primitives.at(instr->storeString.value);
break;
case QDeclarativeInstruction::StoreVariantInteger:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value;
qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT_INTEGER\t\t" << instr->storeInteger.propertyIndex << "\t" << instr->storeInteger.value;
break;
case QDeclarativeInstruction::StoreVariantDouble:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value;
qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT_DOUBLE\t\t" << instr->storeDouble.propertyIndex << "\t" << instr->storeDouble.value;
break;
case QDeclarativeInstruction::StoreVariantBool:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value;
qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT_BOOL\t\t" << instr->storeBool.propertyIndex << "\t" << instr->storeBool.value;
break;
case QDeclarativeInstruction::StoreObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT\t\t" << instr->storeObject.propertyIndex;
qWarning().nospace() << idx << "\t\t" << "STORE_OBJECT\t\t" << instr->storeObject.propertyIndex;
break;
case QDeclarativeInstruction::StoreVariantObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VARIANT_OBJECT\t" << instr->storeObject.propertyIndex;
qWarning().nospace() << idx << "\t\t" << "STORE_VARIANT_OBJECT\t" << instr->storeObject.propertyIndex;
break;
case QDeclarativeInstruction::StoreInterface:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_INTERFACE\t\t" << instr->storeObject.propertyIndex;
qWarning().nospace() << idx << "\t\t" << "STORE_INTERFACE\t\t" << instr->storeObject.propertyIndex;
break;
case QDeclarativeInstruction::StoreSignal:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value);
qWarning().nospace() << idx << "\t\t" << "STORE_SIGNAL\t\t" << instr->storeSignal.signalIndex << "\t" << instr->storeSignal.value << "\t\t" << primitives.at(instr->storeSignal.value);
break;
case QDeclarativeInstruction::StoreImportedScript:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_IMPORTED_SCRIPT\t" << instr->storeScript.value;
qWarning().nospace() << idx << "\t\t" << "STORE_IMPORTED_SCRIPT\t" << instr->storeScript.value;
break;
case QDeclarativeInstruction::StoreScriptString:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_SCRIPT_STRING\t" << instr->storeScriptString.propertyIndex << "\t" << instr->storeScriptString.value << "\t" << instr->storeScriptString.scope;
qWarning().nospace() << idx << "\t\t" << "STORE_SCRIPT_STRING\t" << instr->storeScriptString.propertyIndex << "\t" << instr->storeScriptString.value << "\t" << instr->storeScriptString.scope;
break;
case QDeclarativeInstruction::AssignSignalObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << datas.at(instr->assignSignalObject.signal);
qWarning().nospace() << idx << "\t\t" << "ASSIGN_SIGNAL_OBJECT\t" << instr->assignSignalObject.signal << "\t\t\t" << datas.at(instr->assignSignalObject.signal);
break;
case QDeclarativeInstruction::AssignCustomType:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_CUSTOMTYPE\t" << instr->assignCustomType.propertyIndex << "\t" << instr->assignCustomType.valueIndex;
qWarning().nospace() << idx << "\t\t" << "ASSIGN_CUSTOMTYPE\t" << instr->assignCustomType.propertyIndex << "\t" << instr->assignCustomType.valueIndex;
break;
case QDeclarativeInstruction::StoreBinding:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
qWarning().nospace() << idx << "\t\t" << "STORE_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
break;
case QDeclarativeInstruction::StoreBindingOnAlias:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_BINDING_ALIAS\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
qWarning().nospace() << idx << "\t\t" << "STORE_BINDING_ALIAS\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
break;
case QDeclarativeInstruction::StoreCompiledBinding:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_COMPILED_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
qWarning().nospace() << idx << "\t\t" << "STORE_COMPILED_BINDING\t" << instr->assignBinding.property << "\t" << instr->assignBinding.value << "\t" << instr->assignBinding.context;
break;
case QDeclarativeInstruction::StoreValueSource:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue;
qWarning().nospace() << idx << "\t\t" << "STORE_VALUE_SOURCE\t" << instr->assignValueSource.property << "\t" << instr->assignValueSource.castValue;
break;
case QDeclarativeInstruction::StoreValueInterceptor:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_VALUE_INTERCEPTOR\t" << instr->assignValueInterceptor.property << "\t" << instr->assignValueInterceptor.castValue;
qWarning().nospace() << idx << "\t\t" << "STORE_VALUE_INTERCEPTOR\t" << instr->assignValueInterceptor.property << "\t" << instr->assignValueInterceptor.castValue;
break;
case QDeclarativeInstruction::BeginObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "BEGIN\t\t\t" << instr->begin.castValue;
qWarning().nospace() << idx << "\t\t" << "BEGIN\t\t\t" << instr->begin.castValue;
break;
case QDeclarativeInstruction::StoreObjectQList:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "STORE_OBJECT_QLIST";
qWarning().nospace() << idx << "\t\t" << "STORE_OBJECT_QLIST";
break;
case QDeclarativeInstruction::AssignObjectList:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "ASSIGN_OBJECT_LIST";
qWarning().nospace() << idx << "\t\t" << "ASSIGN_OBJECT_LIST";
break;
case QDeclarativeInstruction::FetchAttached:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_ATTACHED\t\t" << instr->fetchAttached.id;
qWarning().nospace() << idx << "\t\t" << "FETCH_ATTACHED\t\t" << instr->fetchAttached.id;
break;
case QDeclarativeInstruction::FetchQList:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_QLIST\t\t" << instr->fetch.property;
qWarning().nospace() << idx << "\t\t" << "FETCH_QLIST\t\t" << instr->fetch.property;
break;
case QDeclarativeInstruction::FetchObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH\t\t\t" << instr->fetch.property;
qWarning().nospace() << idx << "\t\t" << "FETCH\t\t\t" << instr->fetch.property;
break;
case QDeclarativeInstruction::FetchValueType:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "FETCH_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type << "\t" << instr->fetchValue.bindingSkipList;
qWarning().nospace() << idx << "\t\t" << "FETCH_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type << "\t" << instr->fetchValue.bindingSkipList;
break;
case QDeclarativeInstruction::PopFetchedObject:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP";
qWarning().nospace() << idx << "\t\t" << "POP";
break;
case QDeclarativeInstruction::PopQList:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP_QLIST";
qWarning().nospace() << idx << "\t\t" << "POP_QLIST";
break;
case QDeclarativeInstruction::PopValueType:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "POP_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type;
qWarning().nospace() << idx << "\t\t" << "POP_VALUE\t\t" << instr->fetchValue.property << "\t" << instr->fetchValue.type;
break;
case QDeclarativeInstruction::Defer:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "DEFER" << "\t\t\t" << instr->defer.deferCount;
qWarning().nospace() << idx << "\t\t" << "DEFER" << "\t\t\t" << instr->defer.deferCount;
break;
default:
qWarning().nospace() << idx << "\t\t" << line << "\t" << "XXX UNKNOWN INSTRUCTION" << "\t" << instr->type;
qWarning().nospace() << idx << "\t\t" << "XXX UNKNOWN INSTRUCTION" << "\t" << instr->type;
break;
}
#endif // QT_NO_DEBUG_STREAM

View File

@ -142,7 +142,7 @@ public:
BeginObject, /* begin */
StoreObjectQList, /* NA */
AssignObjectList, /* NA */
AssignObjectList, /* assignObjectList */
FetchAttached, /* fetchAttached */
FetchQList, /* fetch */
@ -163,11 +163,9 @@ public:
//
Defer /* defer */
};
QDeclarativeInstruction()
: line(0) {}
QDeclarativeInstruction() {}
Type type;
unsigned short line;
struct InitInstruction {
int bindingsSize;
@ -180,12 +178,14 @@ public:
int data;
int bindingBits;
ushort column;
ushort line;
};
struct CreateSimpleInstruction {
void (*create)(void *);
int typeSize;
int type;
ushort column;
ushort line;
};
struct StoreMetaInstruction {
int data;
@ -211,9 +211,11 @@ public:
int value;
short context;
short owner;
ushort line;
};
struct FetchInstruction {
int property;
ushort line;
};
struct FetchValueInstruction {
int property;
@ -293,32 +295,41 @@ public:
};
struct StoreObjectInstruction {
int propertyIndex;
ushort line;
};
struct AssignCustomTypeInstruction {
int propertyIndex;
int valueIndex;
ushort line;
};
struct StoreSignalInstruction {
int signalIndex;
int value;
short context;
int name;
ushort line;
};
struct AssignSignalObjectInstruction {
int signal;
ushort line;
};
struct CreateComponentInstruction {
int count;
ushort column;
int endLine;
int metaObject;
ushort column;
ushort line;
};
struct FetchAttachedInstruction {
int id;
ushort line;
};
struct DeferInstruction {
int deferCount;
};
struct AssignObjectListInstruction {
ushort line;
};
union {
InitInstruction init;
@ -356,6 +367,7 @@ public:
CreateComponentInstruction createComponent;
FetchAttachedInstruction fetchAttached;
DeferInstruction defer;
AssignObjectListInstruction assignObjectList;
};
void dump(QDeclarativeCompiledData *);

View File

@ -80,11 +80,11 @@ QDeclarativeVME::QDeclarativeVME()
{
}
#define VME_EXCEPTION(desc) \
#define VME_EXCEPTION(desc, line) \
{ \
QDeclarativeError error; \
error.setDescription(desc.trimmed()); \
error.setLine(instr.line); \
error.setLine(line); \
error.setUrl(comp->url); \
vmeErrors << error; \
break; \
@ -207,7 +207,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
types.at(instr.create.type).createInstance(ctxt, bindings, &vmeErrors);
if (!o) {
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create object of type %1").arg(QString::fromLatin1(types.at(instr.create.type).className)));
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create object of type %1").arg(QString::fromLatin1(types.at(instr.create.type).className)), instr.create.line);
}
QDeclarativeData *ddata = QDeclarativeData::get(o);
@ -232,7 +232,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
ddata->setImplicitDestructible();
ddata->outerContext = ctxt;
ddata->lineNumber = instr.line;
ddata->lineNumber = instr.create.line;
ddata->columnNumber = instr.create.column;
if (instr.create.data != -1) {
@ -271,7 +271,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
ddata->propertyCache = ref.typePropertyCache;
ddata->propertyCache->addref();
}
ddata->lineNumber = instr.line;
ddata->lineNumber = instr.createSimple.line;
ddata->columnNumber = instr.createSimple.column;
QObjectPrivate::get(o)->declarativeData = ddata;
@ -319,8 +319,8 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
ddata->setImplicitDestructible();
ddata->outerContext = ctxt;
ddata->lineNumber = instr.line;
ddata->columnNumber = instr.create.column;
ddata->lineNumber = instr.createComponent.line;
ddata->columnNumber = instr.createComponent.column;
QDeclarativeComponentPrivate::get(qcomp)->creationContext = ctxt;
@ -657,7 +657,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
QMetaProperty prop =
target->metaObject()->property(instr.assignCustomType.propertyIndex);
if (v.isNull() || ((int)prop.type() != data.type && prop.userType() != data.type))
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign value %1 to property %2").arg(primitive).arg(QString::fromUtf8(prop.name())));
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign value %1 to property %2").arg(primitive).arg(QString::fromUtf8(prop.name())), instr.assignCustomType.line);
void *a[] = { (void *)v.data(), 0, &status, &flags };
QMetaObject::metacall(target, QMetaObject::WriteProperty,
@ -679,15 +679,15 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
QMetaMethod method = QDeclarativeMetaType::defaultMethod(assign);
if (method.signature() == 0)
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())));
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object type %1 with no default method").arg(QString::fromLatin1(assign->metaObject()->className())), instr.assignSignalObject.line);
if (!QMetaObject::checkConnectArgs(prop.method().signature(), method.signature()))
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature())));
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot connect mismatched signal/slot %1 %vs. %2").arg(QString::fromLatin1(method.signature())).arg(QString::fromLatin1(prop.method().signature())), instr.assignSignalObject.line);
QDeclarativePropertyPrivate::connect(target, prop.index(), assign, method.methodIndex());
} else {
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr)));
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign an object to signal property %1").arg(QString::fromUtf8(pr)), instr.assignSignalObject.line);
}
@ -704,7 +704,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
QDeclarativeBoundSignal *bs = new QDeclarativeBoundSignal(target, signal, target);
QDeclarativeExpression *expr =
new QDeclarativeExpression(ctxt, context, primitives.at(instr.storeSignal.value));
expr->setSourceLocation(comp->name, instr.line);
expr->setSourceLocation(comp->name, instr.storeSignal.line);
static_cast<QDeclarativeExpressionPrivate *>(QObjectPrivate::get(expr))->name = datas.at(instr.storeSignal.name);
bs->setExpression(expr);
}
@ -758,7 +758,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
if ((stack.count() - instr.assignBinding.owner) == 1 && bindingSkipList.testBit(coreIndex))
break;
QDeclarativeBinding *bind = new QDeclarativeBinding((void *)datas.at(instr.assignBinding.value).constData(), comp, context, ctxt, comp->name, instr.line, 0);
QDeclarativeBinding *bind = new QDeclarativeBinding((void *)datas.at(instr.assignBinding.value).constData(), comp, context, ctxt, comp->name, instr.assignBinding.line, 0);
bindValues.append(bind);
bind->m_mePtr = &bindValues.values[bindValues.count - 1];
bind->setTarget(mp);
@ -841,7 +841,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
if (iid)
ptr = assign->qt_metacast(iid);
if (!ptr)
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object to list"));
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object to list"), instr.assignObjectList.line);
list.qListProperty.append((QDeclarativeListProperty<void>*)&list.qListProperty, ptr);
@ -884,7 +884,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
}
if (!ok)
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object to interface property"));
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot assign object to interface property"), instr.storeObject.line);
}
break;
@ -895,7 +895,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
QObject *qmlObject = qmlAttachedPropertiesObjectById(instr.fetchAttached.id, target);
if (!qmlObject)
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create attached object"));
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Unable to create attached object"), instr.fetchAttached.line);
stack.push(qmlObject);
}
@ -927,7 +927,7 @@ QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
instr.fetch.property, a);
if (!obj)
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot set properties on %1 as it is null").arg(QString::fromUtf8(target->metaObject()->property(instr.fetch.property).name())));
VME_EXCEPTION(QCoreApplication::translate("QDeclarativeVME","Cannot set properties on %1 as it is null").arg(QString::fromUtf8(target->metaObject()->property(instr.fetch.property).name())), instr.fetch.line);
stack.push(obj);
}

View File

@ -48,9 +48,18 @@
#include <QtCore/qvarlengtharray.h>
#include <QtGui/qapplication.h>
#include <QtCore/qpair.h>
#include <QtCore/QElapsedTimer>
//#define FORCE_NO_REORDER
// #define RENDERER_DEBUG
#ifdef RENDERER_DEBUG
#define DEBUG_THRESHOLD 0
QElapsedTimer debugTimer;
int materialChanges;
int geometryNodesDrawn;
#endif
QT_BEGIN_NAMESPACE
static bool nodeLessThan(QSGGeometryNode *a, QSGGeometryNode *b)
@ -187,6 +196,13 @@ void QMLRenderer::render()
}
#endif
#ifdef RENDERER_DEBUG
debugTimer.invalidate();
debugTimer.start();
geometryNodesDrawn = 0;
materialChanges = 0;
#endif
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_BLEND);
@ -205,8 +221,16 @@ void QMLRenderer::render()
glDisable(GL_SCISSOR_TEST);
glClearColor(m_clear_color.redF(), m_clear_color.greenF(), m_clear_color.blueF(), m_clear_color.alphaF());
#ifdef RENDERER_DEBUG
int debugtimeSetup = debugTimer.elapsed();
#endif
bindable()->clear(clearMode());
#ifdef RENDERER_DEBUG
int debugtimeClear = debugTimer.elapsed();
#endif
QRect r = viewportRect();
glViewport(r.x(), deviceRect().bottom() - r.bottom(), r.width(), r.height());
m_projectionMatrix = projectMatrix();
@ -228,6 +252,11 @@ void QMLRenderer::render()
m_rebuild_lists = false;
}
#ifdef RENDERER_DEBUG
int debugtimeLists = debugTimer.elapsed();
#endif
if (m_needs_sorting) {
qSort(m_opaqueNodes.begin(), m_opaqueNodes.end(),
m_sort_front_to_back
@ -236,6 +265,10 @@ void QMLRenderer::render()
m_needs_sorting = false;
}
#ifdef RENDERER_DEBUG
int debugtimeSorting = debugTimer.elapsed();
#endif
m_renderOrderMatrix.setToIdentity();
m_renderOrderMatrix.scale(1, 1, qreal(1) / m_currentRenderOrder);
@ -252,6 +285,12 @@ void QMLRenderer::render()
renderNodes(m_opaqueNodes);
}
#ifdef RENDERER_DEBUG
int debugtimeOpaque = debugTimer.elapsed();
int opaqueNodes = geometryNodesDrawn;
int opaqueMaterialChanges = materialChanges;
#endif
glEnable(GL_BLEND);
glDepthMask(false);
#ifdef QML_RUNTIME_TESTING
@ -265,10 +304,33 @@ void QMLRenderer::render()
renderNodes(m_transparentNodes);
}
#ifdef RENDERER_DEBUG
int debugtimeAlpha = debugTimer.elapsed();
#endif
if (m_currentProgram)
m_currentProgram->deactivate();
m_projectionMatrix.pop();
#ifdef RENDERER_DEBUG
if (debugTimer.elapsed() > DEBUG_THRESHOLD) {
printf(" --- Renderer breakdown:\n"
" - setup=%d, clear=%d, building=%d, sorting=%d, opaque=%d, alpha=%d\n"
" - material changes: opaque=%d, alpha=%d, total=%d\n"
" - geometry ndoes: opaque=%d, alpha=%d, total=%d\n",
debugtimeSetup,
debugtimeClear - debugtimeSetup,
debugtimeLists - debugtimeClear,
debugtimeSorting - debugtimeLists,
debugtimeOpaque - debugtimeSorting,
debugtimeAlpha - debugtimeOpaque,
opaqueMaterialChanges, materialChanges - opaqueMaterialChanges, materialChanges,
opaqueNodes, geometryNodesDrawn - opaqueNodes, geometryNodesDrawn);
}
#endif
}
class Foo : public QPair<int, QSGGeometryNode *>
@ -426,6 +488,10 @@ void QMLRenderer::renderNodes(const QVector<QSGGeometryNode *> &list)
m_currentProgram->activate();
//++programChangeCount;
updates |= (QSGMaterialShader::RenderState::DirtyMatrix | QSGMaterialShader::RenderState::DirtyOpacity);
#ifdef RENDERER_DEBUG
materialChanges++;
#endif
}
bool changeRenderOrder = currentRenderOrder != geomNode->renderOrder();
@ -449,6 +515,10 @@ void QMLRenderer::renderNodes(const QVector<QSGGeometryNode *> &list)
const QSGGeometry *g = geomNode->geometry();
bindGeometry(program, g);
draw(geomNode);
#ifdef RENDERER_DEBUG
geometryNodesDrawn++;
#endif
}
//qDebug("Clip: %i, shader program: %i, material: %i times changed while drawing %s items",
// clipChangeCount, programChangeCount, materialChangeCount,

View File

@ -243,8 +243,7 @@ void QSGRenderer::renderScene(const Bindable &bindable)
m_bindable = 0;
#ifdef QSG_RENDERER_TIMING
printf("Frame #%d: Breakdown of frametime: preprocess=%d, updates=%d, binding=%d, render=%d, total=%d\n",
++frameNumber,
printf(" - Breakdown of frametime: preprocess=%d, updates=%d, binding=%d, render=%d, total=%d\n",
preprocessTime,
updatePassTime - preprocessTime,
bindTime - updatePassTime,

View File

@ -289,7 +289,7 @@ void QDeclarativePixmapReply::postReply(ReadError error, const QString &errorStr
}
QDeclarativePixmapReply::Event::Event(ReadError e, const QString &s, const QSize &iSize, const QImage &i)
: QEvent(QEvent::User), error(e), errorString(s), implicitSize(iSize), image(i)
: QEvent(QEvent::User), error(e), errorString(s), implicitSize(iSize), image(i), texture(0), context(0)
{
}

View File

@ -69,4 +69,6 @@ contains(QT_CONFIG, xmlpatterns) {
QT+=xmlpatterns
SOURCES += $$PWD/qdeclarativexmllistmodel.cpp
HEADERS += $$PWD/qdeclarativexmllistmodel_p.h
} else {
DEFINES += QT_NO_XMLPATTERNS
}

View File

@ -2,7 +2,7 @@ TARGET = qmlgesturesplugin
TARGETPATH = Qt/labs/gestures
include(../qimportbase.pri)
QT += declarative
QT += core-private gui-private declarative-private script-private
SOURCES += qdeclarativegesturearea.cpp plugin.cpp
HEADERS += qdeclarativegesturearea_p.h

View File

@ -48,6 +48,8 @@ HEADERS += \
deformableparticle.h \
pictureaffector.h
QT += core-private gui-private declarative-private
SOURCES += \
V1/qdeclarativeparticles.cpp \
spritestate.cpp \

View File

@ -1,7 +1,7 @@
load(qt_module)
TARGET = qmldbg_tcp
QT += declarative network
QT += declarative-private network
include($$QT_SOURCE_TREE/src/plugins/qpluginbase.pri)

View File

@ -13,3 +13,20 @@
%modulepris = (
"QtDeclarative" => "$basedir/modules/qt_declarative.pri",
);
# Modules and programs, and their dependencies.
# Each of the module version specifiers can take one of the following values:
# - A specific Git revision.
# - "LATEST_REVISION", to always test against the latest revision.
# - "LATEST_RELEASE", to always test against the latest public release.
# - "THIS_REPOSITORY", to indicate that the module is in this repository.
%dependencies = (
"QtDeclarative" => {
"QtScript" => "4d15ca64fc7ca81bdadba9fbeb84d4e98a6c0edc",
"QtSvg" => "1a71611b6ceaf6cdb24ea485a818fc56c956b5f8",
"QtGui" => "0c637cb07ba3c9b353e7e483a209537485cc4e2a",
"QtXmlPatterns" => "26edd6852a62aeec49712a53dcc8d4093192301c",
"QtNetwork" => "0c637cb07ba3c9b353e7e483a209537485cc4e2a",
"QtSql" => "0c637cb07ba3c9b353e7e483a209537485cc4e2a",
"QtCore" => "0c637cb07ba3c9b353e7e483a209537485cc4e2a",
},
);

View File

@ -68,7 +68,6 @@ void tst_qdeclarativeinstruction::dump()
QDeclarativeCompiledData *data = new QDeclarativeCompiledData(0);
{
QDeclarativeInstruction i;
i.line = 0;
i.type = QDeclarativeInstruction::Init;
i.init.bindingsSize = 0;
i.init.parserStatusSize = 3;
@ -83,7 +82,6 @@ void tst_qdeclarativeinstruction::dump()
data->types << ref;
QDeclarativeInstruction i;
i.line = 1;
i.type = QDeclarativeInstruction::CreateObject;
i.create.type = 0;
i.create.data = -1;
@ -96,7 +94,6 @@ void tst_qdeclarativeinstruction::dump()
data->primitives << "testId";
QDeclarativeInstruction i;
i.line = 2;
i.type = QDeclarativeInstruction::SetId;
i.setId.value = data->primitives.count() - 1;
i.setId.index = 0;
@ -105,14 +102,12 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 3;
i.type = QDeclarativeInstruction::SetDefault;
data->bytecode << i;
}
{
QDeclarativeInstruction i;
i.line = 4;
i.type = QDeclarativeInstruction::CreateComponent;
i.createComponent.count = 3;
i.createComponent.column = 4;
@ -124,7 +119,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 5;
i.type = QDeclarativeInstruction::StoreMetaObject;
i.storeMeta.data = 3;
i.storeMeta.aliasData = 6;
@ -135,7 +129,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 6;
i.type = QDeclarativeInstruction::StoreFloat;
i.storeFloat.propertyIndex = 3;
i.storeFloat.value = 11.3;
@ -144,7 +137,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 7;
i.type = QDeclarativeInstruction::StoreDouble;
i.storeDouble.propertyIndex = 4;
i.storeDouble.value = 14.8;
@ -153,7 +145,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 8;
i.type = QDeclarativeInstruction::StoreInteger;
i.storeInteger.propertyIndex = 5;
i.storeInteger.value = 9;
@ -162,7 +153,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 9;
i.type = QDeclarativeInstruction::StoreBool;
i.storeBool.propertyIndex = 6;
i.storeBool.value = true;
@ -173,7 +163,6 @@ void tst_qdeclarativeinstruction::dump()
{
data->primitives << "Test String";
QDeclarativeInstruction i;
i.line = 10;
i.type = QDeclarativeInstruction::StoreString;
i.storeString.propertyIndex = 7;
i.storeString.value = data->primitives.count() - 1;
@ -183,7 +172,6 @@ void tst_qdeclarativeinstruction::dump()
{
data->urls << QUrl("http://www.nokia.com");
QDeclarativeInstruction i;
i.line = 11;
i.type = QDeclarativeInstruction::StoreUrl;
i.storeUrl.propertyIndex = 8;
i.storeUrl.value = data->urls.count() - 1;
@ -192,7 +180,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 12;
i.type = QDeclarativeInstruction::StoreColor;
i.storeColor.propertyIndex = 9;
i.storeColor.value = 0xFF00FF00;
@ -201,7 +188,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 13;
i.type = QDeclarativeInstruction::StoreDate;
i.storeDate.propertyIndex = 10;
i.storeDate.value = 9;
@ -210,7 +196,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 14;
i.type = QDeclarativeInstruction::StoreTime;
i.storeTime.propertyIndex = 11;
i.storeTime.valueIndex = 33;
@ -219,7 +204,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 15;
i.type = QDeclarativeInstruction::StoreDateTime;
i.storeDateTime.propertyIndex = 12;
i.storeDateTime.valueIndex = 44;
@ -228,7 +212,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 16;
i.type = QDeclarativeInstruction::StorePoint;
i.storeRealPair.propertyIndex = 13;
i.storeRealPair.valueIndex = 3;
@ -237,7 +220,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 17;
i.type = QDeclarativeInstruction::StorePointF;
i.storeRealPair.propertyIndex = 14;
i.storeRealPair.valueIndex = 9;
@ -246,7 +228,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 18;
i.type = QDeclarativeInstruction::StoreSize;
i.storeRealPair.propertyIndex = 15;
i.storeRealPair.valueIndex = 8;
@ -255,7 +236,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 19;
i.type = QDeclarativeInstruction::StoreSizeF;
i.storeRealPair.propertyIndex = 16;
i.storeRealPair.valueIndex = 99;
@ -264,7 +244,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 20;
i.type = QDeclarativeInstruction::StoreRect;
i.storeRect.propertyIndex = 17;
i.storeRect.valueIndex = 2;
@ -273,7 +252,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 21;
i.type = QDeclarativeInstruction::StoreRectF;
i.storeRect.propertyIndex = 18;
i.storeRect.valueIndex = 19;
@ -282,7 +260,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 22;
i.type = QDeclarativeInstruction::StoreVector3D;
i.storeVector3D.propertyIndex = 19;
i.storeVector3D.valueIndex = 9;
@ -292,7 +269,6 @@ void tst_qdeclarativeinstruction::dump()
{
data->primitives << "color(1, 1, 1, 1)";
QDeclarativeInstruction i;
i.line = 23;
i.type = QDeclarativeInstruction::StoreVariant;
i.storeString.propertyIndex = 20;
i.storeString.value = data->primitives.count() - 1;
@ -302,7 +278,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 24;
i.type = QDeclarativeInstruction::StoreObject;
i.storeObject.propertyIndex = 21;
data->bytecode << i;
@ -310,7 +285,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 25;
i.type = QDeclarativeInstruction::StoreVariantObject;
i.storeObject.propertyIndex = 22;
data->bytecode << i;
@ -318,7 +292,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 26;
i.type = QDeclarativeInstruction::StoreInterface;
i.storeObject.propertyIndex = 23;
data->bytecode << i;
@ -328,7 +301,6 @@ void tst_qdeclarativeinstruction::dump()
data->primitives << "console.log(1921)";
QDeclarativeInstruction i;
i.line = 27;
i.type = QDeclarativeInstruction::StoreSignal;
i.storeSignal.signalIndex = 2;
i.storeSignal.value = data->primitives.count() - 1;
@ -337,7 +309,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 29;
i.type = QDeclarativeInstruction::StoreScriptString;
i.storeScriptString.propertyIndex = 24;
i.storeScriptString.value = 3;
@ -349,7 +320,6 @@ void tst_qdeclarativeinstruction::dump()
data->datas << "mySignal";
QDeclarativeInstruction i;
i.line = 30;
i.type = QDeclarativeInstruction::AssignSignalObject;
i.assignSignalObject.signal = 0;
data->bytecode << i;
@ -357,7 +327,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 31;
i.type = QDeclarativeInstruction::AssignCustomType;
i.assignCustomType.propertyIndex = 25;
i.assignCustomType.valueIndex = 4;
@ -366,7 +335,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 32;
i.type = QDeclarativeInstruction::StoreBinding;
i.assignBinding.property = 26;
i.assignBinding.value = 3;
@ -377,7 +345,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 33;
i.type = QDeclarativeInstruction::StoreCompiledBinding;
i.assignBinding.property = 27;
i.assignBinding.value = 2;
@ -388,7 +355,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 34;
i.type = QDeclarativeInstruction::StoreValueSource;
i.assignValueSource.property = 29;
i.assignValueSource.owner = 1;
@ -398,7 +364,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 35;
i.type = QDeclarativeInstruction::StoreValueInterceptor;
i.assignValueInterceptor.property = 30;
i.assignValueInterceptor.owner = 2;
@ -408,7 +373,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 36;
i.type = QDeclarativeInstruction::BeginObject;
i.begin.castValue = 4;
data->bytecode << i;
@ -416,21 +380,18 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 38;
i.type = QDeclarativeInstruction::StoreObjectQList;
data->bytecode << i;
}
{
QDeclarativeInstruction i;
i.line = 39;
i.type = QDeclarativeInstruction::AssignObjectList;
data->bytecode << i;
}
{
QDeclarativeInstruction i;
i.line = 40;
i.type = QDeclarativeInstruction::FetchAttached;
i.fetchAttached.id = 23;
data->bytecode << i;
@ -438,7 +399,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 42;
i.type = QDeclarativeInstruction::FetchQList;
i.fetch.property = 32;
data->bytecode << i;
@ -446,7 +406,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 43;
i.type = QDeclarativeInstruction::FetchObject;
i.fetch.property = 33;
data->bytecode << i;
@ -454,7 +413,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 44;
i.type = QDeclarativeInstruction::FetchValueType;
i.fetchValue.property = 34;
i.fetchValue.type = 6;
@ -464,21 +422,18 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 45;
i.type = QDeclarativeInstruction::PopFetchedObject;
data->bytecode << i;
}
{
QDeclarativeInstruction i;
i.line = 46;
i.type = QDeclarativeInstruction::PopQList;
data->bytecode << i;
}
{
QDeclarativeInstruction i;
i.line = 47;
i.type = QDeclarativeInstruction::PopValueType;
i.fetchValue.property = 35;
i.fetchValue.type = 8;
@ -487,7 +442,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 48;
i.type = QDeclarativeInstruction::Defer;
i.defer.deferCount = 7;
data->bytecode << i;
@ -495,7 +449,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = -1;
i.type = QDeclarativeInstruction::Defer;
i.defer.deferCount = 7;
data->bytecode << i;
@ -503,7 +456,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 48;
i.type = QDeclarativeInstruction::StoreImportedScript;
i.storeScript.value = 2;
data->bytecode << i;
@ -511,14 +463,12 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 50;
i.type = (QDeclarativeInstruction::Type)(1234); // Non-existent
data->bytecode << i;
}
{
QDeclarativeInstruction i;
i.line = 51;
i.type = QDeclarativeInstruction::StoreVariantInteger;
i.storeInteger.value = 11;
i.storeInteger.propertyIndex = 32;
@ -527,7 +477,6 @@ void tst_qdeclarativeinstruction::dump()
{
QDeclarativeInstruction i;
i.line = 52;
i.type = QDeclarativeInstruction::StoreVariantDouble;
i.storeDouble.value = 33.7;
i.storeDouble.propertyIndex = 19;
@ -536,59 +485,59 @@ void tst_qdeclarativeinstruction::dump()
QStringList expect;
expect
<< "Index\tLine\tOperation\t\tData1\tData2\tData3\tComments"
<< "Index\tOperation\t\tData1\tData2\tData3\tComments"
<< "-------------------------------------------------------------------------------"
<< "0\t\t0\tINIT\t\t\t0\t3\t-1\t-1"
<< "1\t\t1\tCREATE\t\t\t0\t-1\t\t\"Test\""
<< "2\t\t2\tSETID\t\t\t0\t\t\t\"testId\""
<< "3\t\t3\tSET_DEFAULT"
<< "4\t\t4\tCREATE_COMPONENT\t3"
<< "5\t\t5\tSTORE_META\t\t3"
<< "6\t\t6\tSTORE_FLOAT\t\t3\t11.3"
<< "7\t\t7\tSTORE_DOUBLE\t\t4\t14.8"
<< "8\t\t8\tSTORE_INTEGER\t\t5\t9"
<< "9\t\t9\tSTORE_BOOL\t\t6\ttrue"
<< "10\t\t10\tSTORE_STRING\t\t7\t1\t\t\"Test String\""
<< "11\t\t11\tSTORE_URL\t\t8\t0\t\tQUrl(\"http://www.nokia.com\") "
<< "12\t\t12\tSTORE_COLOR\t\t9\t\t\t\"ff00ff00\""
<< "13\t\t13\tSTORE_DATE\t\t10\t9"
<< "14\t\t14\tSTORE_TIME\t\t11\t33"
<< "15\t\t15\tSTORE_DATETIME\t\t12\t44"
<< "16\t\t16\tSTORE_POINT\t\t13\t3"
<< "17\t\t17\tSTORE_POINTF\t\t14\t9"
<< "18\t\t18\tSTORE_SIZE\t\t15\t8"
<< "19\t\t19\tSTORE_SIZEF\t\t16\t99"
<< "20\t\t20\tSTORE_RECT\t\t17\t2"
<< "21\t\t21\tSTORE_RECTF\t\t18\t19"
<< "22\t\t22\tSTORE_VECTOR3D\t\t19\t9"
<< "23\t\t23\tSTORE_VARIANT\t\t20\t2\t\t\"color(1, 1, 1, 1)\""
<< "24\t\t24\tSTORE_OBJECT\t\t21"
<< "25\t\t25\tSTORE_VARIANT_OBJECT\t22"
<< "26\t\t26\tSTORE_INTERFACE\t\t23"
<< "27\t\t27\tSTORE_SIGNAL\t\t2\t3\t\t\"console.log(1921)\""
<< "28\t\t29\tSTORE_SCRIPT_STRING\t24\t3\t1"
<< "29\t\t30\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\""
<< "30\t\t31\tASSIGN_CUSTOMTYPE\t25\t4"
<< "31\t\t32\tSTORE_BINDING\t26\t3\t2"
<< "32\t\t33\tSTORE_COMPILED_BINDING\t27\t2\t4"
<< "33\t\t34\tSTORE_VALUE_SOURCE\t29\t4"
<< "34\t\t35\tSTORE_VALUE_INTERCEPTOR\t30\t-4"
<< "35\t\t36\tBEGIN\t\t\t4"
<< "36\t\t38\tSTORE_OBJECT_QLIST"
<< "37\t\t39\tASSIGN_OBJECT_LIST"
<< "38\t\t40\tFETCH_ATTACHED\t\t23"
<< "39\t\t42\tFETCH_QLIST\t\t32"
<< "40\t\t43\tFETCH\t\t\t33"
<< "41\t\t44\tFETCH_VALUE\t\t34\t6\t7"
<< "42\t\t45\tPOP"
<< "43\t\t46\tPOP_QLIST"
<< "44\t\t47\tPOP_VALUE\t\t35\t8"
<< "45\t\t48\tDEFER\t\t\t7"
<< "46\t\tNA\tDEFER\t\t\t7"
<< "47\t\t48\tSTORE_IMPORTED_SCRIPT\t2"
<< "48\t\t50\tXXX UNKNOWN INSTRUCTION\t1234"
<< "49\t\t51\tSTORE_VARIANT_INTEGER\t\t32\t11"
<< "50\t\t52\tSTORE_VARIANT_DOUBLE\t\t19\t33.7"
<< "0\t\tINIT\t\t\t0\t3\t-1\t-1"
<< "1\t\tCREATE\t\t\t0\t-1\t\t\"Test\""
<< "2\t\tSETID\t\t\t0\t\t\t\"testId\""
<< "3\t\tSET_DEFAULT"
<< "4\t\tCREATE_COMPONENT\t3"
<< "5\t\tSTORE_META\t\t3"
<< "6\t\tSTORE_FLOAT\t\t3\t11.3"
<< "7\t\tSTORE_DOUBLE\t\t4\t14.8"
<< "8\t\tSTORE_INTEGER\t\t5\t9"
<< "9\t\tSTORE_BOOL\t\t6\ttrue"
<< "10\t\tSTORE_STRING\t\t7\t1\t\t\"Test String\""
<< "11\t\tSTORE_URL\t\t8\t0\t\tQUrl(\"http://www.nokia.com\") "
<< "12\t\tSTORE_COLOR\t\t9\t\t\t\"ff00ff00\""
<< "13\t\tSTORE_DATE\t\t10\t9"
<< "14\t\tSTORE_TIME\t\t11\t33"
<< "15\t\tSTORE_DATETIME\t\t12\t44"
<< "16\t\tSTORE_POINT\t\t13\t3"
<< "17\t\tSTORE_POINTF\t\t14\t9"
<< "18\t\tSTORE_SIZE\t\t15\t8"
<< "19\t\tSTORE_SIZEF\t\t16\t99"
<< "20\t\tSTORE_RECT\t\t17\t2"
<< "21\t\tSTORE_RECTF\t\t18\t19"
<< "22\t\tSTORE_VECTOR3D\t\t19\t9"
<< "23\t\tSTORE_VARIANT\t\t20\t2\t\t\"color(1, 1, 1, 1)\""
<< "24\t\tSTORE_OBJECT\t\t21"
<< "25\t\tSTORE_VARIANT_OBJECT\t22"
<< "26\t\tSTORE_INTERFACE\t\t23"
<< "27\t\tSTORE_SIGNAL\t\t2\t3\t\t\"console.log(1921)\""
<< "28\t\tSTORE_SCRIPT_STRING\t24\t3\t1"
<< "29\t\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\""
<< "30\t\tASSIGN_CUSTOMTYPE\t25\t4"
<< "31\t\tSTORE_BINDING\t26\t3\t2"
<< "32\t\tSTORE_COMPILED_BINDING\t27\t2\t4"
<< "33\t\tSTORE_VALUE_SOURCE\t29\t4"
<< "34\t\tSTORE_VALUE_INTERCEPTOR\t30\t-4"
<< "35\t\tBEGIN\t\t\t4"
<< "36\t\tSTORE_OBJECT_QLIST"
<< "37\t\tASSIGN_OBJECT_LIST"
<< "38\t\tFETCH_ATTACHED\t\t23"
<< "39\t\tFETCH_QLIST\t\t32"
<< "40\t\tFETCH\t\t\t33"
<< "41\t\tFETCH_VALUE\t\t34\t6\t7"
<< "42\t\tPOP"
<< "43\t\tPOP_QLIST"
<< "44\t\tPOP_VALUE\t\t35\t8"
<< "45\t\tDEFER\t\t\t7"
<< "46\t\tDEFER\t\t\t7"
<< "47\t\tSTORE_IMPORTED_SCRIPT\t2"
<< "48\t\tXXX UNKNOWN INSTRUCTION\t1234"
<< "49\t\tSTORE_VARIANT_INTEGER\t\t32\t11"
<< "50\t\tSTORE_VARIANT_DOUBLE\t\t19\t33.7"
<< "-------------------------------------------------------------------------------";
messages = QStringList();

View File

@ -106,7 +106,7 @@ void tst_qsgflickable::create()
QCOMPARE(obj->isInteractive(), true);
QCOMPARE(obj->boundsBehavior(), QSGFlickable::DragAndOvershootBounds);
QCOMPARE(obj->pressDelay(), 0);
QCOMPARE(obj->maximumFlickVelocity(), 2000.);
QCOMPARE(obj->maximumFlickVelocity(), 2500.);
delete obj;
}

View File

@ -106,8 +106,6 @@ private slots:
void QTBUG_12291();
void implicitSize_data();
void implicitSize();
void testQtQuick11Attributes();
void testQtQuick11Attributes_data();
void qtbug_14734();
private:
@ -1323,12 +1321,10 @@ void tst_qsgtext::lineHeight()
qreal h2 = myText->height();
myText->setLineHeight(2.0);
QEXPECT_FAIL("", "QTBUG-17325", Continue);
QVERIFY(myText->height() == h2 * 2.0);
myText->setLineHeightMode(QSGText::FixedHeight);
myText->setLineHeight(10);
QEXPECT_FAIL("", "QTBUG-17325", Continue);
QCOMPARE(myText->height(), myText->lineCount() * 10.0);
delete canvas;
@ -1363,57 +1359,6 @@ void tst_qsgtext::implicitSize()
delete textObject;
}
void tst_qsgtext::testQtQuick11Attributes()
{
QFETCH(QString, code);
QFETCH(QString, warning);
QFETCH(QString, error);
QDeclarativeEngine engine;
QObject *obj;
QDeclarativeComponent valid(&engine);
valid.setData("import QtQuick 2.0; Text { " + code.toUtf8() + " }", QUrl(""));
obj = valid.create();
QVERIFY(obj);
QVERIFY(valid.errorString().isEmpty());
delete obj;
QDeclarativeComponent invalid(&engine);
invalid.setData("import QtQuick 1.0; Text { " + code.toUtf8() + " }", QUrl(""));
QTest::ignoreMessage(QtWarningMsg, warning.toUtf8());
obj = invalid.create();
QCOMPARE(invalid.errorString(), error);
delete obj;
}
void tst_qsgtext::testQtQuick11Attributes_data()
{
QTest::addColumn<QString>("code");
QTest::addColumn<QString>("warning");
QTest::addColumn<QString>("error");
QTest::newRow("maximumLineCount") << "maximumLineCount: 4"
<< "QDeclarativeComponent: Component is not ready"
<< ":1 \"Text.maximumLineCount\" is not available in QtQuick 1.0.\n";
QTest::newRow("lineHeight") << "lineHeight: 2"
<< "QDeclarativeComponent: Component is not ready"
<< ":1 \"Text.lineHeight\" is not available in QtQuick 1.0.\n";
QTest::newRow("lineHeightMode") << "lineHeightMode: Text.ProportionalHeight"
<< "QDeclarativeComponent: Component is not ready"
<< ":1 \"Text.lineHeightMode\" is not available in QtQuick 1.0.\n";
QTest::newRow("lineCount") << "property int foo: lineCount"
<< "<Unknown File>:1: ReferenceError: Can't find variable: lineCount"
<< "";
QTest::newRow("truncated") << "property bool foo: truncated"
<< "<Unknown File>:1: ReferenceError: Can't find variable: truncated"
<< "";
}
void tst_qsgtext::qtbug_14734()
{
QSGView *canvas = createView(SRCDIR "/data/qtbug_14734.qml");

View File

@ -2,7 +2,7 @@ TEMPLATE = app
CONFIG += qt uic console
DESTDIR = ../../bin
QT += declarative
QT += declarative declarative-private core-private
TARGET = qmlplugindump

View File

@ -2,7 +2,7 @@ TEMPLATE = app
TARGET = qmlscene
DESTDIR= ../../bin
QT += declarative
QT += declarative declarative-private
target.path = $$[QT_INSTALL_BINS]
INSTALLS += target

View File

@ -1,4 +1,4 @@
QT += declarative script network sql
QT += core-private gui-private declarative-private script network sql
contains(QT_CONFIG, opengl) {
QT += opengl
DEFINES += GL_SUPPORTED