diff options
author | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-05-31 05:23:40 (GMT) |
---|---|---|
committer | Aaron McCarthy <aaron.mccarthy@nokia.com> | 2010-05-31 05:23:40 (GMT) |
commit | f587dfeaa9d369235d347af3d14339054ee59908 (patch) | |
tree | 3ac92f6a08d871099d8808e8d5fc59f50863bacb /src/declarative/graphicsitems/qdeclarativetext.cpp | |
parent | feb9949a11abbf244e0bfcdc128981596758de40 (diff) | |
parent | 9da305aedfaa5da5a3059c99ac5a5389dab42b10 (diff) | |
download | Qt-f587dfeaa9d369235d347af3d14339054ee59908.zip Qt-f587dfeaa9d369235d347af3d14339054ee59908.tar.gz Qt-f587dfeaa9d369235d347af3d14339054ee59908.tar.bz2 |
Merge remote branch 'staging/4.7' into HEAD
Diffstat (limited to 'src/declarative/graphicsitems/qdeclarativetext.cpp')
-rw-r--r-- | src/declarative/graphicsitems/qdeclarativetext.cpp | 37 |
1 files changed, 30 insertions, 7 deletions
diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 4e7e0fd..2c1eb67 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -499,13 +499,10 @@ void QDeclarativeText::setVAlign(VAlignment align) wrap if an explicit width has been set. wrapMode can be one of: \list - \o Text.NoWrap - no wrapping will be performed. - \o Text.WordWrap - wrapping is done on word boundaries. If the text cannot be - word-wrapped to the specified width it will be partially drawn outside of the item's bounds. - If this is undesirable then enable clipping on the item (Item::clip). - \o Text.WrapAnywhere - Text can be wrapped at any point on a line, even if it occurs in the middle of a word. - \o Text.WrapAtWordBoundaryOrAnywhere - If possible, wrapping occurs at a word boundary; otherwise it - will occur at the appropriate point on the line, even in the middle of a word. + \o Text.NoWrap - no wrapping will be performed. If the text contains insufficient newlines, then implicitWidth will exceed a set width. + \o Text.WordWrap - wrapping is done on word boundaries only. If a word is too long, implicitWidth will exceed a set width. + \o Text.WrapAnywhere - wrapping is done at any point on a line, even if it occurs in the middle of a word. + \o Text.Wrap - if possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word. \endlist The default is Text.NoWrap. @@ -715,6 +712,7 @@ void QDeclarativeTextPrivate::updateSize() QFontMetrics fm(font); if (text.isEmpty()) { q->setImplicitHeight(fm.height()); + emit q->paintedSizeChanged(); return; } @@ -753,11 +751,36 @@ void QDeclarativeTextPrivate::updateSize() //### need to comfirm cost of always setting these for richText q->setImplicitWidth(richText ? (int)doc->idealWidth() : size.width()); q->setImplicitHeight(richText ? (int)doc->size().height() : size.height()); + emit q->paintedSizeChanged(); } else { dirty = true; } } +/*! + \qmlproperty real Text::paintedWidth + + Returns the width of the text, including width past the width + which is covered due to insufficient wrapping if WrapMode is set. +*/ +qreal QDeclarativeText::paintedWidth() const +{ + return implicitWidth(); +} + +/*! + \qmlproperty real Text::paintedHeight + + Returns the height of the text, including height past the height + which is covered due to there being more text than fits in the set height. +*/ +qreal QDeclarativeText::paintedHeight() const +{ + return implicitHeight(); +} + + + // ### text layout handling should be profiled and optimized as needed // what about QStackTextEngine engine(tmp, d->font.font()); QTextLayout textLayout(&engine); |