diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-02-10 13:16:24 (GMT) |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> | 2010-02-10 13:16:24 (GMT) |
commit | 2e8d090fa6813a2e37c9ed27d69bc3fc99a7ae35 (patch) | |
tree | eaf54ffe4e8a90b8ba1fe03855ab3f0808b012e8 | |
parent | 8032423bb8fa91c623ece61bff528adfd49e8685 (diff) | |
download | Qt-2e8d090fa6813a2e37c9ed27d69bc3fc99a7ae35.zip Qt-2e8d090fa6813a2e37c9ed27d69bc3fc99a7ae35.tar.gz Qt-2e8d090fa6813a2e37c9ed27d69bc3fc99a7ae35.tar.bz2 |
Make QStaticText public API again
QStaticText was previously made private API to support inclusion in
Qt 4.6.x. This change turns it back into public API for Qt 4.7.0.
-rw-r--r-- | src/gui/painting/qpaintbuffer.cpp | 7 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 82 | ||||
-rw-r--r-- | src/gui/painting/qpainter.h | 15 | ||||
-rw-r--r-- | src/gui/painting/qpainter_p.h | 6 | ||||
-rw-r--r-- | src/gui/text/qstatictext.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qstatictext.h | 98 | ||||
-rw-r--r-- | src/gui/text/qstatictext_p.h | 110 | ||||
-rw-r--r-- | src/gui/text/qstatictext_p_p.h | 141 | ||||
-rw-r--r-- | src/gui/text/text.pri | 4 | ||||
-rw-r--r-- | src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 | ||||
-rw-r--r-- | src/opengl/qpaintengine_opengl.cpp | 2 | ||||
-rw-r--r-- | src/openvg/qpaintengine_vg.cpp | 2 | ||||
-rw-r--r-- | tests/auto/qstatictext/tst_qstatictext.cpp | 34 |
14 files changed, 253 insertions, 254 deletions
diff --git a/src/gui/painting/qpaintbuffer.cpp b/src/gui/painting/qpaintbuffer.cpp index 51eb681..664d864 100644 --- a/src/gui/painting/qpaintbuffer.cpp +++ b/src/gui/painting/qpaintbuffer.cpp @@ -45,8 +45,8 @@ #include <private/qfontengine_p.h> #include <private/qemulationpaintengine_p.h> #include <private/qimage_p.h> +#include <qstatictext.h> #include <private/qstatictext_p.h> -#include <private/qstatictext_p_p.h> #include <QDebug> @@ -1448,9 +1448,10 @@ void QPainterReplayer::process(const QPaintBufferCommand &cmd) QStaticText text(variants.at(0).value<QStaticText>()); painter->setFont(font); - qt_draw_static_text(painter, QPointF(0, 0), text); + painter->drawStaticText(QPointF(0, 0), text); - break; } + break; + } case QPaintBufferPrivate::Cmd_DrawText: { QPointF pos(d->floats.at(cmd.extra), d->floats.at(cmd.extra+1)); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index a2e14e1..41c4f14 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -67,7 +67,7 @@ // #include <private/qpolygonclipper_p.h> // #include <private/qrasterizer_p.h> #include <private/qimage_p.h> -#include <private/qstatictext_p_p.h> +#include <private/qstatictext_p.h> #include "qpaintengine_raster_p.h" // #include "qbezier_p.h" diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index c2e2fef..8ab813d 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -69,8 +69,8 @@ #include <private/qwidget_p.h> #include <private/qpaintengine_raster_p.h> #include <private/qmath_p.h> +#include <qstatictext.h> #include <private/qstatictext_p.h> -#include <private/qstatictext_p_p.h> QT_BEGIN_NAMESPACE @@ -5699,6 +5699,19 @@ void QPainter::drawImage(const QRectF &targetRect, const QImage &image, const QR } /*! + + \fn void QPainter::drawStaticText(const QPoint &position, const QStaticText &staticText) + + \overload +*/ + +/*! + \fn void QPainter::drawStaticText(int x, int y, const QStaticText &staticText) + + \overload +*/ + +/*! \fn void QPainter::drawText(const QPointF &position, const QString &text) Draws the given \a text with the currently defined text direction, @@ -5720,23 +5733,10 @@ void QPainter::drawText(const QPointF &p, const QString &str) drawText(p, str, 0, 0); } -QPainterPrivate *QPainterPrivate::get(QPainter *p) +void QPainter::drawStaticText(const QPointF &position, const QStaticText &staticText) { - return p->d_ptr.data(); -} - -void qt_draw_static_text(QPainter *p, const QPointF &position, const QStaticText &text) -{ - QPainterPrivate *prv = QPainterPrivate::get(p); - Q_ASSERT(prv != 0); - - prv->drawStaticText(position, text); -} - -void QPainterPrivate::drawStaticText(const QPointF &position, const QStaticText &staticText) -{ - Q_Q(QPainter); - if (!engine || staticText.isEmpty() || q->pen().style() == Qt::NoPen) + Q_D(QPainter); + if (!d->engine || staticText.isEmpty() || pen().style() == Qt::NoPen) return; QStaticTextPrivate *staticText_d = @@ -5744,31 +5744,31 @@ void QPainterPrivate::drawStaticText(const QPointF &position, const QStaticText // If we don't have an extended paint engine, or if the painter is projected, // we go through standard code path - if (extended == 0 || !state->matrix.isAffine()) { + if (d->extended == 0 || !d->state->matrix.isAffine()) { if (staticText_d->size.isValid()) - q->drawText(QRectF(position, staticText_d->size), staticText_d->text); + drawText(QRectF(position, staticText_d->size), staticText_d->text); else - q->drawText(position, staticText_d->text); + drawText(position, staticText_d->text); return; } // Don't recalculate entire layout because of translation, rather add the dx and dy // into the position to move each text item the correct distance. - QPointF transformedPosition = position * state->matrix; - QTransform matrix = state->matrix; + QPointF transformedPosition = position * d->state->matrix; + QTransform matrix = d->state->matrix; // The translation has been applied to transformedPosition. Remove translation // component from matrix. - if (state->matrix.isTranslating()) { - qreal m11 = state->matrix.m11(); - qreal m12 = state->matrix.m12(); - qreal m13 = state->matrix.m13(); - qreal m21 = state->matrix.m21(); - qreal m22 = state->matrix.m22(); - qreal m23 = state->matrix.m23(); - qreal m33 = state->matrix.m33(); - - state->matrix.setMatrix(m11, m12, m13, + if (d->state->matrix.isTranslating()) { + qreal m11 = d->state->matrix.m11(); + qreal m12 = d->state->matrix.m12(); + qreal m13 = d->state->matrix.m13(); + qreal m21 = d->state->matrix.m21(); + qreal m22 = d->state->matrix.m22(); + qreal m23 = d->state->matrix.m23(); + qreal m33 = d->state->matrix.m33(); + + d->state->matrix.setMatrix(m11, m12, m13, m21, m22, m23, 0.0, 0.0, m33); } @@ -5776,21 +5776,21 @@ void QPainterPrivate::drawStaticText(const QPointF &position, const QStaticText // If the transform is not identical to the text transform, // we have to relayout the text (for other transformations than plain translation) bool staticTextNeedsReinit = false; - if (staticText_d->matrix != state->matrix) { - staticText_d->matrix = state->matrix; + if (staticText_d->matrix != d->state->matrix) { + staticText_d->matrix = d->state->matrix; staticTextNeedsReinit = true; } bool restoreWhenFinished = false; if (staticText_d->needsClipRect) { - q->save(); - q->setClipRect(QRectF(position, staticText_d->size)); + save(); + setClipRect(QRectF(position, staticText_d->size)); restoreWhenFinished = true; } - if (q->font() != staticText_d->font) { - staticText_d->font = q->font(); + if (font() != staticText_d->font) { + staticText_d->font = font(); staticTextNeedsReinit = true; } @@ -5817,14 +5817,14 @@ void QPainterPrivate::drawStaticText(const QPointF &position, const QStaticText for (int i=0; i<staticText_d->itemCount; ++i) { QStaticTextItem *item = staticText_d->items + i; - extended->drawStaticTextItem(item); + d->extended->drawStaticTextItem(item); } if (restoreWhenFinished) - q->restore(); + restore(); if (matrix.isTranslating()) - state->matrix = matrix; + d->state->matrix = matrix; } /*! diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index ffddcba..e9fd532 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -78,6 +78,7 @@ class QPolygon; class QTextItem; class QMatrix; class QTransform; +class QStaticText; class QPainterPrivateDeleter; @@ -369,6 +370,10 @@ public: void setLayoutDirection(Qt::LayoutDirection direction); Qt::LayoutDirection layoutDirection() const; + void drawStaticText(const QPointF &p, const QStaticText &staticText); + inline void drawStaticText(const QPoint &p, const QStaticText &staticText); + inline void drawStaticText(int x, int y, const QStaticText &staticText); + void drawText(const QPointF &p, const QString &s); inline void drawText(const QPoint &p, const QString &s); inline void drawText(int x, int y, const QString &s); @@ -896,6 +901,16 @@ inline void QPainter::drawImage(int x, int y, const QImage &image, int sx, int s drawImage(QRectF(x, y, -1, -1), image, QRectF(sx, sy, sw, sh), flags); } +inline void QPainter::drawStaticText(const QPoint &p, const QStaticText &staticText) +{ + drawStaticText(QPointF(p), staticText); +} + +inline void QPainter::drawStaticText(int x, int y, const QStaticText &staticText) +{ + drawStaticText(QPointF(x, y), staticText); +} + inline void QPainter::drawTextItem(const QPoint &p, const QTextItem &ti) { drawTextItem(QPointF(p), ti); diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index 2979de6..02a91aa 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -70,7 +70,6 @@ QT_BEGIN_NAMESPACE class QPaintEngine; class QEmulationPaintEngine; class QPaintEngineEx; -class QStaticText; struct QTLWExtra; @@ -230,8 +229,6 @@ public: void drawStretchedGradient(const QPainterPath &path, DrawOperation operation); void drawOpaqueBackground(const QPainterPath &path, DrawOperation operation); - void drawStaticText(const QPointF &position, const QStaticText &staticText); - void updateMatrix(); void updateInvMatrix(); @@ -245,8 +242,6 @@ public: static bool attachPainterPrivate(QPainter *q, QPaintDevice *pdev); void detachPainterPrivate(QPainter *q); - static QPainterPrivate *get(QPainter *p); - QPaintDevice *device; QPaintDevice *original_device; QPaintDevice *helper_device; @@ -257,7 +252,6 @@ public: }; Q_GUI_EXPORT void qt_draw_helper(QPainterPrivate *p, const QPainterPath &path, QPainterPrivate::DrawOperation operation); -Q_GUI_EXPORT void qt_draw_static_text(QPainter *p, const QPointF &position, const QStaticText &text); QString qt_generate_brush_key(const QBrush &brush); diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp index 659324b..74c5958 100644 --- a/src/gui/text/qstatictext.cpp +++ b/src/gui/text/qstatictext.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ +#include "qstatictext.h" #include "qstatictext_p.h" -#include "qstatictext_p_p.h" #include <private/qtextengine_p.h> #include <private/qfontengine_p.h> diff --git a/src/gui/text/qstatictext.h b/src/gui/text/qstatictext.h new file mode 100644 index 0000000..11a4249 --- /dev/null +++ b/src/gui/text/qstatictext.h @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Contact: Qt Software Information (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the either Technology Preview License Agreement or the +** Beta Release License Agreement. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain +** additional rights. These rights are described in the Nokia Qt LGPL +** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this +** package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** If you are unsure which license is appropriate for your use, please +** contact the sales department at qt-sales@nokia.com. +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QSTATICTEXT_H +#define QSTATICTEXT_H + +#include <QtCore/qsize.h> +#include <QtCore/qstring.h> +#include <QtCore/qmetatype.h> + +#include <QtGui/qtransform.h> +#include <QtGui/qfont.h> + + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QStaticTextPrivate; +class Q_GUI_EXPORT QStaticText +{ +public: + QStaticText(); + QStaticText(const QString &text, const QSizeF &maximumSize = QSizeF()); + QStaticText(const QStaticText &other); + ~QStaticText(); + + void setText(const QString &text); + QString text() const; + + void setMaximumSize(const QSizeF &maximumSize); + QSizeF maximumSize() const; + + void prepare(const QTransform &matrix, const QFont &font); + + void setUseBackendOptimizations(bool on); + bool useBackendOptimizations() const; + + QStaticText &operator=(const QStaticText &); + bool operator==(const QStaticText &) const; + bool operator!=(const QStaticText &) const; + + bool isEmpty() const; + +private: + void detach(); + + QExplicitlySharedDataPointer<QStaticTextPrivate> data; + friend class QStaticTextPrivate; +}; + +Q_DECLARE_METATYPE(QStaticText) + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QSTATICTEXT_H diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h index a19fb6c..72c8439 100644 --- a/src/gui/text/qstatictext_p.h +++ b/src/gui/text/qstatictext_p.h @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#ifndef QSTATICTEXT_H -#define QSTATICTEXT_H +#ifndef QSTATICTEXT_P_H +#define QSTATICTEXT_P_H // // W A R N I N G @@ -53,57 +53,89 @@ // We mean it. // -#include <QtCore/qsize.h> -#include <QtCore/qstring.h> -#include <QtCore/qmetatype.h> +#include <private/qtextureglyphcache_p.h> -#include <QtGui/qtransform.h> -#include <QtGui/qfont.h> +QT_BEGIN_NAMESPACE +class QStaticTextUserData +{ +public: + enum Type { + NoUserData, + OpenGLUserData + }; -QT_BEGIN_HEADER + QStaticTextUserData(Type t) : type(t) {} + virtual ~QStaticTextUserData() {} -QT_BEGIN_NAMESPACE + Type type; +}; -QT_MODULE(Gui) +class Q_GUI_EXPORT QStaticTextItem +{ +public: + QStaticTextItem() : chars(0), numChars(0), fontEngine(0), userData(0), + useBackendOptimizations(false), userDataNeedsUpdate(0) {} + ~QStaticTextItem() { delete userData; } + + void setUserData(QStaticTextUserData *newUserData) + { + if (userData == newUserData) + return; + + delete userData; + userData = newUserData; + } + + QFixedPoint *glyphPositions; // 8 bytes per glyph + glyph_t *glyphs; // 4 bytes per glyph + const QChar *chars; // 2 bytes per glyph + // ================= + // 14 bytes per glyph + + // 12 bytes for pointers + int numGlyphs; // 4 bytes per item + int numChars; // 4 bytes per item + QFontEngine *fontEngine; // 4 bytes per item + QFont font; // 8 bytes per item + QStaticTextUserData *userData; // 8 bytes per item + char useBackendOptimizations : 1; // 1 byte per item + char userDataNeedsUpdate : 1; // + // ================ + // 41 bytes per item +}; -class QStaticTextPrivate; -class Q_GUI_EXPORT QStaticText -{ +class QStaticText; +class Q_AUTOTEST_EXPORT QStaticTextPrivate +{ public: - QStaticText(); - QStaticText(const QString &text, const QSizeF &maximumSize = QSizeF()); - QStaticText(const QStaticText &other); - ~QStaticText(); + QStaticTextPrivate(); + QStaticTextPrivate(const QStaticTextPrivate &other); + ~QStaticTextPrivate(); - void setText(const QString &text); - QString text() const; + void init(); - void setMaximumSize(const QSizeF &maximumSize); - QSizeF maximumSize() const; + QAtomicInt ref; // 4 bytes per text - void prepare(const QTransform &matrix, const QFont &font); + QString text; // 4 bytes per text + QFont font; // 8 bytes per text + QSizeF size; // 16 bytes per text + QPointF position; // 16 bytes per text - void setUseBackendOptimizations(bool on); - bool useBackendOptimizations() const; + QTransform matrix; // 80 bytes per text + QStaticTextItem *items; // 4 bytes per text + int itemCount; // 4 bytes per text + glyph_t *glyphPool; // 4 bytes per text + QFixedPoint *positionPool; // 4 bytes per text - QStaticText &operator=(const QStaticText &); - bool operator==(const QStaticText &) const; - bool operator!=(const QStaticText &) const; + char needsClipRect : 1; // 1 byte per text + char useBackendOptimizations : 1; + // ================ + // 145 bytes per text - bool isEmpty() const; - -private: - void detach(); - - QExplicitlySharedDataPointer<QStaticTextPrivate> data; - friend class QStaticTextPrivate; + static QStaticTextPrivate *get(const QStaticText *q); }; -Q_DECLARE_METATYPE(QStaticText) - QT_END_NAMESPACE -QT_END_HEADER - -#endif // QSTATICTEXT_H +#endif // QSTATICTEXT_P_H diff --git a/src/gui/text/qstatictext_p_p.h b/src/gui/text/qstatictext_p_p.h deleted file mode 100644 index 72c8439..0000000 --- a/src/gui/text/qstatictext_p_p.h +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** Contact: Qt Software Information (qt-info@nokia.com) -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the either Technology Preview License Agreement or the -** Beta Release License Agreement. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain -** additional rights. These rights are described in the Nokia Qt LGPL -** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this -** package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** If you are unsure which license is appropriate for your use, please -** contact the sales department at qt-sales@nokia.com. -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QSTATICTEXT_P_H -#define QSTATICTEXT_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of internal files. This header file may change from version to version -// without notice, or even be removed. -// -// We mean it. -// - -#include <private/qtextureglyphcache_p.h> - -QT_BEGIN_NAMESPACE - -class QStaticTextUserData -{ -public: - enum Type { - NoUserData, - OpenGLUserData - }; - - QStaticTextUserData(Type t) : type(t) {} - virtual ~QStaticTextUserData() {} - - Type type; -}; - -class Q_GUI_EXPORT QStaticTextItem -{ -public: - QStaticTextItem() : chars(0), numChars(0), fontEngine(0), userData(0), - useBackendOptimizations(false), userDataNeedsUpdate(0) {} - ~QStaticTextItem() { delete userData; } - - void setUserData(QStaticTextUserData *newUserData) - { - if (userData == newUserData) - return; - - delete userData; - userData = newUserData; - } - - QFixedPoint *glyphPositions; // 8 bytes per glyph - glyph_t *glyphs; // 4 bytes per glyph - const QChar *chars; // 2 bytes per glyph - // ================= - // 14 bytes per glyph - - // 12 bytes for pointers - int numGlyphs; // 4 bytes per item - int numChars; // 4 bytes per item - QFontEngine *fontEngine; // 4 bytes per item - QFont font; // 8 bytes per item - QStaticTextUserData *userData; // 8 bytes per item - char useBackendOptimizations : 1; // 1 byte per item - char userDataNeedsUpdate : 1; // - // ================ - // 41 bytes per item -}; - -class QStaticText; -class Q_AUTOTEST_EXPORT QStaticTextPrivate -{ -public: - QStaticTextPrivate(); - QStaticTextPrivate(const QStaticTextPrivate &other); - ~QStaticTextPrivate(); - - void init(); - - QAtomicInt ref; // 4 bytes per text - - QString text; // 4 bytes per text - QFont font; // 8 bytes per text - QSizeF size; // 16 bytes per text - QPointF position; // 16 bytes per text - - QTransform matrix; // 80 bytes per text - QStaticTextItem *items; // 4 bytes per text - int itemCount; // 4 bytes per text - glyph_t *glyphPool; // 4 bytes per text - QFixedPoint *positionPool; // 4 bytes per text - - char needsClipRect : 1; // 1 byte per text - char useBackendOptimizations : 1; - // ================ - // 145 bytes per text - - static QStaticTextPrivate *get(const QStaticText *q); -}; - -QT_END_NAMESPACE - -#endif // QSTATICTEXT_P_H diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index 2eaa418..9ec3142 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -38,8 +38,8 @@ HEADERS += \ text/qzipreader_p.h \ text/qzipwriter_p.h \ text/qtextodfwriter_p.h \ - text/qstatictext_p_p.h \ - text/qstatictext_p.h + text/qstatictext_p.h \ + text/qstatictext.h SOURCES += \ text/qfont.cpp \ diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 685f0c1..4ae8e6a 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -77,7 +77,7 @@ #include <private/qfontengine_p.h> #include <private/qpixmapdata_gl_p.h> #include <private/qdatabuffer_p.h> -#include <private/qstatictext_p_p.h> +#include <private/qstatictext_p.h> #include "qglgradientcache_p.h" #include "qglengineshadermanager_p.h" diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp index e7a1b7e..a2f085c 100644 --- a/src/opengl/qpaintengine_opengl.cpp +++ b/src/opengl/qpaintengine_opengl.cpp @@ -60,7 +60,7 @@ #include <private/qglpixelbuffer_p.h> #include <private/qbezier_p.h> #include <qglframebufferobject.h> -#include <private/qstatictext_p_p.h> +#include <private/qstatictext_p.h> #include "private/qtessellator_p.h" diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index c8a60d0..41772d1 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -53,7 +53,7 @@ #include <QtGui/private/qtextengine_p.h> #include <QtGui/private/qfontengine_p.h> #include <QtGui/private/qpainterpath_p.h> -#include <QtGui/private/qstatictext_p_p.h> +#include <QtGui/private/qstatictext_p.h> #include <QDebug> #include <QSet> diff --git a/tests/auto/qstatictext/tst_qstatictext.cpp b/tests/auto/qstatictext/tst_qstatictext.cpp index 9e4b540..92c0008 100644 --- a/tests/auto/qstatictext/tst_qstatictext.cpp +++ b/tests/auto/qstatictext/tst_qstatictext.cpp @@ -46,9 +46,8 @@ #include <QtOpenGl/QGLWidget> +#include <qstatictext.h> #include <private/qstatictext_p.h> -#include <private/qstatictext_p_p.h> -#include <private/qpainter_p.h> // #define DEBUG_SAVE_IMAGE @@ -120,7 +119,7 @@ void tst_QStaticText::drawToPoint() QPainter p(&imageDrawStaticText); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); text.setUseBackendOptimizations(useBackendOptimizations); - qt_draw_static_text(&p, QPointF(11, 12), text); + p.drawStaticText(QPointF(11, 12), text); } QCOMPARE(imageDrawStaticText, imageDrawText); @@ -151,7 +150,7 @@ void tst_QStaticText::drawToRect() QPainter p(&imageDrawStaticText); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit.", QSizeF(10, 500)); text.setUseBackendOptimizations(useBackendOptimizations); - qt_draw_static_text(&p, QPointF(11, 12), text); + p.drawStaticText(QPointF(11, 12), text); } QCOMPARE(imageDrawStaticText, imageDrawText); @@ -178,7 +177,7 @@ void tst_QStaticText::prepareToCorrectData() p.setTransform(transform); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); text.prepare(transform, p.font()); - qt_draw_static_text(&p, QPointF(11, 12), text); + p.drawStaticText(QPointF(11, 12), text); } QCOMPARE(imageDrawStaticText, imageDrawText); @@ -203,7 +202,7 @@ void tst_QStaticText::prepareToWrongData() QPainter p(&imageDrawStaticText); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); text.prepare(transform, p.font()); - qt_draw_static_text(&p, QPointF(11, 12), text); + p.drawStaticText(QPointF(11, 12), text); } QCOMPARE(imageDrawStaticText, imageDrawText); @@ -234,9 +233,10 @@ void tst_QStaticText::setFont() QStaticText text; text.setText("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - qt_draw_static_text(&p, QPointF(0, 0), text); + p.drawStaticText(0, 0, text); + p.setFont(font); - qt_draw_static_text(&p, QPointF(11, 120), text); + p.drawStaticText(11, 120, text); } QCOMPARE(imageDrawStaticText, imageDrawText); @@ -257,7 +257,7 @@ void tst_QStaticText::setMaximumSize() QPainter p(&imageDrawStaticText); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); text.setMaximumSize(QSizeF(10, 500)); - qt_draw_static_text(&p, QPointF(11, 12), text); + p.drawStaticText(QPointF(11, 12), text); } QCOMPARE(imageDrawStaticText, imageDrawText); @@ -281,7 +281,7 @@ void tst_QStaticText::translatedPainter() p.translate(100, 200); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - qt_draw_static_text(&p, QPointF(11, 12), text); + p.drawStaticText(QPointF(11, 12), text); } QCOMPARE(imageDrawStaticText, imageDrawText); @@ -304,7 +304,7 @@ void tst_QStaticText::rotatedPainter() QPainter p(&imageDrawStaticText); p.rotate(30.0); - qt_draw_static_text(&p, QPointF(0, 0), text); + p.drawStaticText(QPoint(0, 0), text); } #if defined(DEBUG_SAVE_IMAGE) @@ -333,7 +333,7 @@ void tst_QStaticText::scaledPainter() p.scale(2.0, 0.2); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - qt_draw_static_text(&p, QPointF(11, 12), text); + p.drawStaticText(QPointF(11, 12), text); } QCOMPARE(imageDrawStaticText, imageDrawText); @@ -360,7 +360,7 @@ void tst_QStaticText::projectedPainter() p.setTransform(transform); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - qt_draw_static_text(&p, QPointF(11, 12), text); + p.drawStaticText(QPointF(11, 12), text); } QCOMPARE(imageDrawStaticText, imageDrawText); @@ -389,7 +389,7 @@ void tst_QStaticText::rotatedScaledAndTranslatedPainter() p.translate(100, 200); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - qt_draw_static_text(&p, QPointF(11, 12), text); + p.drawStaticText(QPointF(11, 12), text); } #if defined(DEBUG_SAVE_IMAGE) @@ -423,10 +423,10 @@ void tst_QStaticText::transformationChanged() p.scale(0.5, 0.7); QStaticText text("Lorem ipsum dolor sit amet, consectetur adipiscing elit."); - qt_draw_static_text(&p, QPointF(0, 0), text); + p.drawStaticText(QPointF(0, 0), text); p.scale(7.0, 5.0); - qt_draw_static_text(&p, QPointF(0, 0), text); + p.drawStaticText(QPointF(0, 0), text); } #if defined(DEBUG_SAVE_IMAGE) @@ -462,7 +462,7 @@ public: switch (m_paintEventType) { case NormalDrawStaticText: case DrawStaticTextWithCaching: - qt_draw_static_text(&painter, QPointF(11, 12), m_staticText); + painter.drawStaticText(QPointF(11, 12), m_staticText); break; case NormalDrawText: painter.drawText(11, 12, "Lorem ipsum dolor sit amet, consectetur adipiscing elit."); |