summaryrefslogtreecommitdiffstats
path: root/src/declarative/graphicsitems
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/graphicsitems')
-rw-r--r--src/declarative/graphicsitems/qdeclarativeanchors_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeborderimage.cpp22
-rw-r--r--src/declarative/graphicsitems/qdeclarativeflickable.cpp2
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview.cpp24
-rw-r--r--src/declarative/graphicsitems/qdeclarativegridview_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativeitem.cpp43
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview.cpp20
-rw-r--r--src/declarative/graphicsitems/qdeclarativelistview_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativemousearea.cpp16
-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.cpp59
-rw-r--r--src/declarative/graphicsitems/qdeclarativepositioners_p.h6
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext.cpp9
-rw-r--r--src/declarative/graphicsitems/qdeclarativetext_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit.cpp8
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextedit_p.h2
-rw-r--r--src/declarative/graphicsitems/qdeclarativetextinput.cpp65
-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
21 files changed, 123 insertions, 205 deletions
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/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
index 836ad49..9c274e9 100644
--- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp
@@ -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..d5c58df 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);
diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp
index 2642800..23433d6 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);
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/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp
index 91b430d..805ca4d 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();
diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp
index e0bee7e..f29f778 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);
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..18f008a 100644
--- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp
+++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp
@@ -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..f3d1a68 100644
--- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp
+++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp
@@ -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);
@@ -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);
@@ -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/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp
index 96bd792..54ff406 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();
}
}
}
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..20b2e76 100644
--- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp
+++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp
@@ -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();
}
}
}
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..d2897eb 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();
}
}
}
@@ -683,7 +677,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 +941,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 +952,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 +987,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)
@@ -1118,8 +1095,6 @@ void QDeclarativeTextInput::inputMethodEvent(QInputMethodEvent *ev)
ev->ignore();
} else {
d->control->processInputMethodEvent(ev);
- updateSize();
- d->updateHorizontalScroll();
}
}
if (!ev->isAccepted())
@@ -1297,7 +1272,7 @@ void QDeclarativeTextInput::geometryChanged(const QRectF &newGeometry,
Q_D(QDeclarativeTextInput);
if (newGeometry.width() != oldGeometry.width()) {
updateSize();
- d->updateHorizontalScroll();
+ updateCursorRectangle();
}
QDeclarativePaintedItem::geometryChanged(newGeometry, oldGeometry);
}
@@ -1643,7 +1618,6 @@ void QDeclarativeTextInput::moveCursorSelection(int position)
{
Q_D(QDeclarativeTextInput);
d->control->moveCursor(position, true);
- d->updateHorizontalScroll();
}
/*!
@@ -1901,7 +1875,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 +1891,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 +1907,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 +1941,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: