aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquicktextedit.cpp
diff options
context:
space:
mode:
authorAndrew den Exter <andrew.den-exter@nokia.com>2012-02-07 11:57:42 +1000
committerQt by Nokia <qt-info@nokia.com>2012-02-07 06:36:05 +0100
commit51b7425329e0fa221c319e8d75595c19f664aedb (patch)
tree48c2d03edc05da74296a25540f1b8df52389b7ee /src/quick/items/qquicktextedit.cpp
parentce3dee765c858a0b573d468ef8fee6b838e576d1 (diff)
Add contentWidth and contentHeight properties to Text elements.
For Text and TextEdit this is a rename of paintedWidth and paintedHeight both of which remain as synonyms of the content properties for compatability. For TextInput this is a new property. Task-number: QTBUG-23691 Task-number: QTBUG-15160 Change-Id: Idbdc72fad34922be21b649ca45fc39b5e533ed1a Reviewed-by: Yann Bodson <yann.bodson@nokia.com>
Diffstat (limited to 'src/quick/items/qquicktextedit.cpp')
-rw-r--r--src/quick/items/qquicktextedit.cpp20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/quick/items/qquicktextedit.cpp b/src/quick/items/qquicktextedit.cpp
index 0ebe5de218..85480cf558 100644
--- a/src/quick/items/qquicktextedit.cpp
+++ b/src/quick/items/qquicktextedit.cpp
@@ -271,7 +271,6 @@ void QQuickTextEdit::setText(const QString &text)
} else {
d->control->setPlainText(text);
}
- q_textChanged();
}
/*!
@@ -663,27 +662,27 @@ int QQuickTextEdit::length() const
}
/*!
- \qmlproperty real QtQuick2::TextEdit::paintedWidth
+ \qmlproperty real QtQuick2::TextEdit::contentWidth
Returns the width of the text, including the width past the width
which is covered due to insufficient wrapping if \l wrapMode is set.
*/
-qreal QQuickTextEdit::paintedWidth() const
+qreal QQuickTextEdit::contentWidth() const
{
Q_D(const QQuickTextEdit);
- return d->paintedSize.width();
+ return d->contentSize.width();
}
/*!
- \qmlproperty real QtQuick2::TextEdit::paintedHeight
+ \qmlproperty real QtQuick2::TextEdit::contentHeight
Returns the height of the text, including the height past the height
that is covered if the text does not fit within the set height.
*/
-qreal QQuickTextEdit::paintedHeight() const
+qreal QQuickTextEdit::contentHeight() const
{
Q_D(const QQuickTextEdit);
- return d->paintedSize.height();
+ return d->contentSize.height();
}
/*!
@@ -1966,8 +1965,11 @@ void QQuickTextEdit::updateSize()
else
setImplicitHeight(newHeight);
- d->paintedSize = QSize(newWidth, newHeight);
- emit paintedSizeChanged();
+ QSize size(newWidth, newHeight);
+ if (d->contentSize != size) {
+ d->contentSize = size;
+ emit contentSizeChanged();
+ }
} else {
d->dirty = true;
}