From b7082fec87305d61fe7021340a36d28bd4a33c37 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 4 Feb 2011 13:18:42 +0100 Subject: Revert part of commit 7c1ab9b6a8 It was not properly merged in master because of conflicts, and we have now a public API for this Added QEXPECT_FAIL and opened QTBUG-17325 --- src/declarative/graphicsitems/qdeclarativetext.cpp | 23 ---------------------- src/gui/text/qtextdocumentlayout.cpp | 14 +------------ src/gui/text/qtextdocumentlayout_p.h | 5 +---- .../qdeclarativetext/tst_qdeclarativetext.cpp | 3 +++ 4 files changed, 5 insertions(+), 40 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 54b4c3a..346080d 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -41,7 +41,6 @@ #include "private/qdeclarativetext_p.h" #include "private/qdeclarativetext_p_p.h" -#include #include #include #include @@ -84,14 +83,6 @@ private: static QSet errors; }; -class QDeclarativeTextDocumentLayout : public QTextDocumentLayout -{ - Q_OBJECT -public: - QDeclarativeTextDocumentLayout(QTextDocument *doc); - void setLineHeight(qreal lineHeight, QDeclarativeText::LineHeightMode mode); -}; - DEFINE_BOOL_CONFIG_OPTION(enableImageCache, QML_ENABLE_TEXT_IMAGE_CACHE); QString QDeclarativeTextPrivate::elideChar = QString(0x2026); @@ -185,15 +176,6 @@ void QTextDocumentWithImageResources::setText(const QString &text) QSet QTextDocumentWithImageResources::errors; -QDeclarativeTextDocumentLayout::QDeclarativeTextDocumentLayout(QTextDocument *doc) - : QTextDocumentLayout(doc) { -} - -void QDeclarativeTextDocumentLayout::setLineHeight(qreal lineHeight, QDeclarativeText::LineHeightMode mode = QDeclarativeText::MultiplyHeight) -{ - QTextDocumentLayout::setLineHeight(lineHeight, QTextDocumentLayout::LineHeightMode(mode)); -} - QDeclarativeTextPrivate::~QDeclarativeTextPrivate() { } @@ -239,11 +221,6 @@ void QDeclarativeTextPrivate::updateLayout() singleline = false; QDeclarativeStyledText::parse(text, layout); } - } else { - ensureDoc(); - QDeclarativeTextDocumentLayout *layout = new QDeclarativeTextDocumentLayout(doc); - layout->setLineHeight(lineHeight, lineHeightMode); - doc->setDocumentLayout(layout); } updateSize(); diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 90c05da..838face 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -513,9 +513,6 @@ public: qreal scaleToDevice(qreal value) const; QFixed scaleToDevice(QFixed value) const; - - qreal lineH; - QTextDocumentLayout::LineHeightMode lineHeightMode; }; QTextDocumentLayoutPrivate::QTextDocumentLayoutPrivate() @@ -523,9 +520,7 @@ QTextDocumentLayoutPrivate::QTextDocumentLayoutPrivate() cursorWidth(1), currentLazyLayoutPosition(-1), lazyLayoutStepSize(1000), - lastPageCount(-1), - lineH(1), - lineHeightMode(QTextDocumentLayout::MultiplyHeight) + lastPageCount(-1) { showLayoutProgress = true; insideDocumentChange = false; @@ -2746,13 +2741,6 @@ void QTextDocumentLayoutPrivate::layoutBlock(const QTextBlock &bl, int blockPosi } } -void QTextDocumentLayout::setLineHeight(qreal lineH, QTextDocumentLayout::LineHeightMode mode = QTextDocumentLayout::MultiplyHeight) -{ - Q_D(QTextDocumentLayout); - d->lineH = lineH; - d->lineHeightMode = mode; -} - void QTextDocumentLayoutPrivate::floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct, QFixed *left, QFixed *right) const { diff --git a/src/gui/text/qtextdocumentlayout_p.h b/src/gui/text/qtextdocumentlayout_p.h index efc408b..3c0383c 100644 --- a/src/gui/text/qtextdocumentlayout_p.h +++ b/src/gui/text/qtextdocumentlayout_p.h @@ -63,7 +63,7 @@ class QTextListFormat; class QTextDocumentLayoutPrivate; -class Q_GUI_EXPORT QTextDocumentLayout : public QAbstractTextDocumentLayout +class Q_AUTOTEST_EXPORT QTextDocumentLayout : public QAbstractTextDocumentLayout { Q_DECLARE_PRIVATE(QTextDocumentLayout) Q_OBJECT @@ -109,9 +109,6 @@ protected: void drawInlineObject(QPainter *p, const QRectF &rect, QTextInlineObject item, int posInDocument, const QTextFormat &format); virtual void timerEvent(QTimerEvent *e); - enum LineHeightMode { MultiplyHeight, PixelHeight }; - void setLineHeight(qreal lineHeight, QTextDocumentLayout::LineHeightMode mode); - private: QRectF doLayout(int from, int oldLength, int length); void layoutFinished(); diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 320a6e7..f1157f5 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -1103,6 +1103,7 @@ void tst_qdeclarativetext::lineHeight() qreal h = myText->height(); myText->setLineHeight(1.5); + QEXPECT_FAIL("", "QTBUG-17325", Continue); QVERIFY(myText->height() == h * 1.5); myText->setLineHeightMode(QDeclarativeText::PixelHeight); @@ -1115,10 +1116,12 @@ void tst_qdeclarativetext::lineHeight() qreal h2 = myText->height(); myText->setLineHeight(2.0); + QEXPECT_FAIL("", "QTBUG-17325", Continue); QVERIFY(myText->height() == h2 * 2.0); myText->setLineHeightMode(QDeclarativeText::PixelHeight); myText->setLineHeight(10); + QEXPECT_FAIL("", "QTBUG-17325", Continue); QCOMPARE(myText->height(), myText->lineCount() * 10.0); delete canvas; -- cgit v0.12