aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/items
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-08-31 08:55:16 +0200
committerGunnar Sletta <gunnar.sletta@nokia.com>2011-08-31 08:55:16 +0200
commit71478352376022faa9be6d79f2a760c289945ff5 (patch)
tree0f8ff4a88c1b033367337a93d23a329d145ee903 /src/declarative/items
parentc38efcb67cf93ba3e91e184c3b891efef4ef75a3 (diff)
parent05daa9bfe1a03ffe1cc580b6cfd88e093e2493c0 (diff)
Merge branch 'master' into refactor
Conflicts: src/3rdparty/v8 src/declarative/declarative.pro src/declarative/items/qsgcanvas.cpp src/declarative/items/qsgshadereffectsource_p.h src/declarative/items/qsgview.cpp src/declarative/particles/qsgcustomparticle.cpp src/imports/gestures/gestures.pro src/imports/particles/particles.pro src/plugins/qmltooling/qmldbg_inspector/qmldbg_inspector.pro src/qtquick1/qtquick1.pro tests/auto/declarative/examples/examples.pro tests/auto/declarative/qsglistview/qsglistview.pro tests/auto/qtquick1/qdeclarativeviewer/qdeclarativeviewer.pro Change-Id: I423344f83e1835116cad531b877fde6e68a8849a
Diffstat (limited to 'src/declarative/items')
-rw-r--r--src/declarative/items/items.pri1
-rw-r--r--src/declarative/items/qsganimatedimage.cpp3
-rw-r--r--src/declarative/items/qsgborderimage.cpp5
-rw-r--r--src/declarative/items/qsgcanvas.cpp94
-rw-r--r--src/declarative/items/qsgpositioners.cpp34
-rw-r--r--src/declarative/items/qsgpositioners_p.h2
-rw-r--r--src/declarative/items/qsgpositioners_p_p.h38
-rw-r--r--src/declarative/items/qsgshadereffect.cpp12
-rw-r--r--src/declarative/items/qsgshadereffectsource.cpp8
-rw-r--r--src/declarative/items/qsgshadereffectsource_p.h1
-rw-r--r--src/declarative/items/qsgview.cpp47
-rw-r--r--src/declarative/items/qsgview_p.h108
-rw-r--r--src/declarative/items/qsgvisualitemmodel.cpp2
13 files changed, 227 insertions, 128 deletions
diff --git a/src/declarative/items/items.pri b/src/declarative/items/items.pri
index 848c782a6e..9880dd8dc6 100644
--- a/src/declarative/items/items.pri
+++ b/src/declarative/items/items.pri
@@ -53,6 +53,7 @@ HEADERS += \
$$PWD/qsgtranslate_p.h \
$$PWD/qsgclipnode_p.h \
$$PWD/qsgview.h \
+ $$PWD/qsgview_p.h \
$$PWD/qsganimation_p.h \
$$PWD/qsganimation_p_p.h \
$$PWD/qsgstateoperations_p.h \
diff --git a/src/declarative/items/qsganimatedimage.cpp b/src/declarative/items/qsganimatedimage.cpp
index ea36153ef0..e4bba512af 100644
--- a/src/declarative/items/qsganimatedimage.cpp
+++ b/src/declarative/items/qsganimatedimage.cpp
@@ -264,7 +264,6 @@ void QSGAnimatedImage::load()
if (d->progress != oldProgress)
emit progressChanged(d->progress);
} else {
-#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML
QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(d->url);
if (!lf.isEmpty()) {
//### should be unified with movieRequestFinished
@@ -298,7 +297,7 @@ void QSGAnimatedImage::load()
emit progressChanged(d->progress);
return;
}
-#endif
+
d->status = Loading;
d->progress = 0;
emit statusChanged(d->status);
diff --git a/src/declarative/items/qsgborderimage.cpp b/src/declarative/items/qsgborderimage.cpp
index 8d54bce419..30b10321a0 100644
--- a/src/declarative/items/qsgborderimage.cpp
+++ b/src/declarative/items/qsgborderimage.cpp
@@ -306,15 +306,12 @@ void QSGBorderImage::load()
} else {
d->status = Loading;
if (d->url.path().endsWith(QLatin1String("sci"))) {
-#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML
QString lf = QDeclarativeEnginePrivate::urlToLocalFileOrQrc(d->url);
if (!lf.isEmpty()) {
QFile file(lf);
file.open(QIODevice::ReadOnly);
setGridScaledImage(QSGGridScaledImage(&file));
- } else
-#endif
- {
+ } else {
QNetworkRequest req(d->url);
d->sciReply = qmlEngine(this)->networkAccessManager()->get(req);
diff --git a/src/declarative/items/qsgcanvas.cpp b/src/declarative/items/qsgcanvas.cpp
index 8ff7d17837..95ee95d0f7 100644
--- a/src/declarative/items/qsgcanvas.cpp
+++ b/src/declarative/items/qsgcanvas.cpp
@@ -153,17 +153,17 @@ public:
Focus behavior
==============
-Prior to being added to a valid canvas items can set and clear focus with no
+Prior to being added to a valid canvas items can set and clear focus with no
effect. Only once items are added to a canvas (by way of having a parent set that
-already belongs to a canvas) do the focus rules apply. Focus goes back to
+already belongs to a canvas) do the focus rules apply. Focus goes back to
having no effect if an item is removed from a canvas.
When an item is moved into a new focus scope (either being added to a canvas
-for the first time, or having its parent changed), if the focus scope already has
+for the first time, or having its parent changed), if the focus scope already has
a scope focused item that takes precedence over the item being added. Otherwise,
-the focus of the added tree is used. In the case of of a tree of items being
+the focus of the added tree is used. In the case of of a tree of items being
added to a canvas for the first time, which may have a conflicted focus state (two
-or more items in one scope having focus set), the same rule is applied item by item -
+or more items in one scope having focus set), the same rule is applied item by item -
thus the first item that has focus will get it (assuming the scope doesn't already
have a scope focused item), and the other items will have their focus cleared.
*/
@@ -478,7 +478,7 @@ void QSGCanvasPrivate::sceneMouseEventForTransform(QGraphicsSceneMouseEvent &sce
sceneEvent.setLastPos(transform.map(sceneEvent.lastScenePos()));
for (int ii = 0; ii < 5; ++ii) {
if (sceneEvent.buttons() & (1 << ii)) {
- sceneEvent.setButtonDownPos((Qt::MouseButton)(1 << ii),
+ sceneEvent.setButtonDownPos((Qt::MouseButton)(1 << ii),
transform.map(sceneEvent.buttonDownScenePos((Qt::MouseButton)(1 << ii))));
}
}
@@ -692,7 +692,7 @@ void QSGCanvasPrivate::setFocusInScope(QSGItem *scope, QSGItem *item, FocusOptio
updateInputMethodData();
QFocusEvent event(QEvent::FocusIn, Qt::OtherFocusReason);
- q->sendEvent(newActiveFocusItem, &event);
+ q->sendEvent(newActiveFocusItem, &event);
} else {
updateInputMethodData();
}
@@ -778,12 +778,12 @@ void QSGCanvasPrivate::clearFocusInScope(QSGItem *scope, QSGItem *item, FocusOpt
updateInputMethodData();
QFocusEvent event(QEvent::FocusIn, Qt::OtherFocusReason);
- q->sendEvent(newActiveFocusItem, &event);
+ q->sendEvent(newActiveFocusItem, &event);
} else {
updateInputMethodData();
}
- if (!changed.isEmpty())
+ if (!changed.isEmpty())
notifyFocusChangesRecur(changed.data(), changed.count() - 1);
}
@@ -807,7 +807,7 @@ void QSGCanvasPrivate::notifyFocusChangesRecur(QSGItem **items, int remaining)
itemPrivate->itemChange(QSGItem::ItemActiveFocusHasChanged, itemPrivate->activeFocus);
emit item->activeFocusChanged(itemPrivate->activeFocus);
}
- }
+ }
}
void QSGCanvasPrivate::updateInputMethodData()
@@ -891,21 +891,21 @@ QSGCanvas::~QSGCanvas()
QSGItem *QSGCanvas::rootItem() const
{
Q_D(const QSGCanvas);
-
+
return d->rootItem;
}
QSGItem *QSGCanvas::activeFocusItem() const
{
Q_D(const QSGCanvas);
-
+
return d->activeFocusItem;
}
QSGItem *QSGCanvas::mouseGrabberItem() const
{
Q_D(const QSGCanvas);
-
+
return d->mouseGrabberItem;
}
@@ -1016,7 +1016,7 @@ bool QSGCanvasPrivate::deliverInitialMousePressEvent(QSGItem *item, QGraphicsSce
event->accept();
mouseGrabberItem = item;
q->sendEvent(item, event);
- if (event->isAccepted())
+ if (event->isAccepted())
return true;
mouseGrabberItem->ungrabMouse();
mouseGrabberItem = 0;
@@ -1030,10 +1030,10 @@ bool QSGCanvasPrivate::deliverMouseEvent(QGraphicsSceneMouseEvent *sceneEvent)
{
Q_Q(QSGCanvas);
- if (!mouseGrabberItem &&
+ if (!mouseGrabberItem &&
sceneEvent->type() == QEvent::GraphicsSceneMousePress &&
(sceneEvent->button() & sceneEvent->buttons()) == sceneEvent->buttons()) {
-
+
return deliverInitialMousePressEvent(rootItem, sceneEvent);
}
@@ -1053,7 +1053,7 @@ bool QSGCanvasPrivate::deliverMouseEvent(QGraphicsSceneMouseEvent *sceneEvent)
void QSGCanvas::mousePressEvent(QMouseEvent *event)
{
Q_D(QSGCanvas);
-
+
#ifdef MOUSE_DEBUG
qWarning() << "QSGCanvas::mousePressEvent()" << event->pos() << event->button() << event->buttons();
#endif
@@ -1068,7 +1068,7 @@ void QSGCanvas::mousePressEvent(QMouseEvent *event)
void QSGCanvas::mouseReleaseEvent(QMouseEvent *event)
{
Q_D(QSGCanvas);
-
+
#ifdef MOUSE_DEBUG
qWarning() << "QSGCanvas::mouseReleaseEvent()" << event->pos() << event->button() << event->buttons();
#endif
@@ -1090,7 +1090,7 @@ void QSGCanvas::mouseReleaseEvent(QMouseEvent *event)
void QSGCanvas::mouseDoubleClickEvent(QMouseEvent *event)
{
Q_D(QSGCanvas);
-
+
#ifdef MOUSE_DEBUG
qWarning() << "QSGCanvas::mouseDoubleClickEvent()" << event->pos() << event->button() << event->buttons();
#endif
@@ -1104,7 +1104,7 @@ void QSGCanvas::mouseDoubleClickEvent(QMouseEvent *event)
else
event->ignore();
return;
- }
+ }
d->deliverMouseEvent(&sceneEvent);
event->setAccepted(sceneEvent.isAccepted());
@@ -1129,7 +1129,7 @@ bool QSGCanvasPrivate::sendHoverEvent(QEvent::Type type, QSGItem *item,
void QSGCanvas::mouseMoveEvent(QMouseEvent *event)
{
Q_D(QSGCanvas);
-
+
#ifdef MOUSE_DEBUG
qWarning() << "QSGCanvas::mouseMoveEvent()" << event->pos() << event->button() << event->buttons();
#endif
@@ -1173,7 +1173,7 @@ bool QSGCanvasPrivate::deliverHoverEvent(QSGItem *item, const QPointF &scenePos,
QList<QSGItem *> children = itemPrivate->paintOrderChildItems();
for (int ii = children.count() - 1; ii >= 0; --ii) {
QSGItem *child = children.at(ii);
- if (!child->isEnabled())
+ if (!child->isVisible() || !child->isEnabled())
continue;
if (deliverHoverEvent(child, scenePos, lastScenePos, modifiers, accepted))
return true;
@@ -1186,38 +1186,36 @@ bool QSGCanvasPrivate::deliverHoverEvent(QSGItem *item, const QPointF &scenePos,
//move
accepted = sendHoverEvent(QEvent::HoverMove, item, scenePos, lastScenePos, modifiers, accepted);
} else {
- QList<QSGItem*> parents;
+ QList<QSGItem *> itemsToHover;
QSGItem* parent = item;
- parents << item;
+ itemsToHover << item;
while ((parent = parent->parentItem()))
- parents << parent;
+ itemsToHover << parent;
- //exit from previous (excepting ancestors)
- while (!hoverItems.isEmpty() && !parents.contains(hoverItems[0])){
+ // Leaving from previous hovered items until we reach the item or one of its ancestors.
+ while (!hoverItems.isEmpty() && !itemsToHover.contains(hoverItems[0])) {
sendHoverEvent(QEvent::HoverLeave, hoverItems[0], scenePos, lastScenePos, modifiers, accepted);
hoverItems.removeFirst();
}
if (!hoverItems.isEmpty() && hoverItems[0] == item){//Not entering a new Item
+ // ### Shouldn't we send moves for the parent items as well?
accepted = sendHoverEvent(QEvent::HoverMove, item, scenePos, lastScenePos, modifiers, accepted);
} else {
- //enter any ancestors that also wish to be hovered and aren't
+ // Enter items that are not entered yet.
int startIdx = -1;
if (!hoverItems.isEmpty())
- startIdx = parents.indexOf(hoverItems[0]);
+ startIdx = itemsToHover.indexOf(hoverItems[0]) - 1;
if (startIdx == -1)
- startIdx = parents.count() - 1;
+ startIdx = itemsToHover.count() - 1;
for (int i = startIdx; i >= 0; i--) {
- if (QSGItemPrivate::get(parents[i])->hoverEnabled) {
- hoverItems.prepend(parents[i]);
- sendHoverEvent(QEvent::HoverEnter, parents[i], scenePos, lastScenePos, modifiers, accepted);
+ QSGItem *itemToHover = itemsToHover[i];
+ if (QSGItemPrivate::get(itemToHover)->hoverEnabled) {
+ hoverItems.prepend(itemToHover);
+ sendHoverEvent(QEvent::HoverEnter, itemToHover, scenePos, lastScenePos, modifiers, accepted);
}
}
-
- //enter new item
- hoverItems.prepend(item);
- accepted = sendHoverEvent(QEvent::HoverEnter, item, scenePos, lastScenePos, modifiers, accepted);
}
}
return true;
@@ -1505,17 +1503,17 @@ bool QSGCanvasPrivate::sendFilteredMouseEvent(QSGItem *target, QSGItem *item, QG
return true;
QSGItemPrivate *targetPrivate = QSGItemPrivate::get(target);
- if (targetPrivate->filtersChildMouseEvents)
+ if (targetPrivate->filtersChildMouseEvents)
if (target->childMouseEventFilter(item, event))
return true;
return false;
}
-bool QSGCanvas::sendEvent(QSGItem *item, QEvent *e)
-{
+bool QSGCanvas::sendEvent(QSGItem *item, QEvent *e)
+{
Q_D(QSGCanvas);
-
+
if (!item) {
qWarning("QSGCanvas::sendEvent: Cannot send event to a null item");
return false;
@@ -1549,7 +1547,7 @@ bool QSGCanvas::sendEvent(QSGItem *item, QEvent *e)
case QEvent::GraphicsSceneMouseRelease:
case QEvent::GraphicsSceneMouseDoubleClick:
case QEvent::GraphicsSceneMouseMove:
- // XXX todo - should sendEvent be doing this? how does it relate to forwarded events?
+ // XXX todo - should sendEvent be doing this? how does it relate to forwarded events?
{
QGraphicsSceneMouseEvent *se = static_cast<QGraphicsSceneMouseEvent *>(e);
if (!d->sendFilteredMouseEvent(item->parentItem(), item, se)) {
@@ -1581,7 +1579,7 @@ bool QSGCanvas::sendEvent(QSGItem *item, QEvent *e)
break;
}
- return false;
+ return false;
}
void QSGCanvasPrivate::cleanupNodes()
@@ -1626,12 +1624,12 @@ void QSGCanvasPrivate::updateDirtyNode(QSGItem *item)
itemPriv->dirtyAttributes = 0;
if ((dirty & QSGItemPrivate::TransformUpdateMask) ||
- (dirty & QSGItemPrivate::Size && itemPriv->origin != QSGItem::TopLeft &&
+ (dirty & QSGItemPrivate::Size && itemPriv->origin != QSGItem::TopLeft &&
(itemPriv->scale != 1. || itemPriv->rotation != 0.))) {
QMatrix4x4 matrix;
- if (itemPriv->x != 0. || itemPriv->y != 0.)
+ if (itemPriv->x != 0. || itemPriv->y != 0.)
matrix.translate(itemPriv->x, itemPriv->y);
for (int ii = itemPriv->transforms.count() - 1; ii >= 0; --ii)
@@ -1779,10 +1777,10 @@ void QSGCanvasPrivate::updateDirtyNode(QSGItem *item)
if (dirty & QSGItemPrivate::ContentUpdateMask) {
if (itemPriv->flags & QSGItem::ItemHasContents) {
- updatePaintNodeData.transformNode = itemPriv->itemNode();
+ updatePaintNodeData.transformNode = itemPriv->itemNode();
itemPriv->paintNode = item->updatePaintNode(itemPriv->paintNode, &updatePaintNodeData);
- Q_ASSERT(itemPriv->paintNode == 0 ||
+ Q_ASSERT(itemPriv->paintNode == 0 ||
itemPriv->paintNode->parent() == 0 ||
itemPriv->paintNode->parent() == itemPriv->childContainerNode());
@@ -1957,7 +1955,7 @@ void QSGCanvasRenderThread::run()
} else {
makeCurrent();
}
-
+
while (!shouldExit) {
lock();
diff --git a/src/declarative/items/qsgpositioners.cpp b/src/declarative/items/qsgpositioners.cpp
index fca0aa1877..0401494d3b 100644
--- a/src/declarative/items/qsgpositioners.cpp
+++ b/src/declarative/items/qsgpositioners.cpp
@@ -93,6 +93,9 @@ QSGBasePositioner::QSGBasePositioner(PositionerType at, QSGItem *parent)
for the child items. Depending on the chosen type, only x or y changes will be applied.
Note that the subclass is responsible for adding the spacing in between items.
+
+ Positioning is usually delayed until before a frame is rendered, to batch multiple repositioning
+ changes into one calculation.
*/
QSGBasePositioner::QSGBasePositioner(QSGBasePositionerPrivate &dd, PositionerType at, QSGItem *parent)
@@ -110,6 +113,13 @@ QSGBasePositioner::~QSGBasePositioner()
positionedItems.clear();
}
+void QSGBasePositioner::updatePolish()
+{
+ Q_D(QSGBasePositioner);
+ if (d->positioningDirty)
+ prePositioning();
+}
+
int QSGBasePositioner::spacing() const
{
Q_D(const QSGBasePositioner);
@@ -122,7 +132,7 @@ void QSGBasePositioner::setSpacing(int s)
if (s==d->spacing)
return;
d->spacing = s;
- prePositioning();
+ d->setPositioningDirty();
emit spacingChanged();
}
@@ -169,7 +179,7 @@ void QSGBasePositioner::itemChange(ItemChange change, const ItemChangeData &valu
{
Q_D(QSGBasePositioner);
if (change == ItemChildAddedChange){
- prePositioning();
+ d->setPositioningDirty();
} else if (change == ItemChildRemovedChange) {
QSGItem *child = value.item;
QSGBasePositioner::PositionedItem posItem(child);
@@ -178,7 +188,7 @@ void QSGBasePositioner::itemChange(ItemChange change, const ItemChangeData &valu
d->unwatchChanges(child);
positionedItems.remove(idx);
}
- prePositioning();
+ d->setPositioningDirty();
}
QSGItem::itemChange(change, value);
@@ -193,7 +203,7 @@ void QSGBasePositioner::prePositioning()
if (d->doingPositioning)
return;
- d->queuedPositioning = false;
+ d->positioningDirty = false;
d->doingPositioning = true;
//Need to order children by creation order modified by stacking order
QList<QSGItem *> children = childItems();
@@ -463,6 +473,10 @@ void QSGPositionerAttached::setIsLastItem(bool isLastItem)
Items with a width or height of 0 will not be positioned.
+ Positioning is batched and syncronized with painting to reduce the number of
+ calculations needed. This means that positioners may not reposition items immediately
+ when changes occur, but it will have moved by the next frame.
+
\sa Row, Grid, Flow, Positioner, {declarative/positioners}{Positioners example}
*/
/*!
@@ -607,6 +621,10 @@ void QSGColumn::reportConflictingAnchors()
Items with a width or height of 0 will not be positioned.
+ Positioning is batched and syncronized with painting to reduce the number of
+ calculations needed. This means that positioners may not reposition items immediately
+ when changes occur, but it will have moved by the next frame.
+
\sa Column, Grid, Flow, Positioner, {declarative/positioners}{Positioners example}
*/
/*!
@@ -838,6 +856,10 @@ void QSGRow::reportConflictingAnchors()
Items with a width or height of 0 will not be positioned.
+ Positioning is batched and syncronized with painting to reduce the number of
+ calculations needed. This means that positioners may not reposition items immediately
+ when changes occur, but it will have moved by the next frame.
+
\sa Flow, Row, Column, Positioner, {declarative/positioners}{Positioners example}
*/
/*!
@@ -1265,6 +1287,10 @@ void QSGGrid::reportConflictingAnchors()
Items with a width or height of 0 will not be positioned.
+ Positioning is batched and syncronized with painting to reduce the number of
+ calculations needed. This means that positioners may not reposition items immediately
+ when changes occur, but it will have moved by the next frame.
+
\sa Column, Row, Grid, Positioner, {declarative/positioners}{Positioners example}
*/
/*!
diff --git a/src/declarative/items/qsgpositioners_p.h b/src/declarative/items/qsgpositioners_p.h
index 7200b6da8d..f8711251d3 100644
--- a/src/declarative/items/qsgpositioners_p.h
+++ b/src/declarative/items/qsgpositioners_p.h
@@ -121,6 +121,8 @@ protected:
virtual void itemChange(ItemChange, const ItemChangeData &);
void finishApplyTransitions();
+ virtual void updatePolish();
+
Q_SIGNALS:
void spacingChanged();
void moveChanged();
diff --git a/src/declarative/items/qsgpositioners_p_p.h b/src/declarative/items/qsgpositioners_p_p.h
index a29982b1b7..3c1185378b 100644
--- a/src/declarative/items/qsgpositioners_p_p.h
+++ b/src/declarative/items/qsgpositioners_p_p.h
@@ -74,7 +74,7 @@ class QSGBasePositionerPrivate : public QSGImplicitSizeItemPrivate, public QSGIt
public:
QSGBasePositionerPrivate()
: spacing(0), type(QSGBasePositioner::None)
- , moveTransition(0), addTransition(0), queuedPositioning(false)
+ , moveTransition(0), addTransition(0), positioningDirty(false)
, doingPositioning(false), anchorConflict(false), layoutDirection(Qt::LeftToRight)
{
}
@@ -97,25 +97,23 @@ public:
void watchChanges(QSGItem *other);
void unwatchChanges(QSGItem* other);
- bool queuedPositioning : 1;
+ void setPositioningDirty() {
+ Q_Q(QSGBasePositioner);
+ if (!positioningDirty) {
+ positioningDirty = true;
+ q->polish();
+ }
+ }
+
+ bool positioningDirty : 1;
bool doingPositioning : 1;
bool anchorConflict : 1;
Qt::LayoutDirection layoutDirection;
- void schedulePositioning()
- {
- Q_Q(QSGBasePositioner);
- if(!queuedPositioning){
- QTimer::singleShot(0,q,SLOT(prePositioning()));
- queuedPositioning = true;
- }
- }
-
void mirrorChange() {
- Q_Q(QSGBasePositioner);
if (type != QSGBasePositioner::Vertical)
- q->prePositioning();
+ setPositioningDirty();
}
bool isLeftToRight() const {
if (type == QSGBasePositioner::Vertical)
@@ -127,26 +125,18 @@ public:
virtual void itemSiblingOrderChanged(QSGItem* other)
{
Q_UNUSED(other);
- //Delay is due to many children often being reordered at once
- //And we only want to reposition them all once
- schedulePositioning();
+ setPositioningDirty();
}
void itemGeometryChanged(QSGItem *, const QRectF &newGeometry, const QRectF &oldGeometry)
{
- Q_Q(QSGBasePositioner);
if (newGeometry.size() != oldGeometry.size())
- q->prePositioning();
+ setPositioningDirty();
}
virtual void itemVisibilityChanged(QSGItem *)
{
- schedulePositioning();
- }
- virtual void itemOpacityChanged(QSGItem *)
- {
- Q_Q(QSGBasePositioner);
- q->prePositioning();
+ setPositioningDirty();
}
void itemDestroyed(QSGItem *item)
diff --git a/src/declarative/items/qsgshadereffect.cpp b/src/declarative/items/qsgshadereffect.cpp
index ff131509f3..b81e7f15af 100644
--- a/src/declarative/items/qsgshadereffect.cpp
+++ b/src/declarative/items/qsgshadereffect.cpp
@@ -98,7 +98,7 @@ QSGShaderEffectItem::QSGShaderEffectItem(QSGItem *parent)
/*!
\qmlclass ShaderEffect QSGShaderEffect
- \since 5.0
+ \inqmlmodule QtQuick 2
\ingroup qml-basic-visual-elements
\brief The ShaderEffect element applies custom shaders to a rectangle.
\inherits Item
@@ -214,7 +214,7 @@ void QSGShaderEffect::componentComplete()
}
/*!
- \qmlproperty string ShaderEffect::fragmentShader
+ \qmlproperty string QtQuick2::ShaderEffect::fragmentShader
This property holds the fragment shader's GLSL source code.
The default shader passes the texture coordinate along to the fragment
@@ -234,7 +234,7 @@ void QSGShaderEffect::setFragmentShader(const QByteArray &code)
}
/*!
- \qmlproperty string ShaderEffect::vertexShader
+ \qmlproperty string QtQuick2::ShaderEffect::vertexShader
This property holds the vertex shader's GLSL source code.
The default shader expects the texture coordinate to be passed from the
@@ -255,7 +255,7 @@ void QSGShaderEffect::setVertexShader(const QByteArray &code)
}
/*!
- \qmlproperty bool ShaderEffect::blending
+ \qmlproperty bool QtQuick2::ShaderEffect::blending
If this property is true, the output from the \l fragmentShader is blended
with the background using source-over blend mode. If false, the background
@@ -275,7 +275,7 @@ void QSGShaderEffect::setBlending(bool enable)
}
/*!
- \qmlproperty size ShaderEffect::mesh
+ \qmlproperty size QtQuick2::ShaderEffect::mesh
This property holds the mesh resolution. The default resolution is 1x1
which is the minimum and corresponds to a mesh with four vertices.
@@ -358,7 +358,7 @@ void QSGShaderEffect::setMesh(const QVariant &mesh)
}
/*!
- \qmlproperty enumeration ShaderEffect::cullMode
+ \qmlproperty enumeration QtQuick2::ShaderEffect::cullMode
This property defines which sides of the element should be visible.
diff --git a/src/declarative/items/qsgshadereffectsource.cpp b/src/declarative/items/qsgshadereffectsource.cpp
index 4035608a6e..bb55af524b 100644
--- a/src/declarative/items/qsgshadereffectsource.cpp
+++ b/src/declarative/items/qsgshadereffectsource.cpp
@@ -406,6 +406,14 @@ void QSGShaderEffectTexture::grab()
markDirtyTexture(); // Continuously update if 'live' and 'recursive'.
}
+QImage QSGShaderEffectTexture::toImage() const
+{
+ if (m_fbo)
+ return m_fbo->toImage();
+
+ return QImage();
+}
+
/*!
\qmlclass ShaderEffectSource QSGShaderEffectSource
\since 5.0
diff --git a/src/declarative/items/qsgshadereffectsource_p.h b/src/declarative/items/qsgshadereffectsource_p.h
index 6cb76ddba4..77cb412884 100644
--- a/src/declarative/items/qsgshadereffectsource_p.h
+++ b/src/declarative/items/qsgshadereffectsource_p.h
@@ -117,6 +117,7 @@ public:
void scheduleUpdate();
void scheduleForCleanup();
+ QImage toImage() const;
Q_SIGNALS:
void textureChanged();
diff --git a/src/declarative/items/qsgview.cpp b/src/declarative/items/qsgview.cpp
index 48b3074363..236fd4ec1f 100644
--- a/src/declarative/items/qsgview.cpp
+++ b/src/declarative/items/qsgview.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "qsgview.h"
+#include "qsgview_p.h"
#include "qsgcanvas_p.h"
#include "qsgitem_p.h"
@@ -52,45 +53,13 @@
#include <private/qdeclarativeengine_p.h>
#include <QtCore/qbasictimer.h>
-// XXX todo - This whole class should probably be merged with QDeclarativeView for
+
+// XXX todo - This whole class should probably be merged with QDeclarativeView for
// maximum seamlessness
QT_BEGIN_NAMESPACE
DEFINE_BOOL_CONFIG_OPTION(frameRateDebug, QML_SHOW_FRAMERATE)
-class QSGViewPrivate : public QSGCanvasPrivate,
- public QSGItemChangeListener
-{
- Q_DECLARE_PUBLIC(QSGView)
-public:
- QSGViewPrivate();
- ~QSGViewPrivate();
-
- void execute();
- void itemGeometryChanged(QSGItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
- void initResize();
- void updateSize();
- void setRootObject(QObject *);
-
- void init();
-
- QSize rootObjectSize() const;
-
- QPointer<QSGItem> root;
-
- QUrl source;
-
- QDeclarativeEngine engine;
- QDeclarativeComponent *component;
- QBasicTimer resizetimer;
-
- QSGView::ResizeMode resizeMode;
- QSize initialSize;
- QElapsedTimer frameTimer;
-
- bool resized;
-};
-
void QSGViewPrivate::init()
{
QDeclarativeEnginePrivate::get(&engine)->sgContext = QSGCanvasPrivate::context;
@@ -103,8 +72,8 @@ QSGViewPrivate::QSGViewPrivate()
{
}
-QSGViewPrivate::~QSGViewPrivate()
-{
+QSGViewPrivate::~QSGViewPrivate()
+{
QDeclarativeInspectorService::instance()->removeView(q_func());
delete root;
@@ -126,7 +95,7 @@ void QSGViewPrivate::execute()
if (!component->isLoading()) {
q->continueExecute();
} else {
- QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
+ QObject::connect(component, SIGNAL(statusChanged(QDeclarativeComponent::Status)),
q, SLOT(continueExecute()));
}
}
@@ -397,9 +366,9 @@ QSGItem *QSGView::rootObject() const
void QSGView::resizeEvent(QResizeEvent *e)
{
Q_D(QSGView);
- if (d->resizeMode == SizeRootObjectToView)
+ if (d->resizeMode == SizeRootObjectToView)
d->updateSize();
-
+
QSGCanvas::resizeEvent(e);
}
diff --git a/src/declarative/items/qsgview_p.h b/src/declarative/items/qsgview_p.h
new file mode 100644
index 0000000000..3f8d69e8c0
--- /dev/null
+++ b/src/declarative/items/qsgview_p.h
@@ -0,0 +1,108 @@
+/****************************************************************************
+**
+** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the QtDeclarative module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation and
+** appearing in the file LICENSE.LGPL included in the packaging of this
+** file. Please review the following information to ensure the GNU Lesser
+** General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU General
+** Public License version 3.0 as published by the Free Software Foundation
+** and appearing in the file LICENSE.GPL included in the packaging of this
+** file. Please review the following information to ensure the GNU General
+** Public License version 3.0 requirements will be met:
+** http://www.gnu.org/copyleft/gpl.html.
+**
+** Other Usage
+** Alternatively, this file may be used in accordance with the terms and
+** conditions contained in a signed written agreement between you and Nokia.
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QSGVIEW_P_H
+#define QSGVIEW_P_H
+
+#include "qsgview.h"
+
+#include <QtCore/qurl.h>
+#include <QtCore/qelapsedtimer.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qpointer.h>
+#include <QtDeclarative/qsgview.h>
+#include <QtDeclarative/qdeclarativeengine.h>
+#include <QtDeclarative/private/qsgcanvas_p.h>
+
+#include "qsgitemchangelistener_p.h"
+
+QT_BEGIN_HEADER
+
+QT_BEGIN_NAMESPACE
+
+QT_MODULE(Declarative)
+
+class QDeclarativeContext;
+class QDeclarativeError;
+class QSGItem;
+class QDeclarativeComponent;
+
+class QSGViewPrivate : public QSGCanvasPrivate,
+ public QSGItemChangeListener
+{
+ Q_DECLARE_PUBLIC(QSGView)
+public:
+ static QSGViewPrivate* get(QSGView *view) { return view->d_func(); }
+ static const QSGViewPrivate* get(const QSGView *view) { return view->d_func(); }
+
+ QSGViewPrivate();
+ ~QSGViewPrivate();
+
+ void execute();
+ void itemGeometryChanged(QSGItem *item, const QRectF &newGeometry, const QRectF &oldGeometry);
+ void initResize();
+ void updateSize();
+ void setRootObject(QObject *);
+
+ void init();
+
+ QSize rootObjectSize() const;
+
+ QPointer<QSGItem> root;
+
+ QUrl source;
+
+ QDeclarativeEngine engine;
+ QDeclarativeComponent *component;
+ QBasicTimer resizetimer;
+
+ QSGView::ResizeMode resizeMode;
+ QSize initialSize;
+ QElapsedTimer frameTimer;
+
+ bool resized;
+};
+
+QT_END_NAMESPACE
+
+QT_END_HEADER
+
+#endif // QSGVIEW_P_H
diff --git a/src/declarative/items/qsgvisualitemmodel.cpp b/src/declarative/items/qsgvisualitemmodel.cpp
index 5dfe01dd2b..4dd508d0aa 100644
--- a/src/declarative/items/qsgvisualitemmodel.cpp
+++ b/src/declarative/items/qsgvisualitemmodel.cpp
@@ -1511,7 +1511,7 @@ void QSGVisualDataModel::_q_rowsMoved(const QModelIndex &sourceParent, int sourc
Q_D(QSGVisualDataModel);
const int count = sourceEnd - sourceStart + 1;
if (destinationParent == d->m_root && sourceParent == d->m_root) {
- _q_itemsMoved(sourceStart, sourceStart > destinationRow ? destinationRow : destinationRow-1, count);
+ _q_itemsMoved(sourceStart, sourceStart > destinationRow ? destinationRow : destinationRow-count, count);
} else if (sourceParent == d->m_root) {
_q_itemsRemoved(sourceStart, count);
} else if (destinationParent == d->m_root) {