From 383f57dd2669b71fd14cf9b6b56213423a3d2d01 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 3 May 2011 11:53:34 +0200 Subject: Fix the tst_QPluginLoader::loadCorruptElf on 64 bit The error message do not match Reviewed-by: Arvid Ephraim Picciani --- tests/auto/qpluginloader/tst_qpluginloader.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qpluginloader/tst_qpluginloader.cpp b/tests/auto/qpluginloader/tst_qpluginloader.cpp index 591ef5e..76c2f6e 100644 --- a/tests/auto/qpluginloader/tst_qpluginloader.cpp +++ b/tests/auto/qpluginloader/tst_qpluginloader.cpp @@ -370,15 +370,15 @@ if (sizeof(void*) == 8) { QPluginLoader lib1(SRCDIR "elftest/corrupt1.elf64.so"); QCOMPARE(lib1.load(), false); - QVERIFY(lib1.errorString().contains("not an ELF object")); + QVERIFY(lib1.errorString().contains("not a valid Qt plugin")); QPluginLoader lib2(SRCDIR "elftest/corrupt2.elf64.so"); QCOMPARE(lib2.load(), false); - QVERIFY(lib2.errorString().contains("invalid")); + QVERIFY(lib2.errorString().contains("not a valid Qt plugin")); QPluginLoader lib3(SRCDIR "elftest/corrupt3.elf64.so"); QCOMPARE(lib3.load(), false); - QVERIFY(lib3.errorString().contains("invalid")); + QVERIFY(lib3.errorString().contains("not a valid Qt plugin")); } else if (sizeof(void*) == 4) { QPluginLoader libW(SRCDIR "elftest/corrupt3.elf64.so"); QCOMPARE(libW.load(), false); -- cgit v0.12 From bbbd4b8f3949b58d4fd21854241cb46cbc024a80 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Tue, 3 May 2011 19:36:26 +0200 Subject: Fix drawing text in item view: Put back code that was removed by mistake in e8019cf8feb402303e6d253f5ca58bebfda42679 Task-number: QTBUG-18998 --- src/gui/styles/qcommonstyle.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 2534d3e..95ebdb4 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -898,6 +898,25 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, in return QSize(0, 0); } +static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth) +{ + qreal height = 0; + qreal widthUsed = 0; + textLayout.beginLayout(); + while (true) { + QTextLine line = textLayout.createLine(); + if (!line.isValid()) + break; + line.setLineWidth(lineWidth); + line.setPosition(QPointF(0, height)); + height += line.height(); + widthUsed = qMax(widthUsed, line.naturalTextWidth()); + } + textLayout.endLayout(); + return QSizeF(widthUsed, height); +} + + void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewItemV4 *option, const QRect &rect) const { Q_Q(const QCommonStyle); @@ -915,6 +934,8 @@ void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewIt textLayout.setFont(option->font); textLayout.setText(option->text); + viewItemTextLayout(textLayout, textRect.width()); + QString elidedText; qreal height = 0; qreal width = 0; -- cgit v0.12