summaryrefslogtreecommitdiffstats
path: root/src/declarative
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2011-08-11 23:42:51 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2011-08-11 23:42:51 (GMT)
commit72c58996a5fc7c7a1a82fefa5a0034f57383e788 (patch)
treecde90f301afe3783f95a683dc0a54d31aafb673e /src/declarative
parenteb5fae761ff2aaf3d35245ac1f9d1ea10c4e84bb (diff)
parentc7b8fdf5d866b5202dada00ba175606807f69fca (diff)
downloadQt-72c58996a5fc7c7a1a82fefa5a0034f57383e788.zip
Qt-72c58996a5fc7c7a1a82fefa5a0034f57383e788.tar.gz
Qt-72c58996a5fc7c7a1a82fefa5a0034f57383e788.tar.bz2
Merge branch 'master' of ../qt-qml-staging
Diffstat (limited to 'src/declarative')
-rw-r--r--src/declarative/declarative.pro2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanchors_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp26
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp26
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeimage.cpp4
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp45
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp22
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp18
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p.h3
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea_p_p.h17
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners.cpp65
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p.h6
-rw-r--r--src/declarative/graphicsitems/qdeclarativerepeater.cpp6
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp17
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp18
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp91
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput_p.h7
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextlayout.cpp15
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextlayout_p.h2
-rw-r--r--src/declarative/qml/qdeclarativebinding.cpp5
-rw-r--r--src/declarative/qml/qdeclarativecompiledbindings.cpp31
-rw-r--r--src/declarative/qml/qdeclarativedata_p.h30
-rw-r--r--src/declarative/qml/qdeclarativeengine.cpp5
-rw-r--r--src/declarative/qml/qdeclarativeguard_p.h107
-rw-r--r--src/declarative/qml/qdeclarativeobjectscriptclass.cpp114
-rw-r--r--src/declarative/qml/qdeclarativetypeloader.cpp24
-rw-r--r--src/declarative/qml/qdeclarativevme.cpp72
-rw-r--r--src/declarative/qml/qdeclarativevme_p.h32
-rw-r--r--src/declarative/qml/qperformancetimer.cpp55
-rw-r--r--src/declarative/util/qdeclarativepixmapcache.cpp14
-rw-r--r--src/declarative/util/qdeclarativepixmapcache_p.h2
-rw-r--r--src/declarative/util/qdeclarativestate_p_p.h4
-rw-r--r--src/declarative/util/qdeclarativestateoperations_p.h4
-rw-r--r--src/declarative/util/qdeclarativexmllistmodel.cpp287
40 files changed, 668 insertions, 528 deletions
diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
index b74b18c..055e4b9 100644
--- a/src/declarative/declarative.pro
+++ b/src/declarative/declarative.pro
@@ -26,7 +26,7 @@ include(debugger/debugger.pri)
symbian: {
TARGET.UID3=0x2001E623
- LIBS += -lefsrv
+ LIBS += -lefsrv -lhal
contains(QT_CONFIG, freetype) {
DEFINES += QT_NO_FONTCONFIG
diff --git a/src/declarative/graphicsitems/qdeclarativeanchors_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p.h
index d222ef5..cffcd54 100644
--- a/src/declarative/graphicsitems/qdeclarativeanchors_p.h
+++ b/src/declarative/graphicsitems/qdeclarativeanchors_p.h
@@ -79,7 +79,6 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeAnchors : public QObject
Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged)
Q_PROPERTY(QGraphicsObject *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged)
Q_PROPERTY(QGraphicsObject *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged)
- Q_PROPERTY(bool mirrored READ mirrored NOTIFY mirroredChanged REVISION 1)
public:
QDeclarativeAnchors(QObject *parent=0);
@@ -184,7 +183,6 @@ Q_SIGNALS:
void verticalCenterOffsetChanged();
void horizontalCenterOffsetChanged();
void baselineOffsetChanged();
- Q_REVISION(1) void mirroredChanged();
private:
friend class QDeclarativeItem;
diff --git a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
index 8787a5e..b1ebec8 100644
--- a/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeanimatedimage.cpp
@@ -114,7 +114,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlproperty bool AnimatedImage::cache
- \since Quick 1.1
+ \since QtQuick 1.1
Specifies whether the image should be cached. The default value is
true. Setting \a cache to false is useful when dealing with large images,
@@ -123,7 +123,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmlproperty bool AnimatedImage::mirror
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds whether the image should be horizontally inverted
(effectively displaying a mirrored image).
diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index 836ad49..4b4efb6 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -215,7 +215,7 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage()
/*!
\qmlproperty bool BorderImage::cache
- \since Quick 1.1
+ \since QtQuick 1.1
Specifies whether the image should be cached. The default value is
true. Setting \a cache to false is useful when dealing with large images,
@@ -224,7 +224,7 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage()
/*!
\qmlproperty bool BorderImage::mirror
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds whether the image should be horizontally inverted
(effectively displaying a mirrored image).
@@ -240,22 +240,20 @@ QDeclarativeBorderImage::~QDeclarativeBorderImage()
BorderImage can handle any image format supported by Qt, loaded from any
URL scheme supported by Qt.
- It can also handle .sci files, which are a QML-specific format. A .sci
- file uses a simple text-based format that specifies the borders, the
- image file and the tile rules.
+ This property can also be used to refer to .sci files, which are
+ written in a QML-specific, text-based format that specifies the
+ borders, the image file and the tile rules for a given border image.
The following .sci file sets the borders to 10 on each side for the
image \c picture.png:
- \qml
- BorderImage {
- border.left: 10
- border.top: 10
- border.bottom: 10
- border.right: 10
- source: "picture.png"
- }
- \endqml
+ \code
+ border.left: 10
+ border.top: 10
+ border.bottom: 10
+ border.right: 10
+ source: "picture.png"
+ \endcode
The URL may be absolute, or relative to the URL of the component.
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 1e04559..fd2dc45 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -230,8 +230,8 @@ void QDeclarativeFlickablePrivate::AxisData::addVelocitySample(qreal v, qreal ma
void QDeclarativeFlickablePrivate::AxisData::updateVelocity()
{
+ velocity = 0;
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);
@@ -1399,7 +1399,7 @@ void QDeclarativeFlickable::setContentHeight(qreal h)
/*!
\qmlmethod Flickable::resizeContent(real width, real height, QPointF center)
\preliminary
- \since Quick 1.1
+ \since QtQuick 1.1
Resizes the content to \a width x \a height about \a center.
@@ -1439,7 +1439,7 @@ void QDeclarativeFlickable::resizeContent(qreal w, qreal h, QPointF center)
/*!
\qmlmethod Flickable::returnToBounds()
\preliminary
- \since Quick 1.1
+ \since QtQuick 1.1
Ensures the content is within legal bounds.
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 2642800..e53472d 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp
@@ -210,7 +210,6 @@ public:
void mirrorChange() {
Q_Q(QDeclarativeGridView);
regenerate();
- emit q->effectiveLayoutDirectionChanged();
}
qreal position() const {
@@ -1831,12 +1830,15 @@ void QDeclarativeGridView::setHighlightRangeMode(HighlightRangeMode mode)
\o Qt.LeftToRight (default) - Items will be laid out starting in the top, left corner. The flow is
dependent on the \l GridView::flow property.
\o Qt.RightToLeft - Items will be laid out starting in the top, right corner. The flow is dependent
- on the \l GridView:flow property.
+ on the \l GridView::flow property.
\endlist
- \bold Note: If GridView::flow is set to GridView.LeftToRight, this is not to be confused if
- GridView::layoutDirection is set to Qt.RightToLeft. The GridView.LeftToRight flow value simply
- indicates that the flow is horizontal.
+ When using the attached property \l {LayoutMirroring::enabled} for locale layouts,
+ the layout direction of the grid view will be mirrored. However, the actual property
+ \c layoutDirection will remain unchanged. You can use the property
+ \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored.
+
+ \sa {LayoutMirroring}{LayoutMirroring}
*/
Qt::LayoutDirection QDeclarativeGridView::layoutDirection() const
@@ -1852,21 +1854,9 @@ void QDeclarativeGridView::setLayoutDirection(Qt::LayoutDirection layoutDirectio
d->layoutDirection = layoutDirection;
d->regenerate();
emit layoutDirectionChanged();
- emit effectiveLayoutDirectionChanged();
}
}
-/*!
- \qmlproperty enumeration GridView::effectiveLayoutDirection
- This property holds the effective layout direction of the grid.
-
- When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts,
- the visual layout direction of the grid will be mirrored. However, the
- property \l {GridView::layoutDirection}{layoutDirection} will remain unchanged.
-
- \sa GridView::layoutDirection, {LayoutMirroring}{LayoutMirroring}
-*/
-
Qt::LayoutDirection QDeclarativeGridView::effectiveLayoutDirection() const
{
Q_D(const QDeclarativeGridView);
@@ -2628,7 +2618,7 @@ void QDeclarativeGridView::positionViewAtIndex(int index, int mode)
/*!
\qmlmethod GridView::positionViewAtBeginning()
\qmlmethod GridView::positionViewAtEnd()
- \since Quick 1.1
+ \since QtQuick 1.1
Positions the view at the beginning or end, taking into account any header or footer.
diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h
index d2dff48..078d033 100644
--- a/src/declarative/graphicsitems/qdeclarativegridview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h
@@ -75,7 +75,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeGridView : public QDeclarativeFlickable
Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged)
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1)
- Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1)
Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged)
Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged)
Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellWidthChanged)
@@ -194,7 +193,6 @@ Q_SIGNALS:
void delegateChanged();
void flowChanged();
Q_REVISION(1) void layoutDirectionChanged();
- Q_REVISION(1) void effectiveLayoutDirectionChanged();
void keyNavigationWrapsChanged();
void cacheBufferChanged();
void snapModeChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp
index e6bb798..9b9d680 100644
--- a/src/declarative/graphicsitems/qdeclarativeimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp
@@ -473,7 +473,7 @@ QRectF QDeclarativeImage::boundingRect() const
/*!
\qmlproperty bool Image::cache
- \since Quick 1.1
+ \since QtQuick 1.1
Specifies whether the image should be cached. The default value is
true. Setting \a cache to false is useful when dealing with large images,
@@ -482,7 +482,7 @@ QRectF QDeclarativeImage::boundingRect() const
/*!
\qmlproperty bool Image::mirror
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds whether the image should be horizontally inverted
(effectively displaying a mirrored image).
diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 91b430d..d36d163 100644
--- a/src/declarative/graphicsitems/qdeclarativeitem.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp
@@ -898,7 +898,6 @@ void QDeclarativeItemPrivate::setLayoutMirror(bool mirror)
_anchors->d_func()->fillChanged();
_anchors->d_func()->centerInChanged();
_anchors->d_func()->updateHorizontalAnchors();
- emit _anchors->mirroredChanged();
}
mirrorChange();
if (attachedLayoutDirection) {
@@ -2605,6 +2604,17 @@ void QDeclarativeItem::setKeepMouseGrab(bool keep)
If \a item is a \c null value, this maps the point from the coordinate
system of the root QML view.
*/
+
+/*!
+ Maps the point (\a x, \a y), which is in \a item's coordinate system, to
+ this item's coordinate system, and returns a script value with \c x and \c y
+ properties matching the mapped cooordinate.
+
+ If \a item is a \c null value, this maps the point from the coordinate
+ system of the root QML view.
+
+ \sa Item::mapFromItem()
+*/
QScriptValue QDeclarativeItem::mapFromItem(const QScriptValue &item, qreal x, qreal y) const
{
QScriptValue sv = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(this))->newObject();
@@ -2631,6 +2641,17 @@ QScriptValue QDeclarativeItem::mapFromItem(const QScriptValue &item, qreal x, qr
If \a item is a \c null value, this maps \a x and \a y to the coordinate
system of the root QML view.
*/
+
+/*!
+ Maps the point (\a x, \a y), which is in this item's coordinate system, to
+ \a item's coordinate system, and returns a script value with \c x and \c y
+ properties matching the mapped cooordinate.
+
+ If \a item is a \c null value, this maps \a x and \a y to the coordinate
+ system of the root QML view.
+
+ \sa Item::mapToItem()
+*/
QScriptValue QDeclarativeItem::mapToItem(const QScriptValue &item, qreal x, qreal y) const
{
QScriptValue sv = QDeclarativeEnginePrivate::getScriptEngine(qmlEngine(this))->newObject();
@@ -2650,8 +2671,17 @@ QScriptValue QDeclarativeItem::mapToItem(const QScriptValue &item, qreal x, qrea
/*!
\qmlmethod Item::forceActiveFocus()
- Force active focus on the item.
- This method sets focus on the item and makes sure that all the focus scopes higher in the object hierarchy are also given focus.
+ Forces active focus on the item.
+
+ This method sets focus on the item and makes sure that all the focus scopes
+ higher in the object hierarchy are also given the focus.
+*/
+
+/*!
+ Forces active focus on the item.
+
+ This method sets focus on the item and makes sure that all the focus scopes
+ higher in the object hierarchy are also given the focus.
*/
void QDeclarativeItem::forceActiveFocus()
{
@@ -2670,7 +2700,12 @@ void QDeclarativeItem::forceActiveFocus()
Returns the visible child item at point (\a x, \a y), which is in this
item's coordinate system, or \c null if there is no such item.
- */
+*/
+
+/*!
+ Returns the visible child item at point (\a x, \a y), which is in this
+ item's coordinate system, or 0 if there is no such item.
+*/
QDeclarativeItem *QDeclarativeItem::childAt(qreal x, qreal y) const
{
const QList<QGraphicsItem *> children = childItems();
@@ -3445,7 +3480,7 @@ qreal QDeclarativeItem::implicitHeight() const
/*!
\qmlproperty real Item::implicitWidth
\qmlproperty real Item::implicitHeight
- \since Quick 1.1
+ \since QtQuick 1.1
Defines the natural width or height of the Item if no \l width or \l height is specified.
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index e0bee7e..f0fc96b 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview.cpp
+++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp
@@ -288,7 +288,6 @@ public:
void mirrorChange() {
Q_Q(QDeclarativeListView);
regenerate();
- emit q->effectiveLayoutDirectionChanged();
}
bool isRightToLeft() const {
@@ -2189,7 +2188,12 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie
\o Qt.RightToLeft - Items will be laid out from right to let.
\endlist
- \sa ListView::effectiveLayoutDirection
+ When using the attached property \l {LayoutMirroring::enabled} for locale layouts,
+ the layout direction of the horizontal list will be mirrored. However, the actual property
+ \c layoutDirection will remain unchanged. You can use the property
+ \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored.
+
+ \sa {LayoutMirroring}{LayoutMirroring}
*/
Qt::LayoutDirection QDeclarativeListView::layoutDirection() const
@@ -2205,21 +2209,9 @@ void QDeclarativeListView::setLayoutDirection(Qt::LayoutDirection layoutDirectio
d->layoutDirection = layoutDirection;
d->regenerate();
emit layoutDirectionChanged();
- emit effectiveLayoutDirectionChanged();
}
}
-/*!
- \qmlproperty enumeration ListView::effectiveLayoutDirection
- This property holds the effective layout direction of the horizontal list.
-
- When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts,
- the visual layout direction of the horizontal list will be mirrored. However, the
- property \l {ListView::layoutDirection}{layoutDirection} will remain unchanged.
-
- \sa ListView::layoutDirection, {LayoutMirroring}{LayoutMirroring}
-*/
-
Qt::LayoutDirection QDeclarativeListView::effectiveLayoutDirection() const
{
Q_D(const QDeclarativeListView);
@@ -3036,7 +3028,7 @@ void QDeclarativeListView::positionViewAtIndex(int index, int mode)
/*!
\qmlmethod ListView::positionViewAtBeginning()
\qmlmethod ListView::positionViewAtEnd()
- \since Quick 1.1
+ \since QtQuick 1.1
Positions the view at the beginning or end, taking into account any header or footer.
diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h
index 2cd6ba7..00f9bee 100644
--- a/src/declarative/graphicsitems/qdeclarativelistview_p.h
+++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h
@@ -114,7 +114,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeListView : public QDeclarativeFlickable
Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged)
Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged)
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1)
- Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1)
Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged)
Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged)
Q_PROPERTY(QDeclarativeViewSection *section READ sectionCriteria CONSTANT)
@@ -229,7 +228,6 @@ Q_SIGNALS:
void spacingChanged();
void orientationChanged();
Q_REVISION(1) void layoutDirectionChanged();
- Q_REVISION(1) void effectiveLayoutDirectionChanged();
void currentIndexChanged();
void currentSectionChanged();
void highlightMoveSpeedChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
index 20ca0f6..0e06a4c 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -419,7 +419,7 @@ void QDeclarativeMouseArea::setEnabled(bool a)
/*!
\qmlproperty bool MouseArea::preventStealing
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds whether the mouse events may be stolen from this
MouseArea.
@@ -496,9 +496,6 @@ void QDeclarativeMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event)
d->pressAndHoldTimer.start(PressAndHoldDelay, this);
setKeepMouseGrab(d->stealMouse);
event->setAccepted(setPressed(true));
-
- if(!event->isAccepted() && d->forwardToList.count())
- d->forwardEvent(event);
}
}
@@ -576,9 +573,6 @@ void QDeclarativeMouseArea::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);
}
@@ -600,9 +594,6 @@ void QDeclarativeMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
if (s && s->mouseGrabberItem() == this)
ungrabMouse();
setKeepMouseGrab(false);
-
- if(!event->isAccepted() && d->forwardToList.count())
- d->forwardEvent(event);
}
d->doubleClick = false;
}
@@ -994,11 +985,4 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag()
*/
-QDeclarativeListProperty<QGraphicsObject> QDeclarativeMouseArea::forwardTo()
-{
- Q_D(QDeclarativeMouseArea);
- return d->forwardTo;
-}
-
-
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
index 8fd453f..f6f970b 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h
@@ -130,7 +130,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeMouseArea : public QDeclarativeItem
Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
Q_PROPERTY(QDeclarativeDrag *drag READ drag CONSTANT) //### add flicking to QDeclarativeDrag or add a QDeclarativeFlick ???
Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged REVISION 1)
- Q_PROPERTY(QDeclarativeListProperty<QGraphicsObject> forwardTo READ forwardTo);
public:
QDeclarativeMouseArea(QDeclarativeItem *parent=0);
@@ -158,8 +157,6 @@ public:
bool preventStealing() const;
void setPreventStealing(bool prevent);
- QDeclarativeListProperty<QGraphicsObject> forwardTo();
-
Q_SIGNALS:
void hoveredChanged();
void pressedChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
index 6626c56..f6ea00d 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
+++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h
@@ -70,8 +70,6 @@ public:
: absorb(true), hovered(false), pressed(false), longPress(false),
moved(false), stealMouse(false), doubleClick(false), preventStealing(false), drag(0)
{
- Q_Q(QDeclarativeMouseArea);
- forwardTo = QDeclarativeListProperty<QGraphicsObject>(q, forwardToList);
}
~QDeclarativeMouseAreaPrivate();
@@ -91,18 +89,6 @@ public:
lastModifiers = event->modifiers();
}
- void forwardEvent(QGraphicsSceneMouseEvent* event)
- {
- Q_Q(QDeclarativeMouseArea);
- for(int i=0; i < forwardToList.count(); i++){
- event->setPos(forwardToList[i]->mapFromScene(event->scenePos()));
- forwardToList[i]->scene()->sendEvent(forwardToList[i], event);
- if(event->isAccepted())
- break;
- }
- event->setPos(q->mapFromScene(event->scenePos()));
- }
-
bool isPressAndHoldConnected() {
Q_Q(QDeclarativeMouseArea);
static int idx = QObjectPrivate::get(q)->signalIndex("pressAndHold(QDeclarativeMouseEvent*)");
@@ -135,9 +121,6 @@ public:
Qt::MouseButtons lastButtons;
Qt::KeyboardModifiers lastModifiers;
QBasicTimer pressAndHoldTimer;
-
- QDeclarativeListProperty<QGraphicsObject> forwardTo;
- QList<QGraphicsObject*> forwardToList;
};
QT_END_NAMESPACE
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
index 3f4d6de..483cad4 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
@@ -584,7 +584,7 @@ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent)
/*!
\qmlproperty enumeration Row::layoutDirection
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds the layoutDirection of the row.
@@ -597,7 +597,12 @@ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent)
the right anchor remains to the right of the row.
\endlist
- \sa Grid::layoutDirection, Flow::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}
+ When using the attached property \l {LayoutMirroring::enabled} for locale layouts,
+ the visual layout direction of the row positioner will be mirrored. However, the
+ property \c layoutDirection will remain unchanged. You can use the property
+ \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored.
+
+ \sa Grid::layoutDirection, Flow::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}, {LayoutMirroring}{LayoutMirroring}
*/
Qt::LayoutDirection QDeclarativeRow::layoutDirection() const
{
@@ -616,21 +621,9 @@ void QDeclarativeRow::setLayoutDirection(Qt::LayoutDirection layoutDirection)
d->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry);
prePositioning();
emit layoutDirectionChanged();
- emit effectiveLayoutDirectionChanged();
}
}
-/*!
- \qmlproperty enumeration Row::effectiveLayoutDirection
- This property holds the effective layout direction of the row positioner.
-
- When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts,
- the visual layout direction of the row positioner will be mirrored. However, the
- property \l {Row::layoutDirection}{layoutDirection} will remain unchanged.
-
- \sa Row::layoutDirection, {LayoutMirroring}{LayoutMirroring}
-*/
-
Qt::LayoutDirection QDeclarativeRow::effectiveLayoutDirection() const
{
return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this);
@@ -885,7 +878,7 @@ void QDeclarativeGrid::setFlow(Flow flow)
/*!
\qmlproperty enumeration Grid::layoutDirection
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds the layout direction of the layout.
@@ -900,7 +893,12 @@ void QDeclarativeGrid::setFlow(Flow flow)
\l Grid::flow property.
\endlist
- \sa Flow::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}
+ When using the attached property \l {LayoutMirroring::enabled} for locale layouts,
+ the visual layout direction of the grid positioner will be mirrored. However, the
+ property \c layoutDirection will remain unchanged. You can use the property
+ \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored.
+
+ \sa Flow::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}, {LayoutMirroring}{LayoutMirroring}
*/
Qt::LayoutDirection QDeclarativeGrid::layoutDirection() const
{
@@ -918,22 +916,10 @@ void QDeclarativeGrid::setLayoutDirection(Qt::LayoutDirection layoutDirection)
else
d->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry);
prePositioning();
- emit layoutDirectionChanged();
- emit effectiveLayoutDirectionChanged();
+ emit layoutDirectionChanged();;
}
}
-/*!
- \qmlproperty enumeration Grid::effectiveLayoutDirection
- This property holds the effective layout direction of the grid positioner.
-
- When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts,
- the visual layout direction of the grid positioner will be mirrored. However, the
- property \l {Grid::layoutDirection}{layoutDirection} will remain unchanged.
-
- \sa Grid::layoutDirection, {LayoutMirroring}{LayoutMirroring}
-*/
-
Qt::LayoutDirection QDeclarativeGrid::effectiveLayoutDirection() const
{
return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this);
@@ -1250,7 +1236,7 @@ void QDeclarativeFlow::setFlow(Flow flow)
/*!
\qmlproperty enumeration Flow::layoutDirection
- \since Quick 1.1
+ \since QtQuick 1.1
This property holds the layout direction of the layout.
@@ -1265,7 +1251,12 @@ void QDeclarativeFlow::setFlow(Flow flow)
\l Flow::flow property.
\endlist
- \sa Grid::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}
+ When using the attached property \l {LayoutMirroring::enabled} for locale layouts,
+ the visual layout direction of the flow positioner will be mirrored. However, the
+ property \c layoutDirection will remain unchanged. You can use the property
+ \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored.
+
+ \sa Grid::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}, {LayoutMirroring}{LayoutMirroring}
*/
Qt::LayoutDirection QDeclarativeFlow::layoutDirection() const
@@ -1281,21 +1272,9 @@ void QDeclarativeFlow::setLayoutDirection(Qt::LayoutDirection layoutDirection)
d->layoutDirection = layoutDirection;
prePositioning();
emit layoutDirectionChanged();
- emit effectiveLayoutDirectionChanged();
}
}
-/*!
- \qmlproperty enumeration Flow::effectiveLayoutDirection
- This property holds the effective layout direction of the flow positioner.
-
- When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts,
- the visual layout direction of the grid positioner will be mirrored. However, the
- property \l {Flow::layoutDirection}{layoutDirection} will remain unchanged.
-
- \sa Flow::layoutDirection, {LayoutMirroring}{LayoutMirroring}
-*/
-
Qt::LayoutDirection QDeclarativeFlow::effectiveLayoutDirection() const
{
return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this);
diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
index 3d62a88..1e6c118 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h
+++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h
@@ -130,7 +130,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner
{
Q_OBJECT
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1)
- Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1)
public:
QDeclarativeRow(QDeclarativeItem *parent=0);
@@ -140,7 +139,6 @@ public:
Q_SIGNALS:
Q_REVISION(1) void layoutDirectionChanged();
- Q_REVISION(1) void effectiveLayoutDirectionChanged();
protected:
virtual void doPositioning(QSizeF *contentSize);
@@ -156,7 +154,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner
Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged)
Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged)
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1)
- Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1)
public:
QDeclarativeGrid(QDeclarativeItem *parent=0);
@@ -180,7 +177,6 @@ Q_SIGNALS:
void columnsChanged();
void flowChanged();
Q_REVISION(1) void layoutDirectionChanged();
- Q_REVISION(1) void effectiveLayoutDirectionChanged();
protected:
virtual void doPositioning(QSizeF *contentSize);
@@ -199,7 +195,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner
Q_OBJECT
Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged)
Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1)
- Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1)
public:
QDeclarativeFlow(QDeclarativeItem *parent=0);
@@ -214,7 +209,6 @@ public:
Q_SIGNALS:
void flowChanged();
Q_REVISION(1) void layoutDirectionChanged();
- Q_REVISION(1) void effectiveLayoutDirectionChanged();
protected:
virtual void doPositioning(QSizeF *contentSize);
diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
index 813c255..e881b96 100644
--- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp
+++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp
@@ -128,7 +128,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate()
/*!
\qmlsignal Repeater::onItemAdded(int index, Item item)
- \since Quick 1.1
+ \since QtQuick 1.1
This handler is called when an item is added to the repeater. The \a index
parameter holds the index at which the item has been inserted within the
@@ -137,7 +137,7 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate()
/*!
\qmlsignal Repeater::onItemRemoved(int index, Item item)
- \since Quick 1.1
+ \since QtQuick 1.1
This handler is called when an item is removed from the repeater. The \a index
parameter holds the index at which the item was removed from the repeater,
@@ -306,7 +306,7 @@ int QDeclarativeRepeater::count() const
/*!
\qmlmethod Item Repeater::itemAt(index)
- \since Quick 1.1
+ \since QtQuick 1.1
Returns the \l Item that has been created at the given \a index, or \c null
if no item exists at \a index.
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 96bd792..20e4eef 100644
--- a/src/declarative/graphicsitems/qdeclarativetext.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetext.cpp
@@ -1040,7 +1040,6 @@ void QDeclarativeText::setStyleColor(const QColor &color)
/*!
\qmlproperty enumeration Text::horizontalAlignment
\qmlproperty enumeration Text::verticalAlignment
- \qmlproperty enumeration Text::effectiveHorizontalAlignment
Sets the horizontal and vertical alignment of the text within the Text items
width and height. By default, the text is vertically aligned to the top. Horizontal
@@ -1056,10 +1055,10 @@ void QDeclarativeText::setStyleColor(const QColor &color)
need to either modify the Item::anchors, or set horizontalAlignment to Text.AlignHCenter and bind the width to
that of the parent.
- When using the attached property LayoutMirroring::enabled to mirror application
+ When using the attached property \l {LayoutMirroring::enabled} to mirror application
layouts, the horizontal alignment of text will also be mirrored. However, the property
\c horizontalAlignment will remain unchanged. To query the effective horizontal alignment
- of Text, use the read-only property \c effectiveHorizontalAlignment.
+ of Text, use the property \l {LayoutMirroring::enabled}.
*/
QDeclarativeText::HAlignment QDeclarativeText::hAlign() const
{
@@ -1109,10 +1108,7 @@ bool QDeclarativeTextPrivate::setHAlign(QDeclarativeText::HAlignment alignment,
if (hAlign != alignment || forceAlign) {
QDeclarativeText::HAlignment oldEffectiveHAlign = q->effectiveHAlign();
hAlign = alignment;
-
emit q->horizontalAlignmentChanged(hAlign);
- if (oldEffectiveHAlign != q->effectiveHAlign())
- emit q->effectiveHorizontalAlignmentChanged();
return true;
}
return false;
@@ -1134,7 +1130,6 @@ void QDeclarativeTextPrivate::mirrorChange()
if (q->isComponentComplete()) {
if (!hAlignImplicit && (hAlign == QDeclarativeText::AlignRight || hAlign == QDeclarativeText::AlignLeft)) {
updateLayout();
- emit q->effectiveHorizontalAlignmentChanged();
}
}
}
@@ -1195,7 +1190,7 @@ void QDeclarativeText::setWrapMode(WrapMode mode)
/*!
\qmlproperty int Text::lineCount
- \since Quick 1.1
+ \since QtQuick 1.1
Returns the number of lines visible in the text item.
@@ -1211,7 +1206,7 @@ int QDeclarativeText::lineCount() const
/*!
\qmlproperty bool Text::truncated
- \since Quick 1.1
+ \since QtQuick 1.1
Returns true if the text has been truncated due to \l maximumLineCount
or \l elide.
@@ -1228,7 +1223,7 @@ bool QDeclarativeText::truncated() const
/*!
\qmlproperty int Text::maximumLineCount
- \since Quick 1.1
+ \since QtQuick 1.1
Set this property to limit the number of lines that the text item will show.
If elide is set to Text.ElideRight, the text will be elided appropriately.
@@ -1462,7 +1457,7 @@ qreal QDeclarativeText::paintedHeight() const
/*!
\qmlproperty real Text::lineHeight
- \since Quick 1.1
+ \since QtQuick 1.1
Sets the line height for the text.
The value can be in pixels or a multiplier depending on lineHeightMode.
diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h
index b711582..1004b71 100644
--- a/src/declarative/graphicsitems/qdeclarativetext_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetext_p.h
@@ -70,7 +70,6 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeImplici
Q_PROPERTY(TextStyle style READ style WRITE setStyle NOTIFY styleChanged)
Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor NOTIFY styleColorChanged)
Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged)
- Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1)
Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged)
Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged)
Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1)
@@ -191,7 +190,6 @@ Q_SIGNALS:
void paintedSizeChanged();
Q_REVISION(1) void lineHeightChanged(qreal lineHeight);
Q_REVISION(1) void lineHeightModeChanged(LineHeightMode mode);
- Q_REVISION(1) void effectiveHorizontalAlignmentChanged();
protected:
void mousePressEvent(QGraphicsSceneMouseEvent *event);
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
index 6806df0..ca7e948 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -107,7 +107,7 @@ TextEdit {
/*!
\qmlsignal TextEdit::onLinkActivated(string link)
- \since Quick 1.1
+ \since QtQuick 1.1
This handler is called when the user clicks on a link embedded in the text.
The link must be in rich text or HTML format and the
@@ -458,7 +458,6 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color)
/*!
\qmlproperty enumeration TextEdit::horizontalAlignment
\qmlproperty enumeration TextEdit::verticalAlignment
- \qmlproperty enumeration TextEdit::effectiveHorizontalAlignment
Sets the horizontal and vertical alignment of the text within the TextEdit item's
width and height. By default, the text alignment follows the natural alignment
@@ -480,10 +479,10 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color)
\o TextEdit.AlignVCenter
\endlist
- When using the attached property LayoutMirroring::enabled to mirror application
+ When using the attached property \l {LayoutMirroring::enabled} to mirror application
layouts, the horizontal alignment of text will also be mirrored. However, the property
\c horizontalAlignment will remain unchanged. To query the effective horizontal alignment
- of TextEdit, use the read-only property \c effectiveHorizontalAlignment.
+ of TextEdit, use the property \l {LayoutMirroring::enabled}.
*/
QDeclarativeTextEdit::HAlignment QDeclarativeTextEdit::hAlign() const
{
@@ -538,8 +537,6 @@ bool QDeclarativeTextEditPrivate::setHAlign(QDeclarativeTextEdit::HAlignment ali
QDeclarativeTextEdit::HAlignment oldEffectiveHAlign = q->effectiveHAlign();
hAlign = alignment;
emit q->horizontalAlignmentChanged(alignment);
- if (oldEffectiveHAlign != q->effectiveHAlign())
- emit q->effectiveHorizontalAlignmentChanged();
return true;
}
return false;
@@ -562,7 +559,6 @@ void QDeclarativeTextEditPrivate::mirrorChange()
if (!hAlignImplicit && (hAlign == QDeclarativeTextEdit::AlignRight || hAlign == QDeclarativeTextEdit::AlignLeft)) {
updateDefaultTextOption();
q->updateSize();
- emit q->effectiveHorizontalAlignmentChanged();
}
}
}
@@ -619,7 +615,7 @@ void QDeclarativeTextEdit::setWrapMode(WrapMode mode)
/*!
\qmlproperty int TextEdit::lineCount
- \since Quick 1.1
+ \since QtQuick 1.1
Returns the total number of lines in the textEdit item.
*/
@@ -713,7 +709,7 @@ void QDeclarativeTextEdit::moveCursorSelection(int pos)
/*!
\qmlmethod void TextEdit::moveCursorSelection(int position, SelectionMode mode = TextEdit.SelectCharacters)
- \since Quick 1.1
+ \since QtQuick 1.1
Moves the cursor to \a position and updates the selection according to the optional \a mode
parameter. (To only move the cursor, set the \l cursorPosition property.)
@@ -1078,7 +1074,7 @@ void QDeclarativeTextEdit::setSelectByMouse(bool on)
/*!
\qmlproperty enum TextEdit::mouseSelectionMode
- \since Quick 1.1
+ \since QtQuick 1.1
Specifies how text should be selected using a mouse.
@@ -1224,7 +1220,7 @@ void QDeclarativeTextEditPrivate::focusChanged(bool hasFocus)
/*!
\qmlmethod void TextEdit::deselect()
- \since Quick 1.1
+ \since QtQuick 1.1
Removes active text selection.
*/
diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
index f9a6c73..d8fc3bc 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h
@@ -73,7 +73,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa
Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged)
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged)
- Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1)
Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged)
Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged)
Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1)
@@ -249,7 +248,6 @@ Q_SIGNALS:
Q_REVISION(1) void linkActivated(const QString &link);
Q_REVISION(1) void canPasteChanged();
Q_REVISION(1) void inputMethodComposingChanged();
- Q_REVISION(1) void effectiveHorizontalAlignmentChanged();
public Q_SLOTS:
void selectAll();
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
index dd5a58e..5245236 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp
@@ -236,11 +236,11 @@ void QDeclarativeTextInput::setFont(const QFont &font)
if (oldFont != d->font) {
d->control->setFont(d->font);
+ updateSize();
+ updateCursorRectangle();
if(d->cursorItem){
d->cursorItem->setHeight(QFontMetrics(d->font).height());
- moveCursor();
}
- updateSize();
}
emit fontChanged(d->sourceFont);
}
@@ -326,7 +326,6 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color)
/*!
\qmlproperty enumeration TextInput::horizontalAlignment
- \qmlproperty enumeration TextInput::effectiveHorizontalAlignment
Sets the horizontal alignment of the text within the TextInput item's
width and height. By default, the text alignment follows the natural alignment
@@ -342,10 +341,10 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color)
The valid values for \c horizontalAlignment are \c TextInput.AlignLeft, \c TextInput.AlignRight and
\c TextInput.AlignHCenter.
- When using the attached property LayoutMirroring::enabled to mirror application
+ When using the attached property \l {LayoutMirroring::enabled} to mirror application
layouts, the horizontal alignment of text will also be mirrored. However, the property
\c horizontalAlignment will remain unchanged. To query the effective horizontal alignment
- of TextInput, use the read-only property \c effectiveHorizontalAlignment.
+ of TextInput, use the property \l {LayoutMirroring::enabled}.
*/
QDeclarativeTextInput::HAlignment QDeclarativeTextInput::hAlign() const
{
@@ -359,8 +358,7 @@ void QDeclarativeTextInput::setHAlign(HAlignment align)
bool forceAlign = d->hAlignImplicit && d->effectiveLayoutMirror;
d->hAlignImplicit = false;
if (d->setHAlign(align, forceAlign) && isComponentComplete()) {
- updateRect();
- d->updateHorizontalScroll();
+ updateCursorRectangle();
}
}
@@ -369,8 +367,7 @@ void QDeclarativeTextInput::resetHAlign()
Q_D(QDeclarativeTextInput);
d->hAlignImplicit = true;
if (d->determineHorizontalAlignment() && isComponentComplete()) {
- updateRect();
- d->updateHorizontalScroll();
+ updateCursorRectangle();
}
}
@@ -400,8 +397,6 @@ bool QDeclarativeTextInputPrivate::setHAlign(QDeclarativeTextInput::HAlignment a
QDeclarativeTextInput::HAlignment oldEffectiveHAlign = q->effectiveHAlign();
hAlign = alignment;
emit q->horizontalAlignmentChanged(alignment);
- if (oldEffectiveHAlign != q->effectiveHAlign())
- emit q->effectiveHorizontalAlignmentChanged();
return true;
}
return false;
@@ -423,9 +418,8 @@ void QDeclarativeTextInputPrivate::mirrorChange()
Q_Q(QDeclarativeTextInput);
if (q->isComponentComplete()) {
if (!hAlignImplicit && (hAlign == QDeclarativeTextInput::AlignRight || hAlign == QDeclarativeTextInput::AlignLeft)) {
- q->updateRect();
+ q->updateCursorRectangle();
updateHorizontalScroll();
- emit q->effectiveHorizontalAlignmentChanged();
}
}
}
@@ -566,13 +560,11 @@ QRect QDeclarativeTextInput::cursorRectangle() const
\qmlproperty int TextInput::selectionStart
The cursor position before the first character in the current selection.
- Setting this and selectionEnd allows you to specify a selection in the
- text edit.
- Note that if selectionStart == selectionEnd then there is no current
- selection.
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
- \sa selectionEnd, cursorPosition, selectedText, select()
+ \sa selectionEnd, cursorPosition, selectedText
*/
int QDeclarativeTextInput::selectionStart() const
{
@@ -584,13 +576,11 @@ int QDeclarativeTextInput::selectionStart() const
\qmlproperty int TextInput::selectionEnd
The cursor position after the last character in the current selection.
- Setting this and selectionStart allows you to specify a selection in the
- text edit.
- Note that if selectionStart == selectionEnd then there is no current
- selection.
+ This property is read-only. To change the selection, use select(start,end),
+ selectAll(), or selectWord().
- \sa selectionStart, cursorPosition, selectedText, select()
+ \sa selectionStart, cursorPosition, selectedText
*/
int QDeclarativeTextInput::selectionEnd() const
{
@@ -683,7 +673,7 @@ void QDeclarativeTextInput::setAutoScroll(bool b)
d->autoScroll = b;
//We need to repaint so that the scrolling is taking into account.
updateSize(true);
- d->updateHorizontalScroll();
+ updateCursorRectangle();
emit autoScrollChanged(d->autoScroll);
}
@@ -947,10 +937,6 @@ void QDeclarativeTextInput::setCursorDelegate(QDeclarativeComponent* c)
d->cursorComponent = c;
if(!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();
@@ -962,10 +948,6 @@ void QDeclarativeTextInput::setCursorDelegate(QDeclarativeComponent* c)
void QDeclarativeTextInputPrivate::startCreatingCursor()
{
Q_Q(QDeclarativeTextInput);
- q->connect(control, SIGNAL(cursorPositionChanged(int,int)),
- q, SLOT(moveCursor()), Qt::UniqueConnection);
- q->connect(control, SIGNAL(updateMicroFocus()),
- q, SLOT(moveCursor()), Qt::UniqueConnection);
if(cursorComponent->isReady()){
q->createCursor();
}else if(cursorComponent->isLoading()){
@@ -1001,15 +983,6 @@ void QDeclarativeTextInput::createCursor()
d->cursorItem->setHeight(d->control->height()-1); // -1 to counter QLineControl's +1 which is not consistent with Text.
}
-void QDeclarativeTextInput::moveCursor()
-{
- Q_D(QDeclarativeTextInput);
- if(!d->cursorItem)
- return;
- d->updateHorizontalScroll();
- d->cursorItem->setX(d->control->cursorToX() - d->hscroll);
-}
-
/*!
\qmlmethod rect TextInput::positionToRectangle(int pos)
@@ -1037,7 +1010,7 @@ int QDeclarativeTextInput::positionAt(int x) const
/*!
\qmlmethod int TextInput::positionAt(int x, CursorPosition position = CursorBetweenCharacters)
- \since Quick 1.1
+ \since QtQuick 1.1
This function returns the character position at
x pixels from the left of the textInput. Position 0 is before the
@@ -1073,7 +1046,7 @@ void QDeclarativeTextInputPrivate::focusChanged(bool hasFocus)
Q_Q(QDeclarativeTextInput);
focused = hasFocus;
q->setCursorVisible(hasFocus && scene && scene->hasFocus());
- if(q->echoMode() == QDeclarativeTextInput::PasswordEchoOnEdit && !hasFocus)
+ if(!hasFocus && control->passwordEchoEditing())
control->updatePasswordEchoEditing(false);//QLineControl sets it on key events, but doesn't deal with focus events
if (!hasFocus)
control->deselect();
@@ -1118,8 +1091,6 @@ void QDeclarativeTextInput::inputMethodEvent(QInputMethodEvent *ev)
ev->ignore();
} else {
d->control->processInputMethodEvent(ev);
- updateSize();
- d->updateHorizontalScroll();
}
}
if (!ev->isAccepted())
@@ -1297,7 +1268,7 @@ void QDeclarativeTextInput::geometryChanged(const QRectF &newGeometry,
Q_D(QDeclarativeTextInput);
if (newGeometry.width() != oldGeometry.width()) {
updateSize();
- d->updateHorizontalScroll();
+ updateCursorRectangle();
}
QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry);
}
@@ -1427,7 +1398,7 @@ QVariant QDeclarativeTextInput::inputMethodQuery(Qt::InputMethodQuery property)
/*!
\qmlmethod void TextInput::deselect()
- \since Quick 1.1
+ \since QtQuick 1.1
Removes active text selection.
*/
@@ -1599,7 +1570,7 @@ void QDeclarativeTextInput::setSelectByMouse(bool on)
/*!
\qmlproperty enum TextInput::mouseSelectionMode
- \since Quick 1.1
+ \since QtQuick 1.1
Specifies how text should be selected using a mouse.
@@ -1643,12 +1614,11 @@ void QDeclarativeTextInput::moveCursorSelection(int position)
{
Q_D(QDeclarativeTextInput);
d->control->moveCursor(position, true);
- d->updateHorizontalScroll();
}
/*!
\qmlmethod void TextInput::moveCursorSelection(int position, SelectionMode mode = TextInput.SelectCharacters)
- \since Quick 1.1
+ \since QtQuick 1.1
Moves the cursor to \a position and updates the selection according to the optional \a mode
parameter. (To only move the cursor, set the \l cursorPosition property.)
@@ -1901,7 +1871,7 @@ void QDeclarativeTextInputPrivate::init()
canPaste = !control->isReadOnly() && QApplication::clipboard()->text().length() != 0;
#endif // QT_NO_CLIPBOARD
q->connect(control, SIGNAL(updateMicroFocus()),
- q, SLOT(updateMicroFocus()));
+ q, SLOT(updateCursorRectangle()));
q->connect(control, SIGNAL(displayTextChanged(QString)),
q, SLOT(updateRect()));
q->updateSize();
@@ -1917,9 +1887,7 @@ void QDeclarativeTextInputPrivate::init()
void QDeclarativeTextInput::cursorPosChanged()
{
Q_D(QDeclarativeTextInput);
- d->updateHorizontalScroll();
- updateRect();//TODO: Only update rect between pos's
- updateMicroFocus();
+ updateCursorRectangle();
emit cursorPositionChanged();
d->control->resetCursorBlinkTimer();
@@ -1935,6 +1903,17 @@ void QDeclarativeTextInput::cursorPosChanged()
}
}
+void QDeclarativeTextInput::updateCursorRectangle()
+{
+ Q_D(QDeclarativeTextInput);
+ d->updateHorizontalScroll();
+ updateRect();//TODO: Only update rect between pos's
+ updateMicroFocus();
+ emit cursorRectangleChanged();
+ if (d->cursorItem)
+ d->cursorItem->setX(d->control->cursorToX() - d->hscroll);
+}
+
void QDeclarativeTextInput::selectionChanged()
{
Q_D(QDeclarativeTextInput);
@@ -1958,12 +1937,12 @@ void QDeclarativeTextInput::selectionChanged()
void QDeclarativeTextInput::q_textChanged()
{
Q_D(QDeclarativeTextInput);
+ emit textChanged();
+ emit displayTextChanged();
updateSize();
d->determineHorizontalAlignment();
d->updateHorizontalScroll();
updateMicroFocus();
- emit textChanged();
- emit displayTextChanged();
if(hasAcceptableInput() != d->oldValidity){
d->oldValidity = hasAcceptableInput();
emit acceptableInputChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h
index aaf8859..2c2f230 100644
--- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h
@@ -71,11 +71,10 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativeImplicitSizeP
Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged)
Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged)
Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged)
- Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1)
Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged)
Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged)
Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged)
- Q_PROPERTY(QRect cursorRectangle READ cursorRectangle NOTIFY cursorPositionChanged)
+ Q_PROPERTY(QRect cursorRectangle READ cursorRectangle NOTIFY cursorRectangleChanged)
Q_PROPERTY(QDeclarativeComponent *cursorDelegate READ cursorDelegate WRITE setCursorDelegate NOTIFY cursorDelegateChanged)
Q_PROPERTY(int selectionStart READ selectionStart NOTIFY selectionStartChanged)
Q_PROPERTY(int selectionEnd READ selectionEnd NOTIFY selectionEndChanged)
@@ -221,6 +220,7 @@ public:
Q_SIGNALS:
void textChanged();
void cursorPositionChanged();
+ void cursorRectangleChanged();
void selectionStartChanged();
void selectionEndChanged();
void selectedTextChanged();
@@ -246,7 +246,6 @@ Q_SIGNALS:
Q_REVISION(1) void mouseSelectionModeChanged(SelectionMode mode);
Q_REVISION(1) void canPasteChanged();
Q_REVISION(1) void inputMethodComposingChanged();
- Q_REVISION(1) void effectiveHorizontalAlignmentChanged();
protected:
virtual void geometryChanged(const QRectF &newGeometry,
@@ -279,8 +278,8 @@ private Q_SLOTS:
void q_textChanged();
void selectionChanged();
void createCursor();
- void moveCursor();
void cursorPosChanged();
+ void updateCursorRectangle();
void updateRect(const QRect &r = QRect());
void q_canPasteChanged();
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
index 73a8570..e7bcf1f 100644
--- a/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextlayout.cpp
@@ -69,14 +69,17 @@ class DrawTextItemRecorder: public QPaintEngine
public:
DrawTextItemRecorder(bool untransformedCoordinates, bool useBackendOptimizations)
: m_inertText(0), m_dirtyPen(false), m_useBackendOptimizations(useBackendOptimizations),
- m_untransformedCoordinates(untransformedCoordinates)
+ m_untransformedCoordinates(untransformedCoordinates), m_currentColor(Qt::black)
{
}
virtual void updateState(const QPaintEngineState &newState)
{
- if (newState.state() & QPaintEngine::DirtyPen)
+ if (newState.state() & QPaintEngine::DirtyPen
+ && newState.pen().color() != m_currentColor) {
m_dirtyPen = true;
+ m_currentColor = newState.pen().color();
+ }
}
virtual void drawTextItem(const QPointF &position, const QTextItem &textItem)
@@ -112,7 +115,7 @@ class DrawTextItemRecorder: public QPaintEngine
currentItem.positionOffset = positionOffset;
currentItem.useBackendOptimizations = m_useBackendOptimizations;
if (m_dirtyPen)
- currentItem.color = state->pen().color();
+ currentItem.color = m_currentColor;
m_inertText->items.append(currentItem);
}
@@ -169,6 +172,7 @@ class DrawTextItemRecorder: public QPaintEngine
bool m_dirtyPen;
bool m_useBackendOptimizations;
bool m_untransformedCoordinates;
+ QColor m_currentColor;
};
class DrawTextItemDevice: public QPaintDevice
@@ -296,7 +300,7 @@ void QDeclarativeTextLayout::clearLayout()
QTextLayout::clearLayout();
}
-void QDeclarativeTextLayout::prepare(QPainter *painter)
+void QDeclarativeTextLayout::prepare()
{
if (!d || !d->cached) {
@@ -305,7 +309,6 @@ void QDeclarativeTextLayout::prepare(QPainter *painter)
InertTextPainter *itp = inertTextPainter();
itp->device.begin(d);
- itp->painter.setPen(painter->pen());
QTextLayout::draw(&itp->painter, QPointF(0, 0));
glyph_t *glyphPool = d->glyphs.data();
@@ -344,7 +347,7 @@ void QDeclarativeTextLayout::draw(QPainter *painter, const QPointF &p)
return;
}
- prepare(painter);
+ prepare();
int itemCount = d->items.count();
diff --git a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
index 85d333e..d83ce7e 100644
--- a/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
+++ b/src/declarative/graphicsitems/qdeclarativetextlayout_p.h
@@ -61,7 +61,7 @@ public:
void beginLayout();
void clearLayout();
- void prepare(QPainter *);
+ void prepare();
void draw(QPainter *, const QPointF & = QPointF());
private:
diff --git a/src/declarative/qml/qdeclarativebinding.cpp b/src/declarative/qml/qdeclarativebinding.cpp
index ca3bc37..689cd00 100644
--- a/src/declarative/qml/qdeclarativebinding.cpp
+++ b/src/declarative/qml/qdeclarativebinding.cpp
@@ -243,12 +243,13 @@ QDeclarativeBinding::createBinding(Identifier id, QObject *obj, QDeclarativeCont
if (id < 0)
return 0;
+ Q_ASSERT(ctxt);
QDeclarativeContextData *ctxtdata = QDeclarativeContextData::get(ctxt);
- QDeclarativeEnginePrivate *engine = QDeclarativeEnginePrivate::get(qmlEngine(obj));
+ QDeclarativeEnginePrivate *engine = QDeclarativeEnginePrivate::get(ctxtdata->engine);
QDeclarativeCompiledData *cdata = 0;
QDeclarativeTypeData *typeData = 0;
- if (engine && ctxtdata && !ctxtdata->url.isEmpty()) {
+ if (!ctxtdata->url.isEmpty()) {
typeData = engine->typeLoader.get(ctxtdata->url);
cdata = typeData->compiledData();
}
diff --git a/src/declarative/qml/qdeclarativecompiledbindings.cpp b/src/declarative/qml/qdeclarativecompiledbindings.cpp
index 313fe58..51ffc10 100644
--- a/src/declarative/qml/qdeclarativecompiledbindings.cpp
+++ b/src/declarative/qml/qdeclarativecompiledbindings.cpp
@@ -143,17 +143,17 @@ struct Register {
void setNaN() { setqreal(qSNaN()); }
bool isUndefined() const { return type == 0; }
- void setQObject(QObject *o) { *((QObject **)data) = o; type = QMetaType::QObjectStar; }
- QObject *getQObject() const { return *((QObject **)data); }
+ void setQObject(QObject *o) { qobjectValue = o; type = QMetaType::QObjectStar; }
+ QObject *getQObject() const { return qobjectValue; }
- void setqreal(qreal v) { *((qreal *)data) = v; type = QMetaType::QReal; }
- qreal getqreal() const { return *((qreal *)data); }
+ void setqreal(qreal v) { qrealValue = v; type = QMetaType::QReal; }
+ qreal getqreal() const { return qrealValue; }
- void setint(int v) { *((int *)data) = v; type = QMetaType::Int; }
- int getint() const { return *((int *)data); }
+ void setint(int v) { intValue = v; type = QMetaType::Int; }
+ int getint() const { return intValue; }
- void setbool(bool v) { *((bool *)data) = v; type = QMetaType::Bool; }
- bool getbool() const { return *((bool *)data); }
+ void setbool(bool v) { boolValue = v; type = QMetaType::Bool; }
+ bool getbool() const { return boolValue; }
QVariant *getvariantptr() { return (QVariant *)typeDataPtr(); }
QString *getstringptr() { return (QString *)typeDataPtr(); }
@@ -171,7 +171,15 @@ struct Register {
void settype(int t) { type = t; }
int type; // Optional type
- void *data[2]; // Object stored here
+ union {
+ QObject *qobjectValue;
+ qreal qrealValue;
+ int intValue;
+ bool boolValue;
+ char data[sizeof(QVariant)];
+ qint64 q_for_alignment_1;
+ double q_for_alignment_2;
+ };
#ifdef REGISTER_CLEANUP_DEBUG
Register() {
@@ -2388,7 +2396,7 @@ bool QDeclarativeBindingCompilerPrivate::parseConditional(QDeclarativeJS::AST::N
skip.skip.reg = -1;
bytecode << skip;
- // Release to allow reuse of reg
+ // Release to allow reuse of reg in else path
releaseReg(ok.reg);
bytecode[skipIdx].skip.count = bytecode.count() - skipIdx - 1;
@@ -2398,8 +2406,7 @@ bool QDeclarativeBindingCompilerPrivate::parseConditional(QDeclarativeJS::AST::N
if (!parseExpression(expression->ko, ko)) return false;
if (ko.unknownType) return false;
- // Release to allow reuse of reg
- releaseReg(ko.reg);
+ // Do not release reg here, so that its ownership passes to the caller
bytecode[skipIdx2].skip.count = bytecode.count() - skipIdx2 - 1;
if (ok != ko)
diff --git a/src/declarative/qml/qdeclarativedata_p.h b/src/declarative/qml/qdeclarativedata_p.h
index 2a5eace..4f22b8f 100644
--- a/src/declarative/qml/qdeclarativedata_p.h
+++ b/src/declarative/qml/qdeclarativedata_p.h
@@ -55,10 +55,10 @@
#include <QtScript/qscriptvalue.h>
#include <private/qobject_p.h>
-#include "private/qdeclarativeguard_p.h"
QT_BEGIN_NAMESPACE
+class QDeclarativeGuardImpl;
class QDeclarativeCompiledData;
class QDeclarativeAbstractBinding;
class QDeclarativeContext;
@@ -134,7 +134,7 @@ public:
quint32 objectDataRefCount;
QDeclarativePropertyCache *propertyCache;
- QDeclarativeGuard<QObject> *guards;
+ QDeclarativeGuardImpl *guards;
static QDeclarativeData *get(const QObject *object, bool create = false) {
QObjectPrivate *priv = QObjectPrivate::get(const_cast<QObject *>(object));
@@ -160,32 +160,6 @@ private:
mutable QDeclarativeDataExtended *extendedData;
};
-template<class T>
-void QDeclarativeGuard<T>::addGuard()
-{
- Q_ASSERT(!prev);
-
- if (QObjectPrivate::get(o)->wasDeleted)
- return;
-
- QDeclarativeData *data = QDeclarativeData::get(o, true);
- next = data->guards;
- if (next) reinterpret_cast<QDeclarativeGuard<T> *>(next)->prev = &next;
- data->guards = reinterpret_cast<QDeclarativeGuard<QObject> *>(this);
- prev = &data->guards;
-}
-
-template<class T>
-void QDeclarativeGuard<T>::remGuard()
-{
- Q_ASSERT(prev);
-
- if (next) reinterpret_cast<QDeclarativeGuard<T> *>(next)->prev = prev;
- *prev = next;
- next = 0;
- prev = 0;
-}
-
QT_END_NAMESPACE
#endif // QDECLARATIVEDATA_P_H
diff --git a/src/declarative/qml/qdeclarativeengine.cpp b/src/declarative/qml/qdeclarativeengine.cpp
index e9feff4..34014f7 100644
--- a/src/declarative/qml/qdeclarativeengine.cpp
+++ b/src/declarative/qml/qdeclarativeengine.cpp
@@ -1154,7 +1154,7 @@ void QDeclarativeData::destroyed(QObject *object)
context->destroy();
while (guards) {
- QDeclarativeGuard<QObject> *guard = guards;
+ QDeclarativeGuard<QObject> *guard = static_cast<QDeclarativeGuard<QObject> *>(guards);
*guard = (QObject *)0;
guard->objectDestroyed(object);
}
@@ -1713,9 +1713,6 @@ QScriptValue QDeclarativeEnginePrivate::rect(QScriptContext *ctxt, QScriptEngine
qsreal w = ctxt->argument(2).toNumber();
qsreal h = ctxt->argument(3).toNumber();
- if (w < 0 || h < 0)
- return engine->nullValue();
-
return QDeclarativeEnginePrivate::get(engine)->scriptValueFromVariant(QVariant::fromValue(QRectF(x, y, w, h)));
}
diff --git a/src/declarative/qml/qdeclarativeguard_p.h b/src/declarative/qml/qdeclarativeguard_p.h
index a085258..4d84951 100644
--- a/src/declarative/qml/qdeclarativeguard_p.h
+++ b/src/declarative/qml/qdeclarativeguard_p.h
@@ -55,16 +55,30 @@
#include <QtCore/qglobal.h>
#include <QtCore/qvariant.h>
+#include <private/qdeclarativedata_p.h>
QT_BEGIN_NAMESPACE
+class QDeclarativeGuardImpl
+{
+public:
+ inline QDeclarativeGuardImpl();
+ inline QDeclarativeGuardImpl(QObject *);
+ inline QDeclarativeGuardImpl(const QDeclarativeGuardImpl &);
+ inline ~QDeclarativeGuardImpl();
+
+ QObject *o;
+ QDeclarativeGuardImpl *next;
+ QDeclarativeGuardImpl **prev;
+
+ inline void addGuard();
+ inline void remGuard();
+};
+
class QObject;
template<class T>
-class QDeclarativeGuard
+class QDeclarativeGuard : private QDeclarativeGuardImpl
{
- QObject *o;
- QDeclarativeGuard<QObject> *next;
- QDeclarativeGuard<QObject> **prev;
friend class QDeclarativeData;
public:
inline QDeclarativeGuard();
@@ -74,6 +88,9 @@ public:
inline QDeclarativeGuard<T> &operator=(const QDeclarativeGuard<T> &o);
inline QDeclarativeGuard<T> &operator=(T *);
+
+ inline T *object() const;
+ inline void setObject(T *g);
inline bool isNull() const
{ return !o; }
@@ -89,69 +106,109 @@ public:
protected:
virtual void objectDestroyed(T *) {}
-
-private:
- inline void addGuard();
- inline void remGuard();
};
-QT_END_NAMESPACE
+QDeclarativeGuardImpl::QDeclarativeGuardImpl()
+: o(0), next(0), prev(0)
+{
+}
-Q_DECLARE_METATYPE(QDeclarativeGuard<QObject>)
+QDeclarativeGuardImpl::QDeclarativeGuardImpl(QObject *g)
+: o(g), next(0), prev(0)
+{
+ if (o) addGuard();
+}
-#include "private/qdeclarativedata_p.h"
+QDeclarativeGuardImpl::QDeclarativeGuardImpl(const QDeclarativeGuardImpl &g)
+: o(g.o), next(0), prev(0)
+{
+ if (o) addGuard();
+}
-QT_BEGIN_NAMESPACE
+QDeclarativeGuardImpl::~QDeclarativeGuardImpl()
+{
+ if (prev) remGuard();
+ o = 0;
+}
+
+void QDeclarativeGuardImpl::addGuard()
+{
+ Q_ASSERT(!prev);
+
+ if (QObjectPrivate::get(o)->wasDeleted)
+ return;
+
+ QDeclarativeData *data = QDeclarativeData::get(o, true);
+ next = data->guards;
+ if (next) next->prev = &next;
+ data->guards = this;
+ prev = &data->guards;
+}
+
+void QDeclarativeGuardImpl::remGuard()
+{
+ Q_ASSERT(prev);
+
+ if (next) next->prev = prev;
+ *prev = next;
+ next = 0;
+ prev = 0;
+}
template<class T>
QDeclarativeGuard<T>::QDeclarativeGuard()
-: o(0), next(0), prev(0)
{
}
template<class T>
QDeclarativeGuard<T>::QDeclarativeGuard(T *g)
-: o(g), next(0), prev(0)
+: QDeclarativeGuardImpl(g)
{
- if (o) addGuard();
}
template<class T>
QDeclarativeGuard<T>::QDeclarativeGuard(const QDeclarativeGuard<T> &g)
-: o(g.o), next(0), prev(0)
+: QDeclarativeGuardImpl(g)
{
- if (o) addGuard();
}
template<class T>
QDeclarativeGuard<T>::~QDeclarativeGuard()
{
- if (prev) remGuard();
- o = 0;
}
template<class T>
QDeclarativeGuard<T> &QDeclarativeGuard<T>::operator=(const QDeclarativeGuard<T> &g)
{
- if (g.o != o) {
- if (prev) remGuard();
- o = g.o;
- if (o) addGuard();
- }
+ setObject(g.object());
return *this;
}
template<class T>
QDeclarativeGuard<T> &QDeclarativeGuard<T>::operator=(T *g)
{
+ setObject(g);
+ return *this;
+}
+
+template<class T>
+T *QDeclarativeGuard<T>::object() const
+{
+ return static_cast<T *>(o);
+};
+
+template<class T>
+void QDeclarativeGuard<T>::setObject(T *g)
+{
if (g != o) {
if (prev) remGuard();
o = g;
if (o) addGuard();
}
- return *this;
}
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QDeclarativeGuard<QObject>)
+
#endif // QDECLARATIVEGUARD_P_H
diff --git a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
index 53f702c..f6f593c 100644
--- a/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
+++ b/src/declarative/qml/qdeclarativeobjectscriptclass.cpp
@@ -680,14 +680,30 @@ private:
inline void cleanup();
- char data[4 * sizeof(void *)];
+ union {
+ float floatValue;
+ double doubleValue;
+ quint32 intValue;
+ bool boolValue;
+ QObject *qobjectPtr;
+
+ char allocData[sizeof(QVariant)];
+ };
+
+ // Pointers to allocData
+ union {
+ QString *qstringPtr;
+ QVariant *qvariantPtr;
+ QList<QObject *> *qlistPtr;
+ QScriptValue *qscriptValuePtr;
+ };
+
int type;
- bool isObjectType;
};
}
MetaCallArgument::MetaCallArgument()
-: type(QVariant::Invalid), isObjectType(false)
+: type(QVariant::Invalid)
{
}
@@ -699,22 +715,22 @@ MetaCallArgument::~MetaCallArgument()
void MetaCallArgument::cleanup()
{
if (type == QMetaType::QString) {
- ((QString *)&data)->~QString();
- } else if (type == -1 || type == qMetaTypeId<QVariant>()) {
- ((QVariant *)&data)->~QVariant();
+ qstringPtr->~QString();
+ } else if (type == -1 || type == QMetaType::QVariant) {
+ qvariantPtr->~QVariant();
} else if (type == qMetaTypeId<QScriptValue>()) {
- ((QScriptValue *)&data)->~QScriptValue();
+ qscriptValuePtr->~QScriptValue();
} else if (type == qMetaTypeId<QList<QObject *> >()) {
- ((QList<QObject *> *)&data)->~QList<QObject *>();
+ qlistPtr->~QList<QObject *>();
}
}
void *MetaCallArgument::dataPtr()
{
if (type == -1)
- return ((QVariant *)data)->data();
- else
- return (void *)&data;
+ return qvariantPtr->data();
+ else
+ return (void *)&allocData;
}
void MetaCallArgument::initAsType(int callType, QDeclarativeEngine *e)
@@ -725,7 +741,7 @@ void MetaCallArgument::initAsType(int callType, QDeclarativeEngine *e)
QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(e);
if (callType == qMetaTypeId<QScriptValue>()) {
- new (&data) QScriptValue(engine->undefinedValue());
+ qscriptValuePtr = new (&allocData) QScriptValue(engine->undefinedValue());
type = callType;
} else if (callType == QMetaType::Int ||
callType == QMetaType::UInt ||
@@ -734,20 +750,20 @@ void MetaCallArgument::initAsType(int callType, QDeclarativeEngine *e)
callType == QMetaType::Float) {
type = callType;
} else if (callType == QMetaType::QObjectStar) {
- *((QObject **)&data) = 0;
+ qobjectPtr = 0;
type = callType;
} else if (callType == QMetaType::QString) {
- new (&data) QString();
+ qstringPtr = new (&allocData) QString();
type = callType;
} else if (callType == qMetaTypeId<QVariant>()) {
type = callType;
- new (&data) QVariant();
+ qvariantPtr = new (&allocData) QVariant();
} else if (callType == qMetaTypeId<QList<QObject *> >()) {
type = callType;
- new (&data) QList<QObject *>();
+ qlistPtr = new (&allocData) QList<QObject *>();
} else {
type = -1;
- new (&data) QVariant(callType, (void *)0);
+ qvariantPtr = new (&allocData) QVariant(callType, (void *)0);
}
}
@@ -756,59 +772,60 @@ void MetaCallArgument::fromScriptValue(int callType, QDeclarativeEngine *engine,
if (type != 0) { cleanup(); type = 0; }
if (callType == qMetaTypeId<QScriptValue>()) {
- new (&data) QScriptValue(value);
+ qscriptValuePtr = new (&allocData) QScriptValue(value);
type = qMetaTypeId<QScriptValue>();
} else if (callType == QMetaType::Int) {
- *((int *)&data) = int(value.toInt32());
+ intValue = quint32(value.toInt32());
type = callType;
} else if (callType == QMetaType::UInt) {
- *((uint *)&data) = uint(value.toUInt32());
+ intValue = quint32(value.toUInt32());
type = callType;
} else if (callType == QMetaType::Bool) {
- *((bool *)&data) = value.toBool();
+ boolValue = value.toBool();
type = callType;
} else if (callType == QMetaType::Double) {
- *((double *)&data) = double(value.toNumber());
+ doubleValue = double(value.toNumber());
type = callType;
} else if (callType == QMetaType::Float) {
- *((float *)&data) = float(value.toNumber());
+ floatValue = float(value.toNumber());
type = callType;
} else if (callType == QMetaType::QString) {
if (value.isNull() || value.isUndefined())
- new (&data) QString();
+ qstringPtr = new (&allocData) QString();
else
- new (&data) QString(value.toString());
+ qstringPtr = new (&allocData) QString(value.toString());
type = callType;
} else if (callType == QMetaType::QObjectStar) {
- *((QObject **)&data) = value.toQObject();
+ qobjectPtr = value.toQObject();
type = callType;
} else if (callType == qMetaTypeId<QVariant>()) {
- new (&data) QVariant(QDeclarativeEnginePrivate::get(engine)->scriptValueToVariant(value));
+ QVariant other = QDeclarativeEnginePrivate::get(engine)->scriptValueToVariant(value);
+ qvariantPtr = new (&allocData) QVariant(other);
type = callType;
} else if (callType == qMetaTypeId<QList<QObject*> >()) {
- QList<QObject *> *list = new (&data) QList<QObject *>();
+ qlistPtr = new (&allocData) QList<QObject *>();
if (value.isArray()) {
int length = value.property(QLatin1String("length")).toInt32();
for (int ii = 0; ii < length; ++ii) {
QScriptValue arrayItem = value.property(ii);
QObject *d = arrayItem.toQObject();
- list->append(d);
+ qlistPtr->append(d);
}
} else if (QObject *d = value.toQObject()) {
- list->append(d);
+ qlistPtr->append(d);
}
type = callType;
} else {
- new (&data) QVariant();
+ qvariantPtr = new (&allocData) QVariant();
type = -1;
QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(engine);
QVariant v = priv->scriptValueToVariant(value);
if (v.userType() == callType) {
- *((QVariant *)&data) = v;
+ *qvariantPtr = v;
} else if (v.canConvert((QVariant::Type)callType)) {
- *((QVariant *)&data) = v;
- ((QVariant *)&data)->convert((QVariant::Type)callType);
+ *qvariantPtr = v;
+ qvariantPtr->convert((QVariant::Type)callType);
} else if (const QMetaObject *mo = priv->rawMetaObjectForType(callType)) {
QObject *obj = priv->toQObject(v);
@@ -818,9 +835,9 @@ void MetaCallArgument::fromScriptValue(int callType, QDeclarativeEngine *engine,
if (!objMo) obj = 0;
}
- *((QVariant *)&data) = QVariant(callType, &obj);
+ *qvariantPtr = QVariant(callType, &obj);
} else {
- *((QVariant *)&data) = QVariant(callType, (void *)0);
+ *qvariantPtr = QVariant(callType, (void *)0);
}
}
}
@@ -830,27 +847,26 @@ QScriptDeclarativeClass::Value MetaCallArgument::toValue(QDeclarativeEngine *e)
QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(e);
if (type == qMetaTypeId<QScriptValue>()) {
- return QScriptDeclarativeClass::Value(engine, *((QScriptValue *)&data));
+ return QScriptDeclarativeClass::Value(engine, *qscriptValuePtr);
} else if (type == QMetaType::Int) {
- return QScriptDeclarativeClass::Value(engine, *((int *)&data));
+ return QScriptDeclarativeClass::Value(engine, int(intValue));
} else if (type == QMetaType::UInt) {
- return QScriptDeclarativeClass::Value(engine, *((uint *)&data));
+ return QScriptDeclarativeClass::Value(engine, uint(intValue));
} else if (type == QMetaType::Bool) {
- return QScriptDeclarativeClass::Value(engine, *((bool *)&data));
+ return QScriptDeclarativeClass::Value(engine, boolValue);
} else if (type == QMetaType::Double) {
- return QScriptDeclarativeClass::Value(engine, *((double *)&data));
+ return QScriptDeclarativeClass::Value(engine, doubleValue);
} else if (type == QMetaType::Float) {
- return QScriptDeclarativeClass::Value(engine, *((float *)&data));
+ return QScriptDeclarativeClass::Value(engine, floatValue);
} else if (type == QMetaType::QString) {
- return QScriptDeclarativeClass::Value(engine, *((QString *)&data));
+ return QScriptDeclarativeClass::Value(engine, *qstringPtr);
} else if (type == QMetaType::QObjectStar) {
- QObject *object = *((QObject **)&data);
- if (object)
- QDeclarativeData::get(object, true)->setImplicitDestructible();
+ if (qobjectPtr)
+ QDeclarativeData::get(qobjectPtr, true)->setImplicitDestructible();
QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(e);
- return QScriptDeclarativeClass::Value(engine, priv->objectClass->newQObject(object));
+ return QScriptDeclarativeClass::Value(engine, priv->objectClass->newQObject(qobjectPtr));
} else if (type == qMetaTypeId<QList<QObject *> >()) {
- QList<QObject *> &list = *(QList<QObject *>*)&data;
+ QList<QObject *> &list = *qlistPtr;
QScriptValue rv = engine->newArray(list.count());
QDeclarativeEnginePrivate *priv = QDeclarativeEnginePrivate::get(e);
for (int ii = 0; ii < list.count(); ++ii) {
@@ -861,7 +877,7 @@ QScriptDeclarativeClass::Value MetaCallArgument::toValue(QDeclarativeEngine *e)
return QScriptDeclarativeClass::Value(engine, rv);
} else if (type == -1 || type == qMetaTypeId<QVariant>()) {
QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(e);
- QScriptValue rv = ep->scriptValueFromVariant(*((QVariant *)&data));
+ QScriptValue rv = ep->scriptValueFromVariant(*qvariantPtr);
if (rv.isQObject()) {
QObject *object = rv.toQObject();
if (object)
diff --git a/src/declarative/qml/qdeclarativetypeloader.cpp b/src/declarative/qml/qdeclarativetypeloader.cpp
index 77587a4..168c151 100644
--- a/src/declarative/qml/qdeclarativetypeloader.cpp
+++ b/src/declarative/qml/qdeclarativetypeloader.cpp
@@ -434,7 +434,7 @@ void QDeclarativeDataBlob::notifyComplete(QDeclarativeDataBlob *blob)
/*!
\class QDeclarativeDataLoader
-\brief The QDeclarativeDataLoader class abstracts loading files and their dependecies over the network.
+\brief The QDeclarativeDataLoader class abstracts loading files and their dependencies over the network.
\internal
The QDeclarativeDataLoader class is provided for the exclusive use of the QDeclarativeTypeLoader class.
@@ -453,9 +453,11 @@ are required before processing can fully complete.
To complete processing, the QDeclarativeDataBlob::done() callback is invoked. done() is called when
one of these three preconditions are met.
-1. The QDeclarativeDataBlob has no dependencies.
-2. The QDeclarativeDataBlob has an error set.
-3. All the QDeclarativeDataBlob's dependencies are themselves "done()".
+\list 1
+\o The QDeclarativeDataBlob has no dependencies.
+\o The QDeclarativeDataBlob has an error set.
+\o All the QDeclarativeDataBlob's dependencies are themselves "done()".
+\endlist
Thus QDeclarativeDataBlob::done() will always eventually be called, even if the blob has an error set.
*/
@@ -616,13 +618,17 @@ void QDeclarativeDataLoader::setData(QDeclarativeDataBlob *blob, const QByteArra
}
/*!
-\class QDeclarativeTypeLoader
+Constructs a new type loader that uses the given \a engine.
*/
QDeclarativeTypeLoader::QDeclarativeTypeLoader(QDeclarativeEngine *engine)
: QDeclarativeDataLoader(engine)
{
}
+/*!
+Destroys the type loader, first clearing the cache of any information about
+loaded files.
+*/
QDeclarativeTypeLoader::~QDeclarativeTypeLoader()
{
clearCache();
@@ -674,7 +680,7 @@ QDeclarativeTypeData *QDeclarativeTypeLoader::get(const QByteArray &data, const
}
/*!
-Return a QDeclarativeScriptData for \a url. The QDeclarativeScriptData may be cached.
+Returns a QDeclarativeScriptData for \a url. The QDeclarativeScriptData may be cached.
*/
QDeclarativeScriptData *QDeclarativeTypeLoader::getScript(const QUrl &url)
{
@@ -695,7 +701,7 @@ QDeclarativeScriptData *QDeclarativeTypeLoader::getScript(const QUrl &url)
}
/*!
-Return a QDeclarativeQmldirData for \a url. The QDeclarativeQmldirData may be cached.
+Returns a QDeclarativeQmldirData for \a url. The QDeclarativeQmldirData may be cached.
*/
QDeclarativeQmldirData *QDeclarativeTypeLoader::getQmldir(const QUrl &url)
{
@@ -715,6 +721,10 @@ QDeclarativeQmldirData *QDeclarativeTypeLoader::getQmldir(const QUrl &url)
return qmldirData;
}
+/*!
+Clears cached information about loaded files, including any type data, scripts
+and qmldir information.
+*/
void QDeclarativeTypeLoader::clearCache()
{
for (TypeCache::Iterator iter = m_typeCache.begin(); iter != m_typeCache.end(); ++iter)
diff --git a/src/declarative/qml/qdeclarativevme.cpp b/src/declarative/qml/qdeclarativevme.cpp
index 06aed98..a23f89d 100644
--- a/src/declarative/qml/qdeclarativevme.cpp
+++ b/src/declarative/qml/qdeclarativevme.cpp
@@ -74,6 +74,27 @@
QT_BEGIN_NAMESPACE
+// A simple stack wrapper around QVarLengthArray
+template<typename T>
+class QDeclarativeVMEStack : private QVarLengthArray<T, 128>
+{
+private:
+ typedef QVarLengthArray<T, 128> VLA;
+ int _index;
+
+public:
+ inline QDeclarativeVMEStack();
+ inline bool isEmpty() const;
+ inline const T &top() const;
+ inline void push(const T &o);
+ inline T pop();
+ inline int count() const;
+ inline const T &at(int index) const;
+};
+
+// We do this so we can forward declare the type in the qdeclarativevme_p.h header
+class QDeclarativeVMEObjectStack : public QDeclarativeVMEStack<QObject *> {};
+
QDeclarativeVME::QDeclarativeVME()
{
}
@@ -99,10 +120,12 @@ struct ListInstance
QDeclarativeListProperty<void> qListProperty;
};
+Q_DECLARE_TYPEINFO(ListInstance, Q_PRIMITIVE_TYPE | Q_MOVABLE_TYPE);
+
QObject *QDeclarativeVME::run(QDeclarativeContextData *ctxt, QDeclarativeCompiledData *comp,
int start, int count, const QBitField &bindingSkipList)
{
- QDeclarativeVMEStack<QObject *> stack;
+ QDeclarativeVMEObjectStack stack;
if (start == -1) start = 0;
if (count == -1) count = comp->bytecode.count();
@@ -121,7 +144,7 @@ void QDeclarativeVME::runDeferred(QObject *object)
QDeclarativeCompiledData *comp = data->deferredComponent;
int start = data->deferredIdx + 1;
int count = data->deferredComponent->bytecode.at(data->deferredIdx).defer.deferCount;
- QDeclarativeVMEStack<QObject *> stack;
+ QDeclarativeVMEObjectStack stack;
stack.push(object);
run(stack, ctxt, comp, start, count, QBitField());
@@ -143,7 +166,7 @@ static void removeBindingOnProperty(QObject *o, int index)
#define CLEAN_PROPERTY(o, index) if (fastHasBinding(o, index)) removeBindingOnProperty(o, index)
-QObject *QDeclarativeVME::run(QDeclarativeVMEStack<QObject *> &stack,
+QObject *QDeclarativeVME::run(QDeclarativeVMEObjectStack &stack,
QDeclarativeContextData *ctxt,
QDeclarativeCompiledData *comp,
int start, int count,
@@ -1054,5 +1077,48 @@ QDeclarativeCompiledData::TypeReference::createInstance(QDeclarativeContextData
}
}
+template<typename T>
+QDeclarativeVMEStack<T>::QDeclarativeVMEStack()
+: _index(-1)
+{
+}
+
+template<typename T>
+bool QDeclarativeVMEStack<T>::isEmpty() const {
+ return _index == -1;
+}
+
+template<typename T>
+const T &QDeclarativeVMEStack<T>::top() const {
+ return at(_index);
+}
+
+template<typename T>
+void QDeclarativeVMEStack<T>::push(const T &o) {
+ _index++;
+
+ Q_ASSERT(_index <= VLA::size());
+ if (_index == VLA::size())
+ VLA::append(o);
+ else
+ VLA::data()[_index] = o;
+}
+
+template<typename T>
+T QDeclarativeVMEStack<T>::pop() {
+ Q_ASSERT(_index >= 0);
+ --_index;
+ return VLA::data()[_index + 1];
+}
+
+template<typename T>
+int QDeclarativeVMEStack<T>::count() const {
+ return _index + 1;
+}
+
+template<typename T>
+const T &QDeclarativeVMEStack<T>::at(int index) const {
+ return VLA::data()[index];
+}
QT_END_NAMESPACE
diff --git a/src/declarative/qml/qdeclarativevme_p.h b/src/declarative/qml/qdeclarativevme_p.h
index 6b7b93f..b7f110f 100644
--- a/src/declarative/qml/qdeclarativevme_p.h
+++ b/src/declarative/qml/qdeclarativevme_p.h
@@ -58,6 +58,7 @@
#include <QtCore/QString>
#include <QtCore/QStack>
+#include <QtCore/QVarLengthArray>
QT_BEGIN_NAMESPACE
@@ -67,34 +68,7 @@ class QDeclarativeCompiledData;
class QDeclarativeCompiledData;
class QDeclarativeContextData;
-template<typename T, int N = 128>
-class QDeclarativeVMEStack {
-public:
- QDeclarativeVMEStack() : index(-1), maxSize(N), data((T *)fixedData) {}
- ~QDeclarativeVMEStack() { if (data != (T *)fixedData) qFree(data); }
-
- bool isEmpty() const { return index == -1; }
- const T &top() const { return data[index]; }
- void push(const T &i) { ++index; if (index == maxSize) realloc(); data[index] = i; }
- const T &pop() { --index; return data[index + 1]; }
- int count() const { return index + 1; }
- const T &at(int idx) { return data[idx]; }
-
-private:
- void realloc() {
- maxSize += N;
- if (data != (T *)fixedData) {
- data = (T*)qRealloc(data, maxSize * sizeof(T));
- } else {
- data = (T*)qMalloc(maxSize * sizeof(T));
- }
- }
- int index;
- int maxSize;
- T *data;
- char fixedData[N * sizeof(T)];
-};
-
+class QDeclarativeVMEObjectStack;
class QDeclarativeVME
{
public:
@@ -109,7 +83,7 @@ public:
QList<QDeclarativeError> errors() const;
private:
- QObject *run(QDeclarativeVMEStack<QObject *> &,
+ QObject *run(QDeclarativeVMEObjectStack &,
QDeclarativeContextData *, QDeclarativeCompiledData *,
int start, int count,
const QBitField &);
diff --git a/src/declarative/qml/qperformancetimer.cpp b/src/declarative/qml/qperformancetimer.cpp
index 9fc0d35..659a339 100644
--- a/src/declarative/qml/qperformancetimer.cpp
+++ b/src/declarative/qml/qperformancetimer.cpp
@@ -45,14 +45,15 @@
#include <sys/time.h>
#include <unistd.h>
#include <mach/mach_time.h>
-#elif defined(Q_OS_UNIX)
-#include <sys/time.h>
-#include <time.h>
-#include <unistd.h>
#elif defined(Q_OS_SYMBIAN)
#include <e32std.h>
#include <sys/time.h>
#include <hal.h>
+#include <hal_data.h>
+#elif defined(Q_OS_UNIX)
+#include <sys/time.h>
+#include <time.h>
+#include <unistd.h>
#elif defined(Q_OS_WIN)
#include <windows.h>
#endif
@@ -84,6 +85,29 @@ qint64 QPerformanceTimer::elapsed() const
return absoluteToNSecs(cpu_time - t1);
}
+////////////////////////////// Symbian //////////////////////////////
+#elif defined(Q_OS_SYMBIAN)
+
+static qint64 getTimeFromTick(quint64 elapsed)
+{
+ static TInt freq = 0;
+ if (!freq)
+ HAL::Get(HALData::EFastCounterFrequency, freq);
+
+ return (elapsed * 1000000000) / freq;
+}
+
+void QPerformanceTimer::start()
+{
+ t1 = User::FastCounter();
+}
+
+qint64 QPerformanceTimer::elapsed() const
+{
+ return getTimeFromTick(User::FastCounter() - t1);
+}
+
+
////////////////////////////// Unix //////////////////////////////
#elif defined(Q_OS_UNIX)
@@ -158,29 +182,6 @@ qint64 QPerformanceTimer::elapsed() const
return sec * Q_INT64_C(1000000000) + frac;
}
-////////////////////////////// Symbian //////////////////////////////
-#elif defined(Q_OS_SYMBIAN)
-
-static qint64 getTimeFromTick(quint64 elapsed)
-{
- static TInt freq;
- if (!freq)
- HAL::Get(HALData::EFastCounterFrequency, freq);
-
- // ### not sure on units
- return elapsed / freq;
-}
-
-void QPerformanceTimer::start()
-{
- t1 = User::FastCounter();
-}
-
-qint64 QPerformanceTimer::elapsed() const
-{
- return getTimeFromTick(User::FastCounter() - t1);
-}
-
////////////////////////////// Windows //////////////////////////////
#elif defined(Q_OS_WIN)
diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp
index 07d3977..3557425 100644
--- a/src/declarative/util/qdeclarativepixmapcache.cpp
+++ b/src/declarative/util/qdeclarativepixmapcache.cpp
@@ -584,6 +584,7 @@ public:
void unreferencePixmap(QDeclarativePixmapData *);
void referencePixmap(QDeclarativePixmapData *);
+ void flushCache();
protected:
virtual void timerEvent(QTimerEvent *);
@@ -682,6 +683,14 @@ void QDeclarativePixmapStore::timerEvent(QTimerEvent *)
}
}
+/*
+ Remove all unreferenced pixmaps from the cache.
+*/
+void QDeclarativePixmapStore::flushCache()
+{
+ shrinkCache(m_unreferencedCost);
+}
+
QDeclarativePixmapReply::QDeclarativePixmapReply(QDeclarativePixmapData *d)
: data(d), reader(0), requestSize(d->requestSize), loading(false), redirectCount(0)
{
@@ -1075,6 +1084,11 @@ bool QDeclarativePixmap::connectDownloadProgress(QObject *object, int method)
return QMetaObject::connect(d->reply, QDeclarativePixmapReply::downloadProgressIndex, object, method);
}
+void QDeclarativePixmap::flushCache()
+{
+ pixmapStore()->flushCache();
+}
+
QT_END_NAMESPACE
#include <qdeclarativepixmapcache.moc>
diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h
index 396c196..4976906 100644
--- a/src/declarative/util/qdeclarativepixmapcache_p.h
+++ b/src/declarative/util/qdeclarativepixmapcache_p.h
@@ -103,6 +103,8 @@ public:
bool connectDownloadProgress(QObject *, const char *);
bool connectDownloadProgress(QObject *, int);
+ static void flushCache();
+
private:
Q_DISABLE_COPY(QDeclarativePixmap)
QDeclarativePixmapData *d;
diff --git a/src/declarative/util/qdeclarativestate_p_p.h b/src/declarative/util/qdeclarativestate_p_p.h
index ec18f59..195b935 100644
--- a/src/declarative/util/qdeclarativestate_p_p.h
+++ b/src/declarative/util/qdeclarativestate_p_p.h
@@ -206,7 +206,9 @@ public:
struct OperationGuard : public QDeclarativeGuard<QDeclarativeStateOperation>
{
- OperationGuard(QObject *obj, QList<OperationGuard> *l) : list(l) { (QDeclarativeGuard<QObject>&)*this = obj; }
+ OperationGuard(QObject *obj, QList<OperationGuard> *l) : list(l) {
+ setObject(static_cast<QDeclarativeStateOperation *>(obj));
+ }
QList<OperationGuard> *list;
void objectDestroyed(QDeclarativeStateOperation *) {
// we assume priv will always be destroyed after objectDestroyed calls
diff --git a/src/declarative/util/qdeclarativestateoperations_p.h b/src/declarative/util/qdeclarativestateoperations_p.h
index 6a6dda6..a05edb8 100644
--- a/src/declarative/util/qdeclarativestateoperations_p.h
+++ b/src/declarative/util/qdeclarativestateoperations_p.h
@@ -55,7 +55,7 @@ QT_BEGIN_NAMESPACE
QT_MODULE(Declarative)
class QDeclarativeParentChangePrivate;
-class Q_AUTOTEST_EXPORT QDeclarativeParentChange : public QDeclarativeStateOperation, public QDeclarativeActionEvent
+class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeParentChange : public QDeclarativeStateOperation, public QDeclarativeActionEvent
{
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativeParentChange)
@@ -251,7 +251,7 @@ private:
};
class QDeclarativeAnchorChangesPrivate;
-class Q_AUTOTEST_EXPORT QDeclarativeAnchorChanges : public QDeclarativeStateOperation, public QDeclarativeActionEvent
+class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeAnchorChanges : public QDeclarativeStateOperation, public QDeclarativeActionEvent
{
Q_OBJECT
Q_DECLARE_PRIVATE(QDeclarativeAnchorChanges)
diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp
index 6f9245b..77fc7de 100644
--- a/src/declarative/util/qdeclarativexmllistmodel.cpp
+++ b/src/declarative/util/qdeclarativexmllistmodel.cpp
@@ -147,114 +147,217 @@ struct XmlQueryJob
QString prefix;
};
-class QDeclarativeXmlQuery : public QObject
+
+class QDeclarativeXmlQueryEngine;
+class QDeclarativeXmlQueryThreadObject : public QObject
{
Q_OBJECT
public:
- QDeclarativeXmlQuery(QObject *parent=0)
- : QObject(parent), m_queryIds(XMLLISTMODEL_CLEAR_ID + 1) {
- qRegisterMetaType<QDeclarativeXmlQueryResult>("QDeclarativeXmlQueryResult");
- moveToThread(&m_thread);
- m_thread.start(QThread::IdlePriority);
- }
-
- ~QDeclarativeXmlQuery() {
- if(m_thread.isRunning()) {
- m_thread.quit();
- m_thread.wait();
- }
- }
-
- void abort(int id) {
- QMutexLocker ml(&m_mutex);
- if (id != -1) {
- m_jobs.remove(id);
- }
- }
+ QDeclarativeXmlQueryThreadObject(QDeclarativeXmlQueryEngine *);
- int doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache) {
- {
- QMutexLocker m1(&m_mutex);
- m_queryIds.ref();
- if (m_queryIds <= 0)
- m_queryIds = 1;
- }
-
- XmlQueryJob job;
- job.queryId = m_queryIds;
- job.data = data;
- job.query = QLatin1String("doc($src)") + query;
- job.namespaces = namespaces;
- job.keyRoleResultsCache = keyRoleResultsCache;
-
- for (int i=0; i<roleObjects->count(); i++) {
- if (!roleObjects->at(i)->isValid()) {
- job.roleQueries << QString();
- continue;
- }
- job.roleQueries << roleObjects->at(i)->query();
- job.roleQueryErrorId << static_cast<void*>(roleObjects->at(i));
- if (roleObjects->at(i)->isKey())
- job.keyRoleQueries << job.roleQueries.last();
- }
+ void processJobs();
+ virtual bool event(QEvent *e);
- {
- QMutexLocker ml(&m_mutex);
- m_jobs.insert(m_queryIds, job);
- }
+private:
+ QDeclarativeXmlQueryEngine *m_queryEngine;
+};
- QMetaObject::invokeMethod(this, "processQuery", Qt::QueuedConnection, Q_ARG(int, job.queryId));
- return job.queryId;
- }
-private slots:
- void processQuery(int queryId) {
- XmlQueryJob job;
+class QDeclarativeXmlQueryEngine : public QThread
+{
+ Q_OBJECT
+public:
+ QDeclarativeXmlQueryEngine(QDeclarativeEngine *eng);
+ ~QDeclarativeXmlQueryEngine();
- {
- QMutexLocker ml(&m_mutex);
- if (!m_jobs.contains(queryId))
- return;
- job = m_jobs.value(queryId);
- }
+ int doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache);
+ void abort(int id);
- QDeclarativeXmlQueryResult result;
- result.queryId = job.queryId;
- doQueryJob(&job, &result);
- doSubQueryJob(&job, &result);
+ void processJobs();
- {
- QMutexLocker ml(&m_mutex);
- if (m_jobs.contains(queryId)) {
- emit queryCompleted(result);
- m_jobs.remove(queryId);
- }
- }
- }
+ static QDeclarativeXmlQueryEngine *instance(QDeclarativeEngine *engine);
-Q_SIGNALS:
+signals:
void queryCompleted(const QDeclarativeXmlQueryResult &);
void error(void*, const QString&);
protected:
-
+ void run();
private:
+ void processQuery(XmlQueryJob *job);
void doQueryJob(XmlQueryJob *job, QDeclarativeXmlQueryResult *currentResult);
void doSubQueryJob(XmlQueryJob *job, QDeclarativeXmlQueryResult *currentResult);
void getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const;
void addIndexToRangeList(QList<QDeclarativeXmlListRange> *ranges, int index) const;
-private:
QMutex m_mutex;
- QThread m_thread;
- QMap<int, XmlQueryJob> m_jobs;
+ QDeclarativeXmlQueryThreadObject *m_threadObject;
+ QList<XmlQueryJob> m_jobs;
+ QSet<int> m_cancelledJobs;
QAtomicInt m_queryIds;
+
+ QDeclarativeEngine *m_engine;
+ QObject *m_eventLoopQuitHack;
+
+ static QHash<QDeclarativeEngine *,QDeclarativeXmlQueryEngine*> queryEngines;
+ static QMutex queryEnginesMutex;
};
+QHash<QDeclarativeEngine *,QDeclarativeXmlQueryEngine*> QDeclarativeXmlQueryEngine::queryEngines;
+QMutex QDeclarativeXmlQueryEngine::queryEnginesMutex;
+
+
+QDeclarativeXmlQueryThreadObject::QDeclarativeXmlQueryThreadObject(QDeclarativeXmlQueryEngine *e)
+ : m_queryEngine(e)
+{
+}
-Q_GLOBAL_STATIC(QDeclarativeXmlQuery, globalXmlQuery)
+void QDeclarativeXmlQueryThreadObject::processJobs()
+{
+ QCoreApplication::postEvent(this, new QEvent(QEvent::User));
+}
-void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
+bool QDeclarativeXmlQueryThreadObject::event(QEvent *e)
+{
+ if (e->type() == QEvent::User) {
+ m_queryEngine->processJobs();
+ return true;
+ } else {
+ return QObject::event(e);
+ }
+}
+
+
+
+QDeclarativeXmlQueryEngine::QDeclarativeXmlQueryEngine(QDeclarativeEngine *eng)
+: QThread(eng), m_threadObject(0), m_queryIds(XMLLISTMODEL_CLEAR_ID + 1), m_engine(eng), m_eventLoopQuitHack(0)
+{
+ qRegisterMetaType<QDeclarativeXmlQueryResult>("QDeclarativeXmlQueryResult");
+
+ m_eventLoopQuitHack = new QObject;
+ m_eventLoopQuitHack->moveToThread(this);
+ connect(m_eventLoopQuitHack, SIGNAL(destroyed(QObject*)), SLOT(quit()), Qt::DirectConnection);
+ start(QThread::IdlePriority);
+}
+
+QDeclarativeXmlQueryEngine::~QDeclarativeXmlQueryEngine()
+{
+ queryEnginesMutex.lock();
+ queryEngines.remove(m_engine);
+ queryEnginesMutex.unlock();
+
+ m_eventLoopQuitHack->deleteLater();
+ wait();
+}
+
+int QDeclarativeXmlQueryEngine::doQuery(QString query, QString namespaces, QByteArray data, QList<QDeclarativeXmlListModelRole *>* roleObjects, QStringList keyRoleResultsCache) {
+ {
+ QMutexLocker m1(&m_mutex);
+ m_queryIds.ref();
+ if (m_queryIds <= 0)
+ m_queryIds = 1;
+ }
+
+ XmlQueryJob job;
+ job.queryId = m_queryIds;
+ job.data = data;
+ job.query = QLatin1String("doc($src)") + query;
+ job.namespaces = namespaces;
+ job.keyRoleResultsCache = keyRoleResultsCache;
+
+ for (int i=0; i<roleObjects->count(); i++) {
+ if (!roleObjects->at(i)->isValid()) {
+ job.roleQueries << QString();
+ continue;
+ }
+ job.roleQueries << roleObjects->at(i)->query();
+ job.roleQueryErrorId << static_cast<void*>(roleObjects->at(i));
+ if (roleObjects->at(i)->isKey())
+ job.keyRoleQueries << job.roleQueries.last();
+ }
+
+ {
+ QMutexLocker ml(&m_mutex);
+ m_jobs.append(job);
+ if (m_threadObject)
+ m_threadObject->processJobs();
+ }
+
+ return job.queryId;
+}
+
+void QDeclarativeXmlQueryEngine::abort(int id)
+{
+ QMutexLocker ml(&m_mutex);
+ if (id != -1)
+ m_cancelledJobs.insert(id);
+}
+
+void QDeclarativeXmlQueryEngine::run()
+{
+ m_mutex.lock();
+ m_threadObject = new QDeclarativeXmlQueryThreadObject(this);
+ m_mutex.unlock();
+
+ processJobs();
+ exec();
+
+ delete m_threadObject;
+ m_threadObject = 0;
+}
+
+void QDeclarativeXmlQueryEngine::processJobs()
+{
+ QMutexLocker locker(&m_mutex);
+
+ while (true) {
+ if (m_jobs.isEmpty())
+ return;
+
+ XmlQueryJob currentJob = m_jobs.takeLast();
+ while (m_cancelledJobs.remove(currentJob.queryId)) {
+ if (m_jobs.isEmpty())
+ return;
+ currentJob = m_jobs.takeLast();
+ }
+
+ locker.unlock();
+ processQuery(&currentJob);
+ locker.relock();
+ }
+}
+
+QDeclarativeXmlQueryEngine *QDeclarativeXmlQueryEngine::instance(QDeclarativeEngine *engine)
+{
+ queryEnginesMutex.lock();
+ QDeclarativeXmlQueryEngine *queryEng = queryEngines.value(engine);
+ if (!queryEng) {
+ queryEng = new QDeclarativeXmlQueryEngine(engine);
+ queryEngines.insert(engine, queryEng);
+ }
+ queryEnginesMutex.unlock();
+
+ return queryEng;
+}
+
+void QDeclarativeXmlQueryEngine::processQuery(XmlQueryJob *job)
+{
+ QDeclarativeXmlQueryResult result;
+ result.queryId = job->queryId;
+ doQueryJob(job, &result);
+ doSubQueryJob(job, &result);
+
+ {
+ QMutexLocker ml(&m_mutex);
+ if (m_cancelledJobs.contains(job->queryId)) {
+ m_cancelledJobs.remove(job->queryId);
+ } else {
+ emit queryCompleted(result);
+ }
+ }
+}
+
+void QDeclarativeXmlQueryEngine::doQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
{
Q_ASSERT(currentJob->queryId != -1);
@@ -293,7 +396,7 @@ void QDeclarativeXmlQuery::doQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQu
currentResult->size = (count > 0 ? count : 0);
}
-void QDeclarativeXmlQuery::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const
+void QDeclarativeXmlQueryEngine::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QStringList *values, QXmlQuery *query) const
{
const QStringList &keysQueries = currentJob.keyRoleQueries;
QString keysQuery;
@@ -314,7 +417,7 @@ void QDeclarativeXmlQuery::getValuesOfKeyRoles(const XmlQueryJob& currentJob, QS
}
}
-void QDeclarativeXmlQuery::addIndexToRangeList(QList<QDeclarativeXmlListRange> *ranges, int index) const {
+void QDeclarativeXmlQueryEngine::addIndexToRangeList(QList<QDeclarativeXmlListRange> *ranges, int index) const {
if (ranges->isEmpty())
ranges->append(qMakePair(index, 1));
else if (ranges->last().first + ranges->last().second == index)
@@ -323,7 +426,7 @@ void QDeclarativeXmlQuery::addIndexToRangeList(QList<QDeclarativeXmlListRange> *
ranges->append(qMakePair(index, 1));
}
-void QDeclarativeXmlQuery::doSubQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
+void QDeclarativeXmlQueryEngine::doSubQueryJob(XmlQueryJob *currentJob, QDeclarativeXmlQueryResult *currentResult)
{
Q_ASSERT(currentJob->queryId != -1);
@@ -583,10 +686,6 @@ void QDeclarativeXmlListModelPrivate::clear_role(QDeclarativeListProperty<QDecla
QDeclarativeXmlListModel::QDeclarativeXmlListModel(QObject *parent)
: QListModelInterface(*(new QDeclarativeXmlListModelPrivate), parent)
{
- connect(globalXmlQuery(), SIGNAL(queryCompleted(QDeclarativeXmlQueryResult)),
- this, SLOT(queryCompleted(QDeclarativeXmlQueryResult)));
- connect(globalXmlQuery(), SIGNAL(error(void*,QString)),
- this, SLOT(queryError(void*,QString)));
}
QDeclarativeXmlListModel::~QDeclarativeXmlListModel()
@@ -852,6 +951,12 @@ void QDeclarativeXmlListModel::classBegin()
{
Q_D(QDeclarativeXmlListModel);
d->isComponentComplete = false;
+
+ QDeclarativeXmlQueryEngine *queryEngine = QDeclarativeXmlQueryEngine::instance(qmlEngine(this));
+ connect(queryEngine, SIGNAL(queryCompleted(QDeclarativeXmlQueryResult)),
+ SLOT(queryCompleted(QDeclarativeXmlQueryResult)));
+ connect(queryEngine, SIGNAL(error(void*,QString)),
+ SLOT(queryError(void*,QString)));
}
void QDeclarativeXmlListModel::componentComplete()
@@ -881,7 +986,7 @@ void QDeclarativeXmlListModel::reload()
if (!d->isComponentComplete)
return;
- globalXmlQuery()->abort(d->queryId);
+ QDeclarativeXmlQueryEngine::instance(qmlEngine(this))->abort(d->queryId);
d->queryId = -1;
if (d->size < 0)
@@ -897,7 +1002,7 @@ void QDeclarativeXmlListModel::reload()
}
if (!d->xml.isEmpty()) {
- d->queryId = globalXmlQuery()->doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects, d->keyRoleResultsCache);
+ d->queryId = QDeclarativeXmlQueryEngine::instance(qmlEngine(this))->doQuery(d->query, d->namespaces, d->xml.toUtf8(), &d->roleObjects, d->keyRoleResultsCache);
d->notifyQueryStarted(false);
} else if (d->src.isEmpty()) {
@@ -958,7 +1063,7 @@ void QDeclarativeXmlListModel::requestFinished()
d->queryId = XMLLISTMODEL_CLEAR_ID;
QTimer::singleShot(0, this, SLOT(dataCleared()));
} else {
- d->queryId = globalXmlQuery()->doQuery(d->query, d->namespaces, data, &d->roleObjects, d->keyRoleResultsCache);
+ d->queryId = QDeclarativeXmlQueryEngine::instance(qmlEngine(this))->doQuery(d->query, d->namespaces, data, &d->roleObjects, d->keyRoleResultsCache);
}
disconnect(d->reply, 0, this, 0);
d->reply->deleteLater();