diff options
author | Eskil Abrahamsen Blomfeldt <eblomfel@trolltech.com> | 2009-08-20 10:57:34 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-01-14 12:57:10 (GMT) |
commit | 7fbffd29e5904151a3a249004031d0502a16f4fc (patch) | |
tree | d06b39d9993a382a01e250e58d8e547a0cd5a436 /src/gui/text/qstatictext.cpp | |
parent | 161f6b4ccdec38c9817672ad977f4d025acb14f4 (diff) | |
download | Qt-7fbffd29e5904151a3a249004031d0502a16f4fc.zip Qt-7fbffd29e5904151a3a249004031d0502a16f4fc.tar.gz Qt-7fbffd29e5904151a3a249004031d0502a16f4fc.tar.bz2 |
Remove font property in QStaticText and fix handling translation on
painter
1. The font property in QStaticText has been removed. Rather than set a
font on the text explicitly, it picks up the font from the painter. If
you change the font on the painter, the text layout will have to be
updated, like with a matrix.
2. The translation might not be the only transformation on the painter,
so rather than translate back to origo, we explicitly set dx and dy
on the transform to 0.0 for the duration of the function.
3. Update test to reflect changes
Diffstat (limited to 'src/gui/text/qstatictext.cpp')
-rw-r--r-- | src/gui/text/qstatictext.cpp | 33 |
1 files changed, 4 insertions, 29 deletions
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 30935f9..d4f8fbd 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -116,11 +116,10 @@ QStaticText::QStaticText() \a font and bounded by the given \a maximumSize. If an invalid size is passed for \a maximumSize the text will be unbounded. */ -QStaticText::QStaticText(const QString &text, const QFont &font, const QSizeF &size) +QStaticText::QStaticText(const QString &text, const QSizeF &size) : d_ptr(new QStaticTextPrivate) { d_ptr->text = text; - d_ptr->font = font; d_ptr->size = size; d_ptr->init(); } @@ -223,7 +222,7 @@ void QStaticText::setMaximumSize(const QSizeF &size) /*! Returns the maximum size of the QStaticText. - \sa setMaximumSize + \sa setMaximumSize() */ QSizeF QStaticText::maximumSize() const { @@ -231,34 +230,10 @@ QSizeF QStaticText::maximumSize() const } /*! - Sets the font of the QStaticText to \a font. + Returns true if the text of the QStaticText is empty, and false if not. - \note This function will cause the layout of the text to be recalculated. - - \sa font() -*/ -void QStaticText::setFont(const QFont &font) -{ - detach(); - d_ptr->font = font; - d_ptr->init(); -} - -/*! - Returns the font of the QStaticText. - - \sa setFont() + \sa text() */ -QFont QStaticText::font() const -{ - return d_ptr->font; -} - -QString QStaticText::toString() const -{ - return text(); -} - bool QStaticText::isEmpty() const { return d_ptr->text.isEmpty(); |