From a2ee2eb3e9991ae42ebe56898e25e742c2762ff2 Mon Sep 17 00:00:00 2001 From: Robin Burchell Date: Tue, 15 Jun 2010 23:21:10 +0100 Subject: Documentation changes to QTextLayout. - Improves quality of English in some cases - Removes some redundant redundancy Generally makes it more pleasant to read, IMHO. --- src/gui/text/qtextlayout.cpp | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index ddf9411..dbfe23e 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -282,12 +282,11 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const \class QTextLayout \reentrant - \brief The QTextLayout class is used to lay out and paint a single - paragraph of text. + \brief The QTextLayout class is used to lay out and render text. \ingroup richtext-processing - It offers most features expected from a modern text layout + It offers many features expected from a modern text layout engine, including Unicode compliant rendering, line breaking and handling of cursor positioning. It can also produce and render device independent layout, something that is important for WYSIWYG @@ -297,29 +296,33 @@ Qt::LayoutDirection QTextInlineObject::textDirection() const implement your own text rendering for some specialized widget, you probably won't need to use it directly. - QTextLayout can currently deal with plain text and rich text - paragraphs that are part of a QTextDocument. + QTextLayout can be used with both plain and rich text. - QTextLayout can be used to create a sequence of QTextLine's with - given widths and can position them independently on the screen. - Once the layout is done, these lines can be drawn on a paint - device. + QTextLayout can be used to create a sequence of QTextLine + instances with given widths and can position them independently + on the screen. Once the layout is done, these lines can be drawn + on a paint device. - Here's some code snippet that presents the layout phase: + The text to be laid out can be provided in the constructor or set with + setText(). + + The layout can be seen as a sequence of QTextLine objects; use createLine() + to create a QTextLine instance, and lineAt() or lineForTextPosition() to retrieve + created lines. + + Here is a code snippet that demonstrates the layout phase: \snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 0 - The text can be drawn by calling the layout's draw() function: + The text can then be rendered by calling the layout's draw() function: \snippet doc/src/snippets/code/src_gui_text_qtextlayout.cpp 1 - The text layout's text is set in the constructor or with - setText(). The layout can be seen as a sequence of QTextLine - objects; use lineAt() or lineForTextPosition() to get a QTextLine, - createLine() to create one. For a given position in the text you - can find a valid cursor position with isValidCursorPosition(), - nextCursorPosition(), and previousCursorPosition(). The layout - itself can be positioned with setPosition(); it has a - boundingRect(), and a minimumWidth() and a maximumWidth(). A text - layout can be drawn on a painter device using draw(). + For a given position in the text you can find a valid cursor position with + isValidCursorPosition(), nextCursorPosition(), and previousCursorPosition(). + + The QTextLayout itself can be positioned with setPosition(); it has a + boundingRect(), and a minimumWidth() and a maximumWidth(). + + \sa QStaticText */ -- cgit v0.12 From c7ae45fd1357712e1bad7dd30c3958a5866d6ac4 Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Wed, 16 Jun 2010 16:43:57 +1000 Subject: AudioInput example; disconnect from the built-in device when changing mode. Reviewed-by:Dmytro Poplavskiy --- examples/multimedia/audioinput/audioinput.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/examples/multimedia/audioinput/audioinput.cpp b/examples/multimedia/audioinput/audioinput.cpp index 7c2cc30..9dca50c 100644 --- a/examples/multimedia/audioinput/audioinput.cpp +++ b/examples/multimedia/audioinput/audioinput.cpp @@ -312,6 +312,11 @@ void InputTest::readMore() void InputTest::toggleMode() { // Change bewteen pull and push modes + if (m_input != 0) { + disconnect(m_input, 0, this, 0); + m_input = 0; + } + m_audioInput->stop(); if (m_pullMode) { -- cgit v0.12 From 4f79cbb2b7923ff7f7cbc77dc6820d12f594311d Mon Sep 17 00:00:00 2001 From: Justin McPherson Date: Wed, 16 Jun 2010 16:44:18 +1000 Subject: Audio (osx); In pull mode emit readyRead() for each period received. Task-number: QTBUG-10009 Reviewed-by:Dmytro Poplavskiy --- src/multimedia/audio/qaudioinput_mac_p.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/multimedia/audio/qaudioinput_mac_p.cpp b/src/multimedia/audio/qaudioinput_mac_p.cpp index cb65f6e..b99fe11 100644 --- a/src/multimedia/audio/qaudioinput_mac_p.cpp +++ b/src/multimedia/audio/qaudioinput_mac_p.cpp @@ -259,7 +259,7 @@ public: UInt32 inBusNumber, UInt32 inNumberFrames) { - const bool wasEmpty = m_buffer->used() == 0; + const bool pullMode = m_device == 0; OSStatus err; qint64 framesRendered = 0; @@ -330,7 +330,7 @@ public: framesRendered = copied / m_outputFormat.mBytesPerFrame; } - if (wasEmpty && framesRendered > 0) + if (pullMode && framesRendered > 0) emit readyRead(); return framesRendered; -- cgit v0.12 From 3385042e497935f7cecd6d53bb578297cdc93e69 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Wed, 16 Jun 2010 17:58:02 +0200 Subject: Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit/qtwebkit-4.6 ( aa3f786bdba4dc153620ae7f98e4b0e41770d1d1 ) Changes in WebKit/qt since the last update: * https://bugs.webkit.org/show_bug.cgi?id=34614 -- [Qt] npapi header leaves XP_WIN flag defined even when __SYMBIAN32__ flag is found --- src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 13 +++++++++++++ src/3rdparty/webkit/WebCore/bridge/npapi.h | 2 +- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 4c895fb..cbc163c 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -8,4 +8,4 @@ The commit imported was from the and has the sha1 checksum - 7932e8da6bfdeff653c572c22aed879c8c308829 + aa3f786bdba4dc153620ae7f98e4b0e41770d1d1 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 09b8598..f01220e 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,16 @@ +2010-04-06 Abhinav Mithal + + Reviewed by Laszlo Gombos. + + [Qt] npapi header leaves XP_WIN flag defined even when __SYMBIAN32__ flag is found + https://bugs.webkit.org/show_bug.cgi?id=34614 + + Do not define XP_WIN if WebKit is compiled for Symbian. + + No new tests as there is no new functionality. + + * bridge/npapi.h: + 2010-05-28 Peter Kasting Reviewed by Darin Adler. diff --git a/src/3rdparty/webkit/WebCore/bridge/npapi.h b/src/3rdparty/webkit/WebCore/bridge/npapi.h index c6cd557..4a8492e 100644 --- a/src/3rdparty/webkit/WebCore/bridge/npapi.h +++ b/src/3rdparty/webkit/WebCore/bridge/npapi.h @@ -50,7 +50,7 @@ #define JRIEnv void #endif -#ifdef _WIN32 +#if defined(_WIN32) && !defined(__SYMBIAN32__) # ifndef XP_WIN # define XP_WIN 1 # endif /* XP_WIN */ -- cgit v0.12 From 0aaf5a740dc97de3d51d35a489eda25663503a31 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 17 Jun 2010 08:23:36 +1000 Subject: Attempt to stabilize tst_lupdate::good Increase timeout when running lupdate from 5 to 30 seconds. --- tests/auto/linguist/lupdate/tst_lupdate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp index c179462..5ba6c52 100644 --- a/tests/auto/linguist/lupdate/tst_lupdate.cpp +++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp @@ -288,7 +288,7 @@ void tst_lupdate::good() proc.setWorkingDirectory(workDir); proc.setProcessChannelMode(QProcess::MergedChannels); proc.start(m_cmdLupdate + ' ' + lupdatecmd, QIODevice::ReadWrite | QIODevice::Text); - QVERIFY2(proc.waitForFinished(5000), qPrintable(lupdatecmd)); + QVERIFY2(proc.waitForFinished(30000), qPrintable(lupdatecmd)); QByteArray output = proc.readAll(); QVERIFY2(proc.exitStatus() == QProcess::NormalExit, "\"lupdate " + lupdatecmd.toLatin1() + "\" crashed\n" + output); -- cgit v0.12 From 59faedcabc9fec35d6557935e06c33a9b4ead88c Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 17 Jun 2010 08:26:31 +1000 Subject: Attempt to stabilize tst_qwidgetaction::visibilityUpdate Replace this: QTest::qWait(some_delay); QVERIFY(some_async_condition); With this: QTRY_VERIFY(some_async_condition); --- tests/auto/qwidgetaction/tst_qwidgetaction.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp index 5dfcd43..efe4838 100644 --- a/tests/auto/qwidgetaction/tst_qwidgetaction.cpp +++ b/tests/auto/qwidgetaction/tst_qwidgetaction.cpp @@ -51,6 +51,8 @@ #include #include +#include "../../shared/util.h" + //TESTED_CLASS= //TESTED_FILES= @@ -185,13 +187,13 @@ void tst_QWidgetAction::visibilityUpdate() action->setDefaultWidget(combo); tb.addAction(action); - qApp->processEvents(); //the call to show is delayed by the toolbar layout - QVERIFY(combo->isVisible()); + //the call to show is delayed by the toolbar layout + QTRY_VERIFY(combo->isVisible()); QVERIFY(action->isVisible()); action->setVisible(false); - QTest::qWait(100); //the call to hide is delayed by the toolbar layout - QVERIFY(!combo->isVisible()); + //the call to hide is delayed by the toolbar layout + QTRY_VERIFY(!combo->isVisible()); delete action; // action also deletes combo -- cgit v0.12 From 8dc1a39c9250c3301a298167a3005eab1bfc4aa8 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 17 Jun 2010 08:52:34 +1000 Subject: Attempt to stabilize tst_qwidget::syntheticEnterLeave --- tests/auto/qwidget/tst_qwidget.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 7d4f8ff..91d07de 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9233,7 +9233,8 @@ void tst_QWidget::syntheticEnterLeave() QCOMPARE(grandChild->numLeaveEvents, 0); QCOMPARE(child1->numLeaveEvents, 0); - QCOMPARE(window.numEnterEvents, 1); + // This event arrives asynchronously + QTRY_COMPARE(window.numEnterEvents, 1); QCOMPARE(child2->numEnterEvents, 1); QCOMPARE(grandChild->numEnterEvents, 1); QCOMPARE(child1->numEnterEvents, 0); -- cgit v0.12 From 3c33d95b9906758733edf2b6a79b19f2cfdd5add Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 17 Jun 2010 08:55:41 +1000 Subject: Attempt to stabilize tst_qwidget::taskQTBUG_4055_sendSyntheticEnterLeave --- tests/auto/qwidget/tst_qwidget.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 91d07de..18cc2ba 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -9325,7 +9325,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() child.show(); // Make sure the child gets enter event and no mouse move event. - QCOMPARE(child.numEnterEvents, 1); + QTRY_COMPARE(child.numEnterEvents, 1); QCOMPARE(child.numMouseMoveEvents, 0); child.hide(); @@ -9336,7 +9336,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() // Make sure the child gets enter event and mouse move event. // Note that we verify event->button() and event->buttons() // in SELChild::mouseMoveEvent(). - QCOMPARE(child.numEnterEvents, 1); + QTRY_COMPARE(child.numEnterEvents, 1); QCOMPARE(child.numMouseMoveEvents, 1); // Sending synthetic enter/leave trough the parent's mousePressEvent handler. @@ -9347,7 +9347,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() QTest::mouseClick(&parent, Qt::LeftButton); // Make sure the child gets enter event and one mouse move event. - QCOMPARE(child.numEnterEvents, 1); + QTRY_COMPARE(child.numEnterEvents, 1); QCOMPARE(child.numMouseMoveEvents, 1); child.hide(); @@ -9356,7 +9356,7 @@ void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() QTest::mouseClick(&parent, Qt::LeftButton); // Make sure the child gets enter event and no mouse move event. - QCOMPARE(child.numEnterEvents, 1); + QTRY_COMPARE(child.numEnterEvents, 1); QCOMPARE(child.numMouseMoveEvents, 0); } #endif -- cgit v0.12 From eda8acac2197a12fff512b3b7da8a671a458de27 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 17 Jun 2010 08:57:03 +1000 Subject: Replace custom WAIT_FOR_CONDITION with semi-standard QTRY_COMPARE --- tests/auto/qwidget/tst_qwidget.cpp | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index 18cc2ba..140356b 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -151,16 +151,6 @@ bool macHasAccessToWindowsServer() #undef Bool #endif -// Will try to wait for the condition while allowing event processing -// for a maximum of 2 seconds. -#define WAIT_FOR_CONDITION(expr, expected) \ - do { \ - const int step = 100; \ - for (int i = 0; i < 2000 && expr != expected; i+=step) { \ - QTest::qWait(step); \ - } \ - } while(0) - //TESTED_CLASS= //TESTED_FILES= @@ -1657,13 +1647,11 @@ void tst_QWidget::focusChainOnHide() child->setFocus(); qApp->processEvents(); - WAIT_FOR_CONDITION(child->hasFocus(), true); - QCOMPARE(child->hasFocus(), true); + QTRY_COMPARE(child->hasFocus(), true); child->hide(); qApp->processEvents(); - WAIT_FOR_CONDITION(parent->hasFocus(), true); - QCOMPARE(parent->hasFocus(), true); + QTRY_COMPARE(parent->hasFocus(), true); QCOMPARE(parent, qApp->focusWidget()); delete parent; -- cgit v0.12 From e3ed9652e7dc492d89b30fbaef6b2f175cb9ff4b Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 17 Jun 2010 09:43:06 +1000 Subject: Attempt to stabilize tst_lconvert Increase timeout running lconvert from 1 to 10 seconds. --- tests/auto/linguist/lconvert/tst_lconvert.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp index 054da4a..998f588 100644 --- a/tests/auto/linguist/lconvert/tst_lconvert.cpp +++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp @@ -153,7 +153,7 @@ void tst_lconvert::verifyReadFail(const QString &fn) { QProcess cvt; cvt.start(binDir + "/lconvert", QStringList() << (dataDir + fn)); - QVERIFY(cvt.waitForFinished(1000)); + QVERIFY(cvt.waitForFinished(10000)); QVERIFY(cvt.exitStatus() == QProcess::NormalExit); QVERIFY2(cvt.exitCode() == 2, "Accepted invalid input"); } -- cgit v0.12 From 8e68084e44b54dc73f41c5d379f0b614248978d7 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 17 Jun 2010 10:07:55 +1000 Subject: Attempt to stabilize tst_qtimeline::value Use the "slow" delays in all cases, not just on WinCE. --- tests/auto/qtimeline/tst_qtimeline.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/tests/auto/qtimeline/tst_qtimeline.cpp b/tests/auto/qtimeline/tst_qtimeline.cpp index b15d2a4..47d0550 100644 --- a/tests/auto/qtimeline/tst_qtimeline.cpp +++ b/tests/auto/qtimeline/tst_qtimeline.cpp @@ -247,11 +247,7 @@ void tst_QTimeLine::frameRate() void tst_QTimeLine::value() { -#ifdef Q_OS_WINCE //On WinCE timer resolution is bad - use longer times QTimeLine timeLine(2000); -#else - QTimeLine timeLine(200); -#endif QVERIFY(timeLine.currentValue() == 0.0); // Default speed @@ -270,19 +266,11 @@ void tst_QTimeLine::value() timeLine.setCurrentTime(100); timeLine.start(); // Let it update on its own -#ifdef Q_OS_WINCE QTest::qWait(500); -#else - QTest::qWait(50); -#endif QCOMPARE(timeLine.state(), QTimeLine::Running); qreal value = timeLine.currentValue(); timeLine.setDirection(QTimeLine::Backward); -#ifdef Q_OS_WINCE QTest::qWait(1000); -#else - QTest::qWait(100); -#endif QVERIFY(timeLine.currentValue() < value); timeLine.stop(); } -- cgit v0.12 From bba51197a1f99a5c77c2747de2ecd399fdb638a0 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 17 Jun 2010 11:36:30 +1000 Subject: Properly update childrenRect for position changes and shrinking. Task-number: QTBUG-11465 --- src/declarative/graphicsitems/qdeclarativeitem.cpp | 9 ++-- .../qdeclarativeitem/data/childrenRectBug2.qml | 53 ++++++++++++++++++++++ .../qdeclarativeitem/tst_qdeclarativeitem.cpp | 27 ++++++++++- 3 files changed, 84 insertions(+), 5 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 42b370b..336010f 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -345,10 +345,11 @@ void QDeclarativeContents::complete() void QDeclarativeContents::itemGeometryChanged(QDeclarativeItem *changed, const QRectF &newGeometry, const QRectF &oldGeometry) { - if (newGeometry.width() != oldGeometry.width()) - calcWidth(changed); - if (newGeometry.height() != oldGeometry.height()) - calcHeight(changed); + //### we can only pass changed if the left edge has moved left, or the right edge has moved right + if (newGeometry.width() != oldGeometry.width() || newGeometry.x() != oldGeometry.x()) + calcWidth(/*changed*/); + if (newGeometry.height() != oldGeometry.height() || newGeometry.y() != oldGeometry.y()) + calcHeight(/*changed*/); } void QDeclarativeContents::itemDestroyed(QDeclarativeItem *item) diff --git a/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml new file mode 100644 index 0000000..225d8d4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/data/childrenRectBug2.qml @@ -0,0 +1,53 @@ +import Qt 4.7 + +Rectangle { + width:360; + height: 200 + + Item { + objectName: "theItem" + anchors.centerIn: parent + width: childrenRect.width + height: childrenRect.height + Rectangle { + id: header1 + anchors.horizontalCenter: parent.horizontalCenter + anchors.top: parent.top + width: 100; height: 50 + color: "green" + } + Rectangle { + id: text1 + anchors.top: header1.bottom + anchors.topMargin: 10 + anchors.horizontalCenter: parent.horizontalCenter + width: 100; height: 50 + color: "blue" + } + } + + states: [ + State { + name: "row" + AnchorChanges { + target: header1 + anchors.horizontalCenter: undefined + anchors.verticalCenter: parent.verticalCenter + anchors.left: parent.left + anchors.top: undefined + } + AnchorChanges { + target: text1 + anchors.horizontalCenter: undefined + anchors.verticalCenter: parent.verticalCenter + anchors.top: undefined + anchors.left: header1.right + } + PropertyChanges { + target: text1 + anchors.leftMargin: 10 + anchors.topMargin: 0 + } + } + ] +} diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp index 0a66245..4a57def 100644 --- a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -44,7 +44,8 @@ #include #include #include -#include +#include +#include #include "../../../shared/util.h" #ifdef Q_OS_SYMBIAN @@ -73,6 +74,7 @@ private slots: void transforms_data(); void childrenRect(); void childrenRectBug(); + void childrenRectBug2(); void childrenProperty(); void resourcesProperty(); @@ -753,6 +755,29 @@ void tst_QDeclarativeItem::childrenRectBug() delete canvas; } +// QTBUG-11465 +void tst_QDeclarativeItem::childrenRectBug2() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/childrenRectBug2.qml")); + canvas->show(); + + QDeclarativeRectangle *rect = qobject_cast(canvas->rootObject()); + QVERIFY(rect); + QDeclarativeItem *item = rect->findChild("theItem"); + QCOMPARE(item->width(), qreal(100)); + QCOMPARE(item->height(), qreal(110)); + QCOMPARE(item->x(), qreal(130)); + + QDeclarativeItemPrivate *rectPrivate = QDeclarativeItemPrivate::get(rect); + rectPrivate->setState("row"); + QCOMPARE(item->width(), qreal(210)); + QCOMPARE(item->height(), qreal(50)); + QCOMPARE(item->x(), qreal(75)); + + delete canvas; +} + template T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName) { -- cgit v0.12 From cc621ba462331ad936f47c44c22030392caa574f Mon Sep 17 00:00:00 2001 From: Bea Lam Date: Thu, 17 Jun 2010 15:29:06 +1000 Subject: Auto test for QTBUG-11507 --- .../declarative/qdeclarativeqt/data/createComponent_lib.js | 7 +++++++ .../declarative/qdeclarativeqt/data/createComponent_lib.qml | 10 ++++++++++ tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp | 11 +++++++++++ 3 files changed, 28 insertions(+) create mode 100644 tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js create mode 100644 tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js new file mode 100644 index 0000000..c165e29 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.js @@ -0,0 +1,7 @@ +.pragma library + +function loadComponent() { + var component = Qt.createComponent("createComponentData.qml"); + return component.status; +} + diff --git a/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml new file mode 100644 index 0000000..aae7a91 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent_lib.qml @@ -0,0 +1,10 @@ +import Qt 4.7 +import "createComponent_lib.js" as Test + +Item { + property int status: Component.Null + + Component.onCompleted: { + status = Test.loadComponent() + } +} diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp index 06561fa..e3e0ba0 100644 --- a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -76,6 +76,7 @@ private slots: void openUrlExternally(); void md5(); void createComponent(); + void createComponent_pragmaLibrary(); void createQmlObject(); void consoleLog(); void formatting(); @@ -361,6 +362,16 @@ void tst_qdeclarativeqt::createComponent() delete object; } +void tst_qdeclarativeqt::createComponent_pragmaLibrary() +{ + QDeclarativeComponent component(&engine, TEST_FILE("createComponent_lib.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QEXPECT_FAIL("", "QTBUG-11507", Continue); + QCOMPARE(object->property("status").toInt(), int(QDeclarativeComponent::Ready)); +} + void tst_qdeclarativeqt::createQmlObject() { QDeclarativeComponent component(&engine, TEST_FILE("createQmlObject.qml")); -- cgit v0.12 From fac227f609e544f8f55aca8447b4328d6534407a Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 17 Jun 2010 07:43:41 +0200 Subject: Speed up calls to QPainter::setCompositionMode when the mode is unchanged Avoid marking the composition mode as dirty and calling into the extended engine if the composition mode that the application wants to set is the same that's currently used. Reviewed-by: Gunnar --- src/gui/painting/qpainter.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index d17c711..71bc990 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2391,6 +2391,8 @@ void QPainter::setCompositionMode(CompositionMode mode) qWarning("QPainter::setCompositionMode: Painter not active"); return; } + if (d->state->composition_mode == mode) + return; if (d->extended) { d->state->composition_mode = mode; d->extended->compositionModeChanged(); -- cgit v0.12 From f8080432e1307c099aee65153870af7c1677ccba Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 17 Jun 2010 16:36:00 +1000 Subject: XmlListModel: Don't lock while doing the slow bit. --- src/declarative/util/qdeclarativexmllistmodel.cpp | 71 +++++++++++++---------- 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/src/declarative/util/qdeclarativexmllistmodel.cpp b/src/declarative/util/qdeclarativexmllistmodel.cpp index 4adef25..bfd25be 100644 --- a/src/declarative/util/qdeclarativexmllistmodel.cpp +++ b/src/declarative/util/qdeclarativexmllistmodel.cpp @@ -148,6 +148,7 @@ public: QDeclarativeXmlQuery(QObject *parent=0) : QThread(parent), m_quit(false), m_abortQueryId(-1), m_queryIds(XMLLISTMODEL_CLEAR_ID + 1) { qRegisterMetaType("QDeclarativeXmlQueryResult"); + m_currentJob.queryId = -1; } ~QDeclarativeXmlQuery() { @@ -161,6 +162,13 @@ public: void abort(int id) { QMutexLocker locker(&m_mutex); + QQueue::iterator it; + for (it = m_jobs.begin(); it != m_jobs.end(); ++it) { + if ((*it).queryId == id) { + m_jobs.erase(it); + return; + } + } m_abortQueryId = id; } @@ -188,7 +196,7 @@ public: m_queryIds++; if (!isRunning()) - start(); + start(QThread::IdlePriority); else m_condition.wakeOne(); return job.queryId; @@ -202,24 +210,28 @@ protected: void run() { while (!m_quit) { m_mutex.lock(); - doQueryJob(); - doSubQueryJob(); + if (!m_jobs.isEmpty()) + m_currentJob = m_jobs.dequeue(); m_mutex.unlock(); - m_mutex.lock(); - const XmlQueryJob &job = m_jobs.dequeue(); - if (m_abortQueryId != job.queryId) { - QDeclarativeXmlQueryResult r; - r.queryId = job.queryId; + QDeclarativeXmlQueryResult r; + if (m_currentJob.queryId != -1) { + doQueryJob(); + doSubQueryJob(); + r.queryId = m_currentJob.queryId; r.size = m_size; r.data = m_modelData; r.inserted = m_insertedItemRanges; r.removed = m_removedItemRanges; - r.keyRoleResultsCache = job.keyRoleResultsCache; - emit queryCompleted(r); + r.keyRoleResultsCache = m_currentJob.keyRoleResultsCache; } + + m_mutex.lock(); + if (m_currentJob.queryId != -1 && m_abortQueryId != m_currentJob.queryId) + emit queryCompleted(r); if (m_jobs.isEmpty()) m_condition.wait(&m_mutex); + m_currentJob.queryId = -1; m_abortQueryId = -1; m_mutex.unlock(); } @@ -235,6 +247,7 @@ private: QMutex m_mutex; QWaitCondition m_condition; QQueue m_jobs; + XmlQueryJob m_currentJob; bool m_quit; int m_abortQueryId; QString m_prefix; @@ -249,15 +262,14 @@ Q_GLOBAL_STATIC(QDeclarativeXmlQuery, globalXmlQuery) void QDeclarativeXmlQuery::doQueryJob() { - Q_ASSERT(!m_jobs.isEmpty()); - XmlQueryJob &job = m_jobs.head(); + Q_ASSERT(m_currentJob.queryId != -1); QString r; QXmlQuery query; - QBuffer buffer(&job.data); + QBuffer buffer(&m_currentJob.data); buffer.open(QIODevice::ReadOnly); query.bindVariable(QLatin1String("src"), &buffer); - query.setQuery(job.namespaces + job.query); + query.setQuery(m_currentJob.namespaces + m_currentJob.query); query.evaluateTo(&r); //always need a single root element @@ -265,9 +277,9 @@ void QDeclarativeXmlQuery::doQueryJob() QBuffer b(&xml); b.open(QIODevice::ReadOnly); - QString namespaces = QLatin1String("declare namespace dummy=\"http://qtsotware.com/dummy\";\n") + job.namespaces; + QString namespaces = QLatin1String("declare namespace dummy=\"http://qtsotware.com/dummy\";\n") + m_currentJob.namespaces; QString prefix = QLatin1String("doc($inputDocument)/dummy:items") + - job.query.mid(job.query.lastIndexOf(QLatin1Char('/'))); + m_currentJob.query.mid(m_currentJob.query.lastIndexOf(QLatin1Char('/'))); //figure out how many items we are dealing with int count = -1; @@ -282,7 +294,7 @@ void QDeclarativeXmlQuery::doQueryJob() count = item.toAtomicValue().toInt(); } - job.data = xml; + m_currentJob.data = xml; m_prefix = namespaces + prefix + QLatin1Char('/'); m_size = 0; if (count > 0) @@ -291,9 +303,9 @@ void QDeclarativeXmlQuery::doQueryJob() void QDeclarativeXmlQuery::getValuesOfKeyRoles(QStringList *values, QXmlQuery *query) const { - Q_ASSERT(!m_jobs.isEmpty()); + Q_ASSERT(m_currentJob.queryId != -1); - const QStringList &keysQueries = m_jobs.head().keyRoleQueries; + const QStringList &keysQueries = m_currentJob.keyRoleQueries; QString keysQuery; if (keysQueries.count() == 1) keysQuery = m_prefix + keysQueries[0]; @@ -323,11 +335,10 @@ void QDeclarativeXmlQuery::addIndexToRangeList(QList * void QDeclarativeXmlQuery::doSubQueryJob() { - Q_ASSERT(!m_jobs.isEmpty()); - XmlQueryJob &job = m_jobs.head(); + Q_ASSERT(m_currentJob.queryId != -1); m_modelData.clear(); - QBuffer b(&job.data); + QBuffer b(&m_currentJob.data); b.open(QIODevice::ReadOnly); QXmlQuery subquery; @@ -340,16 +351,16 @@ void QDeclarativeXmlQuery::doSubQueryJob() m_insertedItemRanges.clear(); m_removedItemRanges.clear(); - if (job.keyRoleResultsCache.isEmpty()) { + if (m_currentJob.keyRoleResultsCache.isEmpty()) { m_insertedItemRanges << qMakePair(0, m_size); } else { - if (keyRoleResults != job.keyRoleResultsCache) { + if (keyRoleResults != m_currentJob.keyRoleResultsCache) { QStringList temp; - for (int i=0; i resultList; if (!queries[i].isEmpty()) { @@ -378,7 +389,7 @@ void QDeclarativeXmlQuery::doSubQueryJob() item = resultItems.next(); } } else { - emit error(job.roleQueryErrorId.at(i), queries[i]); + emit error(m_currentJob.roleQueryErrorId.at(i), queries[i]); } } //### should warn here if things have gone wrong. -- cgit v0.12 From f0c02624791441d45cc8b2f084505cfc5add7237 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 17 Jun 2010 16:50:10 +1000 Subject: BorderImage is not updated when border values change Task-number: QTBUG-11509 Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativeborderimage.cpp | 5 +++++ src/declarative/graphicsitems/qdeclarativeborderimage_p.h | 1 + src/declarative/graphicsitems/qdeclarativeborderimage_p_p.h | 11 ++++++++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp index cf458da..d4ca9eb 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeborderimage.cpp @@ -449,6 +449,11 @@ void QDeclarativeBorderImage::sciRequestFinished() } } +void QDeclarativeBorderImage::doUpdate() +{ + update(); +} + void QDeclarativeBorderImage::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { Q_D(QDeclarativeBorderImage); diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h index 5e725ca..07f049e 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage_p.h +++ b/src/declarative/graphicsitems/qdeclarativeborderimage_p.h @@ -91,6 +91,7 @@ private: void setGridScaledImage(const QDeclarativeGridScaledImage& sci); private Q_SLOTS: + void doUpdate(); void requestFinished(); void sciRequestFinished(); diff --git a/src/declarative/graphicsitems/qdeclarativeborderimage_p_p.h b/src/declarative/graphicsitems/qdeclarativeborderimage_p_p.h index 3535109..01e4a00 100644 --- a/src/declarative/graphicsitems/qdeclarativeborderimage_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativeborderimage_p_p.h @@ -77,11 +77,20 @@ public: { } + QDeclarativeScaleGrid *getScaleGrid() { Q_Q(QDeclarativeBorderImage); - if (!border) + if (!border) { border = new QDeclarativeScaleGrid(q); + static int borderChangedSignalIdx = -1; + static int doUpdateSlotIdx = -1; + if (borderChangedSignalIdx < 0) + borderChangedSignalIdx = QDeclarativeScaleGrid::staticMetaObject.indexOfSignal("borderChanged()"); + if (doUpdateSlotIdx < 0) + doUpdateSlotIdx = QDeclarativeBorderImage::staticMetaObject.indexOfSlot("doUpdate()"); + QMetaObject::connect(border, borderChangedSignalIdx, q, doUpdateSlotIdx); + } return border; } -- cgit v0.12 From 594900e68f8e264facbe8c75eaf2b857240bc072 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Thu, 17 Jun 2010 09:11:18 +0200 Subject: Doc: Specified QAbstractEventDispatcher::filterEvent()'s argument types. Task-number: QTBUG-10904 Reviewed-by: Morten Engvoldsen --- src/corelib/kernel/qabstracteventdispatcher.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/corelib/kernel/qabstracteventdispatcher.cpp b/src/corelib/kernel/qabstracteventdispatcher.cpp index ee3c4f2..bcf4477 100644 --- a/src/corelib/kernel/qabstracteventdispatcher.cpp +++ b/src/corelib/kernel/qabstracteventdispatcher.cpp @@ -393,6 +393,27 @@ void QAbstractEventDispatcher::closingDown() \snippet doc/src/snippets/code/src_corelib_kernel_qabstracteventdispatcher.cpp 0 + Note that the type of the \a message is platform dependent. The + following table shows the \a {message}'s type on Windows, Mac, and + X11. You can do a static cast to these types. + + \table + \header + \o Platform + \o type + \row + \o Windows + \o MSG + \row + \o X11 + \o XEvent + \row + \o Mac + \o NSEvent + \endtable + + + \sa setEventFilter(), filterEvent() */ @@ -434,6 +455,9 @@ QAbstractEventDispatcher::EventFilter QAbstractEventDispatcher::setEventFilter(E compatibility with any extensions that may be used in the application. + Note that the type of \a message is platform dependent. See + QAbstractEventDispatcher::EventFilter for details. + \sa setEventFilter() */ bool QAbstractEventDispatcher::filterEvent(void *message) -- cgit v0.12 From 5cc37fcec3d75f6a8d0ce58ab724916795aff0aa Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 17 Jun 2010 18:14:32 +1000 Subject: doc: couple more performance tips. --- doc/src/declarative/qdeclarativeperformance.qdoc | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/src/declarative/qdeclarativeperformance.qdoc b/doc/src/declarative/qdeclarativeperformance.qdoc index b535e4b..c866724 100644 --- a/doc/src/declarative/qdeclarativeperformance.qdoc +++ b/doc/src/declarative/qdeclarativeperformance.qdoc @@ -117,4 +117,16 @@ a Loader as needed. \o Fast data access - ensure the data model is as fast as possible. \endlist +\section1 Image resources over composition + +If possible, provide a single image resource, rather than using composition +of a number of elements. For example, a frame with a shadow could be created using +a Rectangle placed over an Image providing the shadow. It is more efficient to +provide an image that includes the frame and the shadow. + +\section1 Limit JavaScript + +Avoid running JavaScript during animation. For example, running a complex +JavaScript expression for each frame of an x property animation. + */ -- cgit v0.12 From 3b6d5bcc0ef8186608be8f27bfd4c816b0cc86bb Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Thu, 17 Jun 2010 18:15:44 +1000 Subject: doc: improve Repeater model docs. --- src/declarative/graphicsitems/qdeclarativerepeater.cpp | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativerepeater.cpp b/src/declarative/graphicsitems/qdeclarativerepeater.cpp index 995e22a..87da904 100644 --- a/src/declarative/graphicsitems/qdeclarativerepeater.cpp +++ b/src/declarative/graphicsitems/qdeclarativerepeater.cpp @@ -83,17 +83,10 @@ QDeclarativeRepeaterPrivate::~QDeclarativeRepeaterPrivate() \image repeater-simple.png - The \l model of a Repeater can be specified as a model object, a number, a string list - or an object list. If a model object is used, the - \l delegate can access the model roles as named properties, just as for view elements like - ListView and GridView. + The \l model of a Repeater can be any of the supported \l {qmlmodels}{Data Models}. - The \l delegate can also access two additional properties: - - \list - \o \c index - the index of the delegate's item - \o \c modelData - the data element for the delegate, which is useful where the \l model is a string or object list - \endlist + The index of a delegate is exposed as an accessible \c index property in the delegate. + Properties of the model are also available depending upon the type of \l {qmlmodels}{Data Model}. Here is a Repeater that uses the \c index property inside the instantiated items: -- cgit v0.12 From e4fbdd4fde9b8d2acc13268b44caa57405c3db1a Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 17 Jun 2010 10:24:49 +0200 Subject: Typo in qcleanlooksstyle.cpp Task-number: QTBUG-11506 --- src/gui/styles/qcleanlooksstyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp index 883f511..ada5293 100644 --- a/src/gui/styles/qcleanlooksstyle.cpp +++ b/src/gui/styles/qcleanlooksstyle.cpp @@ -884,7 +884,7 @@ void QCleanlooksStyle::drawPrimitive(PrimitiveElement elem, } painter->restore(); break; -#ifndef QT_NO_LINEDIT +#ifndef QT_NO_LINEEDIT case PE_FrameLineEdit: // fall through #endif // QT_NO_LINEEDIT -- cgit v0.12 From 8af2f7b5085ee56d289584bddbccc8dead04b9d1 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Thu, 17 Jun 2010 10:43:32 +0200 Subject: Fix possible crash in QTextLayout for glyphless items Change e1915815bc5ef86b3844608bba46769da5173363 moved part of the right bearing check out of the "non-whitespace-or-object" block of the layout, which could potentially cause crashes for layouts that contained items that were line separators or tabs etc. because we would access the logical clusters array based on the position of e.g. the tab even though it didn't have an entry. This could potentially give us an arbitrary index which might cause an out of bounds when accessing the glyphs array. Task-number: QTBUG-11427 Reviewed-by: Simon Hausmann --- src/gui/text/qtextlayout.cpp | 14 +++++++++++--- tests/auto/qtextlayout/tst_qtextlayout.cpp | 19 +++++++++++++++++++ 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index c5dd854..34272cc 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1646,7 +1646,7 @@ namespace { { LineBreakHelper() : glyphCount(0), maxGlyphs(0), currentPosition(0), fontEngine(0), logClusters(0), - manualWrap(false) + manualWrap(false), whiteSpaceOrObject(true) { } @@ -1669,6 +1669,7 @@ namespace { const unsigned short *logClusters; bool manualWrap; + bool whiteSpaceOrObject; bool checkFullOtherwiseExtend(QScriptLine &line); @@ -1678,8 +1679,10 @@ namespace { } inline glyph_t currentGlyph() const - { + { Q_ASSERT(currentPosition > 0); + Q_ASSERT(logClusters[currentPosition - 1] < glyphs.numGlyphs); + return glyphs.glyphs[logClusters[currentPosition - 1]]; } @@ -1814,6 +1817,7 @@ void QTextLine::layout_helper(int maxGlyphs) lbh.tmpData.descent = qMax(lbh.tmpData.descent, current.descent); if (current.analysis.flags == QScriptAnalysis::Tab && (alignment & (Qt::AlignLeft | Qt::AlignRight | Qt::AlignCenter | Qt::AlignJustify))) { + lbh.whiteSpaceOrObject = true; if (lbh.checkFullOtherwiseExtend(line)) goto found; @@ -1830,6 +1834,7 @@ void QTextLine::layout_helper(int maxGlyphs) if (lbh.checkFullOtherwiseExtend(line)) goto found; } else if (current.analysis.flags == QScriptAnalysis::LineOrParagraphSeparator) { + lbh.whiteSpaceOrObject = true; // if the line consists only of the line separator make sure // we have a sane height if (!line.length && !lbh.tmpData.length) @@ -1843,6 +1848,7 @@ void QTextLine::layout_helper(int maxGlyphs) line += lbh.tmpData; goto found; } else if (current.analysis.flags == QScriptAnalysis::Object) { + lbh.whiteSpaceOrObject = true; lbh.tmpData.length++; QTextFormat format = eng->formats()->format(eng->formatIndex(&eng->layoutData->items[item])); @@ -1856,6 +1862,7 @@ void QTextLine::layout_helper(int maxGlyphs) if (lbh.checkFullOtherwiseExtend(line)) goto found; } else if (attributes[lbh.currentPosition].whiteSpace) { + lbh.whiteSpaceOrObject = true; while (lbh.currentPosition < end && attributes[lbh.currentPosition].whiteSpace) addNextCluster(lbh.currentPosition, end, lbh.spaceData, lbh.glyphCount, current, lbh.logClusters, lbh.glyphs); @@ -1865,6 +1872,7 @@ void QTextLine::layout_helper(int maxGlyphs) goto found; } } else { + lbh.whiteSpaceOrObject = false; bool sb_or_ws = false; do { addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount, @@ -1926,7 +1934,7 @@ void QTextLine::layout_helper(int maxGlyphs) LB_DEBUG("reached end of line"); lbh.checkFullOtherwiseExtend(line); found: - if (lbh.rightBearing > 0) // If right bearing has not yet been adjusted + if (lbh.rightBearing > 0 && !lbh.whiteSpaceOrObject) // If right bearing has not yet been adjusted lbh.adjustRightBearing(); line.textAdvance = line.textWidth; line.textWidth -= qMin(QFixed(), lbh.rightBearing); diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index caf9bd3..6d27ef2 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -110,6 +110,7 @@ private slots: void longText(); void widthOfTabs(); void columnWrapWithTabs(); + void glyphLessItems(); // QTextLine stuff void setNumColumnsWrapAtWordBoundaryOrAnywhere(); @@ -1319,6 +1320,24 @@ void tst_QTextLayout::lineWidthFromBOM() // Don't spin into an infinite loop } +void tst_QTextLayout::glyphLessItems() +{ + { + QTextLayout layout; + layout.setText("\t\t"); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + } + + { + QTextLayout layout; + layout.setText(QString::fromLatin1("AA") + QChar(QChar::LineSeparator)); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + } +} QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From cf74e83d8b79c4840c073bb7dc387045b1210df8 Mon Sep 17 00:00:00 2001 From: Geir Vattekar Date: Thu, 17 Jun 2010 11:14:59 +0200 Subject: Doc: Small change to QAbstractItemDelegate::editorEvent() Task-number: QTBUG-2446 Reviewed-by: Marius Bugge Monsen --- src/gui/itemviews/qabstractitemdelegate.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/gui/itemviews/qabstractitemdelegate.cpp b/src/gui/itemviews/qabstractitemdelegate.cpp index 775bf7d..0ea6d67 100644 --- a/src/gui/itemviews/qabstractitemdelegate.cpp +++ b/src/gui/itemviews/qabstractitemdelegate.cpp @@ -291,8 +291,14 @@ void QAbstractItemDelegate::updateEditorGeometry(QWidget *, } /*! - Whenever an event occurs, this function is called with the \a event - \a model \a option and the \a index that corresponds to the item being edited. + When editing of an item starts, this function is called with the + \a event that triggered the editing, the \a model, the \a index of + the item, and the \a option used for rendering the item. + + Mouse events are sent to editorEvent() even if they don't start + editing of the item. This can, for instance, be useful if you wish + to open a context menu when the right mouse button is pressed on + an item. The base implementation returns false (indicating that it has not handled the event). -- cgit v0.12 From 8fe1b2baf562df50e7b5cd7b4ea23bc5545ee80f Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Thu, 17 Jun 2010 12:13:14 +0200 Subject: Fix event forwarding in QDeclarativeFlickable. The flickable element filters all events of its children and store the press event to replay it if there is a release or if the scrolling didn't happen. The issue was that the event and the item stored to "replay" the press event might not be the item that is interessted by the event. Let say you have a translucent overlay on top of an other item. Previously all events will be send to the overlay and not to the item underneath. This happen beause QGraphicsView propagate events from top to bottom (stacking order) so the overlay will be the first child filtered by the flickable. So we need to repropagate the event through the normal process to the event delivery mechanism of QGraphicsView will work properly. Also we need to unset the mouse grabber since after the first press it might be set to a wrong item. We also need to replay the release by ourself on the new mouse grabber but only if we need to send again the press. Reviewed-by:Yann Bodson --- .../graphicsitems/qdeclarativeflickable.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 6dfd4d9..3f681b7 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -914,8 +914,14 @@ void QDeclarativeFlickable::timerEvent(QTimerEvent *event) d->delayedPressTimer.stop(); if (d->delayedPressEvent) { QDeclarativeItem *grabber = scene() ? qobject_cast(scene()->mouseGrabberItem()) : 0; - if (!grabber || grabber != this) - scene()->sendEvent(d->delayedPressTarget, d->delayedPressEvent); + if (!grabber || grabber != this) { + // We replay the mouse press but the grabber we had might not be interessted by the event (e.g. overlay) + // so we reset the grabber + if (scene()->mouseGrabberItem() == d->delayedPressTarget) + d->delayedPressTarget->ungrabMouse(); + //Use the event handler that will take care of finding the proper item to propagate the event + QApplication::sendEvent(scene(), d->delayedPressEvent); + } delete d->delayedPressEvent; d->delayedPressEvent = 0; } @@ -1206,8 +1212,17 @@ bool QDeclarativeFlickable::sendMouseEvent(QGraphicsSceneMouseEvent *event) break; case QEvent::GraphicsSceneMouseRelease: if (d->delayedPressEvent) { - scene()->sendEvent(d->delayedPressTarget, d->delayedPressEvent); + // We replay the mouse press but the grabber we had might not be interessted by the event (e.g. overlay) + // so we reset the grabber + if (s->mouseGrabberItem() == d->delayedPressTarget) + d->delayedPressTarget->ungrabMouse(); + //Use the event handler that will take care of finding the proper item to propagate the event + QApplication::sendEvent(scene(), d->delayedPressEvent); d->clearDelayedPress(); + // We send the release + scene()->sendEvent(s->mouseGrabberItem(), event); + // And the event has been consumed + return true; } d->handleMouseReleaseEvent(&mouseEvent); break; -- cgit v0.12 From 24605a8cd542b44e6ed2bb6dbb7fe12633015853 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Thu, 17 Jun 2010 12:26:02 +0200 Subject: Updated WebKit to 6623b5da196390748dc619461739f9cb84524736 Integrated changes: || || Make repaint throttling parameters configurable runtime. || || || [Qt] rendering error in mediawiki || || || Spatial Navigation: make it work with focusable elements in overflow content || || || GIFs loop one time too few || || || [Qt] Animated GIF images does not animate 10x as expected by default. || || || [Qt] Image::drawTiled animations does not work || || || [Qt] QtWebKit crashes while initializing flash plugin 10.1.53.64... || || || Spatial Navigation: using offset{Left,Top} is not enough to get the proper inner frames position || || || Spatial Navigation: refactor scrollInDirection to work with scrollable content || --- src/3rdparty/webkit/.tag | 2 +- src/3rdparty/webkit/ChangeLog | 13 ++ src/3rdparty/webkit/JavaScriptCore/ChangeLog | 13 ++ src/3rdparty/webkit/VERSION | 2 +- src/3rdparty/webkit/WebCore/ChangeLog | 201 +++++++++++++++++++++ .../webkit/WebCore/page/FocusController.cpp | 176 +++++++++++------- src/3rdparty/webkit/WebCore/page/FrameView.cpp | 54 ++++-- src/3rdparty/webkit/WebCore/page/FrameView.h | 14 ++ .../webkit/WebCore/page/SpatialNavigation.cpp | 25 ++- .../webkit/WebCore/page/SpatialNavigation.h | 7 +- .../platform/graphics/qt/ImageDecoderQt.cpp | 18 +- .../webkit/WebCore/plugins/qt/PluginPackageQt.cpp | 23 +++ src/3rdparty/webkit/WebKit/qt/Api/qwebpage.cpp | 45 ++++- src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.cpp | 7 + src/3rdparty/webkit/WebKit/qt/Api/qwebsettings.h | 3 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 37 ++++ 16 files changed, 541 insertions(+), 99 deletions(-) diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 07a02d7..f5b6af3 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -40c2d6907ef75288b4f15e7fad334b9138acdbbf +6623b5da196390748dc619461739f9cb84524736 diff --git a/src/3rdparty/webkit/ChangeLog b/src/3rdparty/webkit/ChangeLog index c2862fd..51d08a0 100644 --- a/src/3rdparty/webkit/ChangeLog +++ b/src/3rdparty/webkit/ChangeLog @@ -1,3 +1,16 @@ +2010-06-17 Mark Brand + + Reviewed by Simon Hausmann. + + [Qt] use "win32-g++*" scope to match all MinGW makespecs + + The scope "win32-g++" comes from the name of the makespec. However, it + is frequently used to check for MinGW. This works fine as long as + win32-g++ is the only makespec for MinGW. Now we need the wildcard + to cover "win32-g++-cross" as well. + + * WebKit.pri: + 2010-05-04 Laszlo Gombos Unreviewed, build fix for Symbian. diff --git a/src/3rdparty/webkit/JavaScriptCore/ChangeLog b/src/3rdparty/webkit/JavaScriptCore/ChangeLog index d9b2987..adaf390 100644 --- a/src/3rdparty/webkit/JavaScriptCore/ChangeLog +++ b/src/3rdparty/webkit/JavaScriptCore/ChangeLog @@ -1,3 +1,16 @@ +2010-06-17 Mark Brand + + Reviewed by Simon Hausmann. + + [Qt] use "win32-g++*" scope to match all MinGW makespecs + + The scope "win32-g++" comes from the name of the makespec. However, it + is frequently used to check for MinGW. This works fine as long as + win32-g++ is the only makespec for MinGW. Now we need the wildcard + to cover "win32-g++-cross" as well. + + * JavaScriptCore.pro: + 2010-06-07 Benjamin Poulain Reviewed by Simon Hausmann. diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index b648b94..1e7351f 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - 40c2d6907ef75288b4f15e7fad334b9138acdbbf + 6623b5da196390748dc619461739f9cb84524736 diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index 6a7da30..c17a8aa 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,204 @@ +2010-06-17 Mark Brand + + Reviewed by Simon Hausmann. + + [Qt] use "win32-g++*" scope to match all MinGW makespecs + + The scope "win32-g++" comes from the name of the makespec. However, it + is frequently used to check for MinGW. This works fine as long as + win32-g++ is the only makespec for MinGW. Now we need the wildcard + to cover "win32-g++-cross" as well. + + * WebCore.pro: + +2010-06-16 Antonio Gomes + + Reviewed by Kenneth Christiansen. + + Spatial Navigation: using offset{Left,Top} is not enough to get the proper inner frames position + https://bugs.webkit.org/show_bug.cgi?id=39439 + + As pointed out by Darin Adler in https://bugs.webkit.org/show_bug.cgi?id=18662#c20, + "It's not correct to use the offsetLeft and offsetTop of the frame owner element's renderer because + that's just the distance from the offsetParent, not the absolute position". + + Patch fixes that behavior by now considering the offsetTop and offsetLeft the offsetParent recursively, + starting from the HtmlFrameOwnerElement. Previously, only calling offsetTop and offsetLeft works + because all tests were done in htmls where the {i}frame element was a directly a child of the body, + e.g. ...