From 539ef45689e0d038b6cd83d772597a5be886d8ff Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Mon, 8 Oct 2012 16:51:41 +0300 Subject: [PATCH 01/84] Update/fix QTextBoundaryFinder simple usage cases in qtbase Change-Id: I4d3000558bce86e2de3c32247915868ba18fc8b7 Reviewed-by: Konstantin Ritt Reviewed-by: Lars Knoll --- src/gui/text/qtextengine.cpp | 20 +++++++++---------- .../accessible/widgets/qaccessiblewidgets.cpp | 2 +- .../windows/qwindowsinputcontext.cpp | 6 +----- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 8527a85369..cff1487278 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -157,27 +157,27 @@ private: m_splitter->setPosition(start); QScriptAnalysis itemAnalysis = m_analysis[start]; - if (m_splitter->boundaryReasons() & QTextBoundaryFinder::StartWord) { + if (m_splitter->boundaryReasons() & QTextBoundaryFinder::StartOfItem) itemAnalysis.flags = QScriptAnalysis::Uppercase; - m_splitter->toNextBoundary(); - } + + m_splitter->toNextBoundary(); const int end = start + length; for (int i = start + 1; i < end; ++i) { - - bool atWordBoundary = false; + bool atWordStart = false; if (i == m_splitter->position()) { - if (m_splitter->boundaryReasons() & QTextBoundaryFinder::StartWord - && m_analysis[i].flags < QScriptAnalysis::TabOrObject) - atWordBoundary = true; + if (m_splitter->boundaryReasons() & QTextBoundaryFinder::StartOfItem) { + Q_ASSERT(m_analysis[i].flags < QScriptAnalysis::TabOrObject); + atWordStart = true; + } m_splitter->toNextBoundary(); } if (m_analysis[i] == itemAnalysis && m_analysis[i].flags < QScriptAnalysis::TabOrObject - && !atWordBoundary + && !atWordStart && i - start < MaxItemLength) continue; @@ -185,7 +185,7 @@ private: start = i; itemAnalysis = m_analysis[start]; - if (atWordBoundary) + if (atWordStart) itemAnalysis.flags = QScriptAnalysis::Uppercase; } m_items.append(QScriptItem(start, itemAnalysis)); diff --git a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp index 5f3f0bc3de..ad5ef69da4 100644 --- a/src/plugins/accessible/widgets/qaccessiblewidgets.cpp +++ b/src/plugins/accessible/widgets/qaccessiblewidgets.cpp @@ -949,7 +949,7 @@ QPair< int, int > QAccessibleTextWidget::getBoundaries(int offset, BoundaryType sentenceFinder.setPosition(offsetWithinBlockText); int prevBoundary = offsetWithinBlockText; int nextBoundary = offsetWithinBlockText; - if (!sentenceFinder.isAtBoundary()) + if (!(sentenceFinder.boundaryReasons() & QTextBoundaryFinder::StartOfItem)) prevBoundary = sentenceFinder.toPreviousBoundary(); nextBoundary = sentenceFinder.toNextBoundary(); if (nextBoundary != -1) diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index 8b3d6749a0..11fd740009 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -560,12 +560,8 @@ int QWindowsInputContext::reconvertString(RECONVERTSTRING *reconv) // Find the word in the surrounding text. QTextBoundaryFinder bounds(QTextBoundaryFinder::Word, surroundingText); bounds.setPosition(pos); - if (bounds.isAtBoundary()) { - if (QTextBoundaryFinder::EndWord == bounds.boundaryReasons()) - bounds.toPreviousBoundary(); - } else { + if (bounds.position() > 0 && !(bounds.boundaryReasons() & QTextBoundaryFinder::StartOfItem)) bounds.toPreviousBoundary(); - } const int startPos = bounds.position(); bounds.toNextBoundary(); const int endPos = bounds.position(); From 4717d36c9110f016868e37d9eff74b1d28af5a9c Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Sat, 6 Oct 2012 02:53:44 +0300 Subject: [PATCH 02/84] Fix QTextBoundaryFinder usage cases in QAccessible2 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make the implementation safer and closer to what http://www.linuxfoundation.org/collaborate/workgroups/accessibility/ia2/ia2_implementation_guide#boundaries requires us to do. Change-Id: I00af4697e52a9b6e7f5d7b3f403b29126fa1517b Reviewed-by: Konstantin Ritt Reviewed-by: Lars Knoll Reviewed-by: Jan Arve Sæther --- src/gui/accessible/qaccessible2.cpp | 288 +++++++++++------- src/gui/accessible/qaccessible2.h | 8 +- .../accessible/widgets/simplewidgets.cpp | 13 +- .../qaccessibility/tst_qaccessibility.cpp | 1 + 4 files changed, 179 insertions(+), 131 deletions(-) diff --git a/src/gui/accessible/qaccessible2.cpp b/src/gui/accessible/qaccessible2.cpp index e3402ef2e5..7f871f9c5a 100644 --- a/src/gui/accessible/qaccessible2.cpp +++ b/src/gui/accessible/qaccessible2.cpp @@ -134,19 +134,184 @@ QT_BEGIN_NAMESPACE */ /*! - \fn QString QAccessibleTextInterface::textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType, - int *startOffset, int *endOffset) const + Returns the text item of type \a boundaryType that is close to offset \a offset + and sets \a startOffset and \a endOffset values to the start and end positions + of that item; returns an empty string if there is no such an item. + Sets \a startOffset and \a endOffset values to -1 on error. */ +QString QAccessibleTextInterface::textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset) const +{ + const QString txt = text(0, characterCount()); + + if (txt.isEmpty() || offset < 0 || offset > txt.length()) { + *startOffset = *endOffset = -1; + return QString(); + } + if (offset == 0) { + *startOffset = *endOffset = offset; + return QString(); + } + + QTextBoundaryFinder::BoundaryType type; + switch (boundaryType) { + case QAccessible2::CharBoundary: + type = QTextBoundaryFinder::Grapheme; + break; + case QAccessible2::WordBoundary: + type = QTextBoundaryFinder::Word; + break; + case QAccessible2::SentenceBoundary: + type = QTextBoundaryFinder::Sentence; + break; + default: + // in any other case return the whole line + *startOffset = 0; + *endOffset = txt.length(); + return txt; + } + + // keep behavior in sync with QTextCursor::movePosition()! + + QTextBoundaryFinder boundary(type, txt); + boundary.setPosition(offset); + + do { + if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) + break; + } while (boundary.toPreviousBoundary() > 0); + Q_ASSERT(boundary.position() >= 0); + *endOffset = boundary.position(); + + while (boundary.toPreviousBoundary() > 0) { + if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) + break; + } + Q_ASSERT(boundary.position() >= 0); + *startOffset = boundary.position(); + + return txt.mid(*startOffset, *endOffset - *startOffset); +} /*! - \fn QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType, - int *startOffset, int *endOffset) const + Returns the text item of type \a boundaryType that is right after offset \a offset + and sets \a startOffset and \a endOffset values to the start and end positions + of that item; returns an empty string if there is no such an item. + Sets \a startOffset and \a endOffset values to -1 on error. */ +QString QAccessibleTextInterface::textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset) const +{ + const QString txt = text(0, characterCount()); + + if (txt.isEmpty() || offset < 0 || offset > txt.length()) { + *startOffset = *endOffset = -1; + return QString(); + } + if (offset == txt.length()) { + *startOffset = *endOffset = offset; + return QString(); + } + + QTextBoundaryFinder::BoundaryType type; + switch (boundaryType) { + case QAccessible2::CharBoundary: + type = QTextBoundaryFinder::Grapheme; + break; + case QAccessible2::WordBoundary: + type = QTextBoundaryFinder::Word; + break; + case QAccessible2::SentenceBoundary: + type = QTextBoundaryFinder::Sentence; + break; + default: + // in any other case return the whole line + *startOffset = 0; + *endOffset = txt.length(); + return txt; + } + + // keep behavior in sync with QTextCursor::movePosition()! + + QTextBoundaryFinder boundary(type, txt); + boundary.setPosition(offset); + + while (boundary.toNextBoundary() < txt.length()) { + if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) + break; + } + Q_ASSERT(boundary.position() <= txt.length()); + *startOffset = boundary.position(); + + while (boundary.toNextBoundary() < txt.length()) { + if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) + break; + } + Q_ASSERT(boundary.position() <= txt.length()); + *endOffset = boundary.position(); + + return txt.mid(*startOffset, *endOffset - *startOffset); +} /*! - \fn QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible2::BoundaryType boundaryType, - int *startOffset, int *endOffset) const + Returns the text item of type \a boundaryType at offset \a offset + and sets \a startOffset and \a endOffset values to the start and end positions + of that item; returns an empty string if there is no such an item. + Sets \a startOffset and \a endOffset values to -1 on error. */ +QString QAccessibleTextInterface::textAtOffset(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset) const +{ + const QString txt = text(0, characterCount()); + + if (txt.isEmpty() || offset < 0 || offset > txt.length()) { + *startOffset = *endOffset = -1; + return QString(); + } + if (offset == txt.length()) { + *startOffset = *endOffset = offset; + return QString(); + } + + QTextBoundaryFinder::BoundaryType type; + switch (boundaryType) { + case QAccessible2::CharBoundary: + type = QTextBoundaryFinder::Grapheme; + break; + case QAccessible2::WordBoundary: + type = QTextBoundaryFinder::Word; + break; + case QAccessible2::SentenceBoundary: + type = QTextBoundaryFinder::Sentence; + break; + default: + // in any other case return the whole line + *startOffset = 0; + *endOffset = txt.length(); + return txt; + } + + // keep behavior in sync with QTextCursor::movePosition()! + + QTextBoundaryFinder boundary(type, txt); + boundary.setPosition(offset); + + do { + if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) + break; + } while (boundary.toPreviousBoundary() > 0); + Q_ASSERT(boundary.position() >= 0); + *startOffset = boundary.position(); + + while (boundary.toNextBoundary() < txt.length()) { + if ((boundary.boundaryReasons() & (QTextBoundaryFinder::StartOfItem | QTextBoundaryFinder::EndOfItem))) + break; + } + Q_ASSERT(boundary.position() <= txt.length()); + *endOffset = boundary.position(); + + return txt.mid(*startOffset, *endOffset - *startOffset); +} /*! \fn void QAccessibleTextInterface::removeSelection(int selectionIndex) @@ -512,117 +677,6 @@ const QString &QAccessibleActionInterface::toggleAction() return accessibleActionStrings()->toggleAction; } - -/*! - \internal -*/ -QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, - int *startOffset, int *endOffset, const QString& text) -{ - QTextBoundaryFinder::BoundaryType type; - switch (boundaryType) { - case QAccessible2::CharBoundary: - type = QTextBoundaryFinder::Grapheme; - break; - case QAccessible2::WordBoundary: - type = QTextBoundaryFinder::Word; - break; - case QAccessible2::SentenceBoundary: - type = QTextBoundaryFinder::Sentence; - break; - default: - // in any other case return the whole line - *startOffset = 0; - *endOffset = text.length(); - return text; - } - - QTextBoundaryFinder boundary(type, text); - boundary.setPosition(offset); - - if (!boundary.isAtBoundary()) { - boundary.toPreviousBoundary(); - } - boundary.toPreviousBoundary(); - *startOffset = boundary.position(); - boundary.toNextBoundary(); - *endOffset = boundary.position(); - - return text.mid(*startOffset, *endOffset - *startOffset); -} - -/*! - \internal -*/ -QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, - int *startOffset, int *endOffset, const QString& text) -{ - QTextBoundaryFinder::BoundaryType type; - switch (boundaryType) { - case QAccessible2::CharBoundary: - type = QTextBoundaryFinder::Grapheme; - break; - case QAccessible2::WordBoundary: - type = QTextBoundaryFinder::Word; - break; - case QAccessible2::SentenceBoundary: - type = QTextBoundaryFinder::Sentence; - break; - default: - // in any other case return the whole line - *startOffset = 0; - *endOffset = text.length(); - return text; - } - - QTextBoundaryFinder boundary(type, text); - boundary.setPosition(offset); - - boundary.toNextBoundary(); - *startOffset = boundary.position(); - boundary.toNextBoundary(); - *endOffset = boundary.position(); - - return text.mid(*startOffset, *endOffset - *startOffset); -} - -/*! - \internal -*/ -QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, - int *startOffset, int *endOffset, const QString& text) -{ - QTextBoundaryFinder::BoundaryType type; - switch (boundaryType) { - case QAccessible2::CharBoundary: - type = QTextBoundaryFinder::Grapheme; - break; - case QAccessible2::WordBoundary: - type = QTextBoundaryFinder::Word; - break; - case QAccessible2::SentenceBoundary: - type = QTextBoundaryFinder::Sentence; - break; - default: - // in any other case return the whole line - *startOffset = 0; - *endOffset = text.length(); - return text; - } - - QTextBoundaryFinder boundary(type, text); - boundary.setPosition(offset); - - if (!boundary.isAtBoundary()) { - boundary.toPreviousBoundary(); - } - *startOffset = boundary.position(); - boundary.toNextBoundary(); - *endOffset = boundary.position(); - - return text.mid(*startOffset, *endOffset - *startOffset); -} - QT_END_NAMESPACE #endif // QT_NO_ACCESSIBILITY diff --git a/src/gui/accessible/qaccessible2.h b/src/gui/accessible/qaccessible2.h index ee0215ecf3..c1e7b8b5a2 100644 --- a/src/gui/accessible/qaccessible2.h +++ b/src/gui/accessible/qaccessible2.h @@ -83,12 +83,12 @@ public: // text virtual QString text(int startOffset, int endOffset) const = 0; - virtual QString textBeforeOffset (int offset, QAccessible2::BoundaryType boundaryType, - int *startOffset, int *endOffset) const = 0; + virtual QString textBeforeOffset(int offset, QAccessible2::BoundaryType boundaryType, + int *startOffset, int *endOffset) const; virtual QString textAfterOffset(int offset, QAccessible2::BoundaryType boundaryType, - int *startOffset, int *endOffset) const = 0; + int *startOffset, int *endOffset) const; virtual QString textAtOffset(int offset, QAccessible2::BoundaryType boundaryType, - int *startOffset, int *endOffset) const = 0; + int *startOffset, int *endOffset) const; virtual int characterCount() const = 0; // character <-> geometry diff --git a/src/plugins/accessible/widgets/simplewidgets.cpp b/src/plugins/accessible/widgets/simplewidgets.cpp index 2015929010..bb90061a7e 100644 --- a/src/plugins/accessible/widgets/simplewidgets.cpp +++ b/src/plugins/accessible/widgets/simplewidgets.cpp @@ -72,13 +72,6 @@ extern QList childWidgets(const QWidget *widget, bool includeTopLevel QString Q_GUI_EXPORT qt_accStripAmp(const QString &text); QString Q_GUI_EXPORT qt_accHotKey(const QString &text); -QString Q_GUI_EXPORT qTextBeforeOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, - int *startOffset, int *endOffset, const QString& text); -QString Q_GUI_EXPORT qTextAtOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, - int *startOffset, int *endOffset, const QString& text); -QString Q_GUI_EXPORT qTextAfterOffsetFromString(int offset, QAccessible2::BoundaryType boundaryType, - int *startOffset, int *endOffset, const QString& text); - /*! \class QAccessibleButton \brief The QAccessibleButton class implements the QAccessibleInterface for button type widgets. @@ -725,7 +718,7 @@ QString QAccessibleLineEdit::textBeforeOffset(int offset, BoundaryType boundaryT *startOffset = *endOffset = -1; return QString(); } - return qTextBeforeOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text()); + return QAccessibleTextInterface::textBeforeOffset(offset, boundaryType, startOffset, endOffset); } QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryType, @@ -735,7 +728,7 @@ QString QAccessibleLineEdit::textAfterOffset(int offset, BoundaryType boundaryTy *startOffset = *endOffset = -1; return QString(); } - return qTextAfterOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text()); + return QAccessibleTextInterface::textAfterOffset(offset, boundaryType, startOffset, endOffset); } QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType, @@ -745,7 +738,7 @@ QString QAccessibleLineEdit::textAtOffset(int offset, BoundaryType boundaryType, *startOffset = *endOffset = -1; return QString(); } - return qTextAtOffsetFromString(offset, boundaryType, startOffset, endOffset, lineEdit()->text()); + return QAccessibleTextInterface::textAtOffset(offset, boundaryType, startOffset, endOffset); } void QAccessibleLineEdit::removeSelection(int selectionIndex) diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 1b789b26ae..0166d592a6 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -1885,6 +1885,7 @@ void tst_QAccessibility::lineEditTest() QCOMPARE(textIface->textAtOffset(8, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1(" ")); QCOMPARE(textIface->textAtOffset(25, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1("advice")); QCOMPARE(textIface->textAtOffset(92, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1("oneself")); + QCOMPARE(textIface->textAtOffset(101, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1(". --")); QCOMPARE(textIface->textBeforeOffset(5, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1(" ")); QCOMPARE(textIface->textAfterOffset(5, QAccessible2::WordBoundary,&start,&end), QString::fromLatin1(" ")); From ec4593d6d06b6b6de5cd26cf66d5c6a866231251 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Thu, 11 Oct 2012 06:23:32 +0300 Subject: [PATCH 03/84] QGlyphRun: Fix isEmpty() and boundingRect() didn't work after setRawData() Change-Id: I44a347ef24961493d6b8353abbb215c713ccce52 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qglyphrun.cpp | 10 ++-- .../auto/gui/text/qglyphrun/tst_qglyphrun.cpp | 46 +++++++++++++++++++ 2 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/gui/text/qglyphrun.cpp b/src/gui/text/qglyphrun.cpp index 48e0b15c85..f46e86e88c 100644 --- a/src/gui/text/qglyphrun.cpp +++ b/src/gui/text/qglyphrun.cpp @@ -473,15 +473,15 @@ void QGlyphRun::setBoundingRect(const QRectF &boundingRect) */ QRectF QGlyphRun::boundingRect() const { - if (!d->boundingRect.isEmpty()) + if (!d->boundingRect.isEmpty() || !d->rawFont.isValid()) return d->boundingRect; qreal minX, minY, maxX, maxY; minX = minY = maxX = maxY = 0; - for (int i=0; iglyphPositions.size(), d->glyphIndexes.size()); ++i) { - QRectF glyphRect = d->rawFont.boundingRect(d->glyphIndexes.at(i)); - glyphRect.translate(d->glyphPositions.at(i)); + for (int i = 0, n = qMin(d->glyphIndexDataSize, d->glyphPositionDataSize); i < n; ++i) { + QRectF glyphRect = d->rawFont.boundingRect(d->glyphIndexData[i]); + glyphRect.translate(d->glyphPositionData[i]); if (i == 0) { minX = glyphRect.left(); @@ -506,7 +506,7 @@ QRectF QGlyphRun::boundingRect() const */ bool QGlyphRun::isEmpty() const { - return d->glyphIndexes.isEmpty(); + return d->glyphIndexDataSize == 0; } QT_END_NAMESPACE diff --git a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp index d982428706..024559448c 100644 --- a/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp +++ b/tests/auto/gui/text/qglyphrun/tst_qglyphrun.cpp @@ -63,6 +63,7 @@ private slots: void assignment(); void equalsOperator_data(); void equalsOperator(); + void isEmpty(); void textLayoutGlyphIndexes(); void drawExistingGlyphs(); void drawNonExistentGlyphs(); @@ -75,6 +76,7 @@ private slots: void detach(); void setRawData(); void setRawDataAndGetAsVector(); + void boundingRect(); private: int m_testFontId; @@ -235,6 +237,22 @@ void tst_QGlyphRun::equalsOperator() QCOMPARE(one != two, !equals); } +void tst_QGlyphRun::isEmpty() +{ + QGlyphRun glyphs; + QVERIFY(glyphs.isEmpty()); + + glyphs.setGlyphIndexes(QVector() << 1 << 2 << 3); + QVERIFY(!glyphs.isEmpty()); + + glyphs.clear(); + QVERIFY(glyphs.isEmpty()); + + QVector glyphIndexes = QVector() << 1 << 2 << 3; + QVector positions = QVector() << QPointF(0, 0) << QPointF(0, 0) << QPointF(0, 0); + glyphs.setRawData(glyphIndexes.constData(), positions.constData(), glyphIndexes.size()); + QVERIFY(!glyphs.isEmpty()); +} void tst_QGlyphRun::textLayoutGlyphIndexes() { @@ -675,6 +693,34 @@ void tst_QGlyphRun::drawRightToLeft() } +void tst_QGlyphRun::boundingRect() +{ + QString s(QLatin1String("AbCdE")); + + QRawFont rawFont(QRawFont::fromFont(QFont())); + QVERIFY(rawFont.isValid()); + QVector glyphIndexes = rawFont.glyphIndexesForString(s); + QVector positions = rawFont.advancesForGlyphIndexes(glyphIndexes); + QCOMPARE(glyphIndexes.size(), s.size()); + QCOMPARE(positions.size(), glyphIndexes.size()); + + QGlyphRun glyphs; + glyphs.setRawFont(rawFont); + glyphs.setGlyphIndexes(glyphIndexes); + glyphs.setPositions(positions); + + QRectF boundingRect = glyphs.boundingRect(); + + glyphs.clear(); + glyphs.setRawFont(rawFont); + glyphs.setRawData(glyphIndexes.constData(), positions.constData(), glyphIndexes.size()); + QCOMPARE(glyphs.boundingRect(), boundingRect); + + boundingRect = QRectF(0, 0, 1, 1); + glyphs.setBoundingRect(boundingRect); + QCOMPARE(glyphs.boundingRect(), boundingRect); +} + #endif // QT_NO_RAWFONT QTEST_MAIN(tst_QGlyphRun) From 264eeb68b2183b2808d255fc37206d3cac7dc91c Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 12 Oct 2012 01:19:34 +0300 Subject: [PATCH 04/84] QFont: Fix build with QFONTCACHE_DEBUG Change-Id: Ifc89af71cdf6a5f9e4114266030cf265042db626 Reviewed-by: Marc Mutz Reviewed-by: Konstantin Ritt --- src/gui/text/qfont.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 65368fd9d8..a2132f0fea 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2768,7 +2768,7 @@ void QFontCache::timerEvent(QTimerEvent *) end = engineDataCache.constEnd(); for (; it != end; ++it) { #ifdef QFONTCACHE_DEBUG - FC_DEBUG(" %p: ref %2d", it.value(), int(it.value()->ref)); + FC_DEBUG(" %p: ref %2d", it.value(), int(it.value()->ref.load())); #endif // QFONTCACHE_DEBUG From 8473b6d05c50046b41f553fbfc1f6d2236d3607f Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Wed, 10 Oct 2012 15:15:21 +0200 Subject: [PATCH 05/84] qdoc: Allow empty character literal '' qdoc's tokenizer was reporting an error for the empty character literal ''. Now it allows it. Apparently it makes sense in .js files. Task number: QTBUG-25775 Change-Id: If407427fad9b65a035c2c4785d53c9e3d5202e62 Reviewed-by: Martin Smith --- src/tools/qdoc/tokenizer.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/tools/qdoc/tokenizer.cpp b/src/tools/qdoc/tokenizer.cpp index 69f2dafc39..29ce322cc9 100644 --- a/src/tools/qdoc/tokenizer.cpp +++ b/src/tools/qdoc/tokenizer.cpp @@ -244,6 +244,13 @@ int Tokenizer::getToken() } case '\'': yyCh = getChar(); + /* + Allow empty character literal. QTBUG-25775 + */ + if (yyCh == '\'') { + yyCh = getChar(); + break; + } if (yyCh == '\\') yyCh = getChar(); do { @@ -251,8 +258,7 @@ int Tokenizer::getToken() } while (yyCh != EOF && yyCh != '\''); if (yyCh == EOF) { - yyTokLoc.warning(tr("Unterminated C++ character" - " literal")); + yyTokLoc.warning(tr("Unterminated C++ character literal")); } else { yyCh = getChar(); From 9dbe3dc3a6ad41adfd3aa1e58885f1abc6a0890e Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 11 Oct 2012 14:04:21 +0200 Subject: [PATCH 06/84] qdoc: qdoc now can run in 2 passes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two command line options have been added, -prepare and -generate. If you run qdoc with -prepare, qdoc reads and parses the source files but does not generate the documentation. It only creates the .index file for the module you are running qdoc on. If you run qdoc with -generate, qdoc reads and parses the source files as well as the .index files created by running qdoc with -prepare, and it generates the documentation but no .index file. If you run without either option, qdoc runs as before, i.e. it runs both passes as a single pass. Task number: QTBUG-27539 Change-Id: Idbfe3f0f9dff58283596b504f00dff3f70f6e371 Reviewed-by: Tor Arne Vestbø Reviewed-by: Martin Smith --- src/tools/qdoc/ditaxmlgenerator.cpp | 31 +++++++++++++++++----------- src/tools/qdoc/generator.cpp | 1 + src/tools/qdoc/generator.h | 6 ++++++ src/tools/qdoc/htmlgenerator.cpp | 32 +++++++++++++++++------------ src/tools/qdoc/main.cpp | 10 +++++++++ 5 files changed, 55 insertions(+), 25 deletions(-) diff --git a/src/tools/qdoc/ditaxmlgenerator.cpp b/src/tools/qdoc/ditaxmlgenerator.cpp index f7700ce2a0..563df612ab 100644 --- a/src/tools/qdoc/ditaxmlgenerator.cpp +++ b/src/tools/qdoc/ditaxmlgenerator.cpp @@ -673,19 +673,26 @@ GuidMap* DitaXmlGenerator::lookupGuidMap(const QString& fileName) void DitaXmlGenerator::generateTree() { qdb_->buildCollections(); - Generator::generateTree(); - generateCollisionPages(); + if (!runPrepareOnly()) { + Generator::generateTree(); + generateCollisionPages(); + } - QString fileBase = project.toLower().simplified().replace(QLatin1Char(' '), QLatin1Char('-')); - qdb_->generateIndex(outputDir() + QLatin1Char('/') + fileBase + ".index", - projectUrl, - projectDescription, - this); - writeDitaMap(); - /* - Generate the XML tag file, if it was requested. - */ - qdb_->generateTagFile(tagFile_, this); + if (!runGenerateOnly()) { + QString fileBase = project.toLower().simplified().replace(QLatin1Char(' '), QLatin1Char('-')); + qdb_->generateIndex(outputDir() + QLatin1Char('/') + fileBase + ".index", + projectUrl, + projectDescription, + this); + } + + if (!runPrepareOnly()) { + writeDitaMap(); + /* + Generate the XML tag file, if it was requested. + */ + qdb_->generateTagFile(tagFile_, this); + } } static int countTableColumns(const Atom* t) diff --git a/src/tools/qdoc/generator.cpp b/src/tools/qdoc/generator.cpp index 1c7727db70..c6db340f74 100644 --- a/src/tools/qdoc/generator.cpp +++ b/src/tools/qdoc/generator.cpp @@ -96,6 +96,7 @@ QStringList Generator::styleDirs; QStringList Generator::styleFiles; bool Generator::debugging_ = false; bool Generator::noLinkErrors_ = false; +Generator::Passes Generator::qdocPass_ = Both; void Generator::setDebugSegfaultFlag(bool b) { diff --git a/src/tools/qdoc/generator.h b/src/tools/qdoc/generator.h index 30f2219243..3dc3b84767 100644 --- a/src/tools/qdoc/generator.h +++ b/src/tools/qdoc/generator.h @@ -68,6 +68,8 @@ class QDocDatabase; class Generator { public: + enum Passes { Both, Prepare, Generate }; + Generator(); virtual ~Generator(); @@ -90,6 +92,9 @@ public: static void setDebugSegfaultFlag(bool b); static bool debugging() { return debugging_; } static bool noLinkErrors() { return noLinkErrors_; } + static void setQDocPass(Passes pass) { qdocPass_ = pass; } + static bool runPrepareOnly() { return (qdocPass_ == Prepare); } + static bool runGenerateOnly() { return (qdocPass_ == Generate); } protected: virtual void beginSubPage(const InnerNode* node, const QString& fileName); @@ -193,6 +198,7 @@ private: static QStringList styleFiles; static bool debugging_; static bool noLinkErrors_; + static Passes qdocPass_; void appendFullName(Text& text, const Node *apparentNode, diff --git a/src/tools/qdoc/htmlgenerator.cpp b/src/tools/qdoc/htmlgenerator.cpp index a7721656f4..17dc40f08a 100644 --- a/src/tools/qdoc/htmlgenerator.cpp +++ b/src/tools/qdoc/htmlgenerator.cpp @@ -243,21 +243,27 @@ QString HtmlGenerator::format() void HtmlGenerator::generateTree() { qdb_->buildCollections(); - Generator::generateTree(); - generateCollisionPages(); + if (!runPrepareOnly()) { + Generator::generateTree(); + generateCollisionPages(); + } - QString fileBase = project.toLower().simplified().replace(QLatin1Char(' '), QLatin1Char('-')); - qdb_->generateIndex(outputDir() + QLatin1Char('/') + fileBase + ".index", - projectUrl, - projectDescription, - this); + if (!runGenerateOnly()) { + QString fileBase = project.toLower().simplified().replace(QLatin1Char(' '), QLatin1Char('-')); + qdb_->generateIndex(outputDir() + QLatin1Char('/') + fileBase + ".index", + projectUrl, + projectDescription, + this); + } - helpProjectWriter->generate(); - generateManifestFiles(); - /* - Generate the XML tag file, if it was requested. - */ - qdb_->generateTagFile(tagFile_, this); + if (!runPrepareOnly()) { + helpProjectWriter->generate(); + generateManifestFiles(); + /* + Generate the XML tag file, if it was requested. + */ + qdb_->generateTagFile(tagFile_, this); + } } /*! diff --git a/src/tools/qdoc/main.cpp b/src/tools/qdoc/main.cpp index 03974c5d04..5fbc01f1f0 100644 --- a/src/tools/qdoc/main.cpp +++ b/src/tools/qdoc/main.cpp @@ -131,6 +131,10 @@ static void printHelp() "Specify output directory, overrides setting in qdocconf file\n" " -outputformat " "Specify output format, overrides setting in qdocconf file\n" + " -prepare " + "Run qdoc only to generate an index file, not the docs\n" + " -generate " + "Run qdoc to read the index files and generate the docs\n" " -showinternal " "Include content marked internal\n" " -version " @@ -594,6 +598,12 @@ int main(int argc, char **argv) else if (opt == "-debug") { Generator::setDebugSegfaultFlag(true); } + else if (opt == "-prepare") { + Generator::setQDocPass(Generator::Prepare); + } + else if (opt == "-generate") { + Generator::setQDocPass(Generator::Generate); + } else { qdocFiles.append(opt); } From e24dd4d48f73bb6988f7b88ff94a2aa589f7518b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Tue, 9 Oct 2012 23:34:29 +0100 Subject: [PATCH 07/84] QtPrintSupport: Fix build with QT_NO_PICTURE. Printer support depends on having Picture support. If QT_NO_PICTURE is defined, qfeatures.h will define QT_NO_PRINTER. Not all code is including qfeatures.h, which causes inconsistency, some code has QT_NO_PRINTER defined and some has not, which causes the build to fail. Change-Id: I10a854244a41d017b921b731ec0e08f90a3326cf Reviewed-by: Holger Ihrig Reviewed-by: J-P Nurmi --- src/plugins/printsupport/cups/qcupsprintersupport_p.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/printsupport/cups/qcupsprintersupport_p.h b/src/plugins/printsupport/cups/qcupsprintersupport_p.h index 1321e83586..17fd1cf89e 100644 --- a/src/plugins/printsupport/cups/qcupsprintersupport_p.h +++ b/src/plugins/printsupport/cups/qcupsprintersupport_p.h @@ -42,6 +42,7 @@ #ifndef QCUPSPRINTERSUPPORT_H #define QCUPSPRINTERSUPPORT_H +#include // Some feature dependencies might define QT_NO_PRINTER #ifndef QT_NO_PRINTER #include From 83aa1a210395e7740468e034a8f95f054f352f01 Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Thu, 11 Oct 2012 14:08:45 +0100 Subject: [PATCH 08/84] OpenGL: Add missing WINAPI calling convention for QGL functions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This is the QGL equivalent of commit 602cab9bb2072c5564bbb43c4125e04f98266043 Without this QGLExtensionMatcher causes stack corruption when using a core profile GL context due to the call to glGetStringi() with an incorrect calling convention. Change-Id: Ibd86645e04df8c650c182fecfc8c481dae8a75b2 Reviewed-by: Samuel Rødal Reviewed-by: Friedemann Kleint --- src/opengl/qglfunctions.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/opengl/qglfunctions.h b/src/opengl/qglfunctions.h index 3989063f96..4318f538df 100644 --- a/src/opengl/qglfunctions.h +++ b/src/opengl/qglfunctions.h @@ -61,6 +61,9 @@ QT_BEGIN_NAMESPACE typedef ptrdiff_t qgl_GLintptr; typedef ptrdiff_t qgl_GLsizeiptr; +#if defined(APIENTRY) && !defined(QGLF_APIENTRY) +# define QGLF_APIENTRY APIENTRY +#endif # ifndef QGLF_APIENTRYP # ifdef QGLF_APIENTRY From d738595d71a68cc294dc0b1b368eb22ae0ecc23a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 11 Oct 2012 14:46:16 +0200 Subject: [PATCH 09/84] Stabilize Accessibility/Combo test. The Windows combo animation causes a delay, introduce QTRY_VERIFY. Fix warnings about being unable to set geometry on Windows. Change-Id: I52ca960c06f023ade3afe85f31deaf8e32edff26 Reviewed-by: Janne Anttila Reviewed-by: Marc Mutz --- tests/auto/other/qaccessibility/tst_qaccessibility.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp index 0166d592a6..08d679772e 100644 --- a/tests/auto/other/qaccessibility/tst_qaccessibility.cpp +++ b/tests/auto/other/qaccessibility/tst_qaccessibility.cpp @@ -2822,7 +2822,10 @@ void tst_QAccessibility::comboBoxTest() { // not editable combobox QComboBox combo; combo.addItems(QStringList() << "one" << "two" << "three"); + // Fully decorated windows have a minimum width of 160 on Windows. + combo.setMinimumWidth(200); combo.show(); + QVERIFY(QTest::qWaitForWindowShown(&combo)); QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(&combo); QCOMPARE(verifyHierarchy(iface), 0); @@ -2848,13 +2851,14 @@ void tst_QAccessibility::comboBoxTest() QVERIFY(iface->actionInterface()); QCOMPARE(iface->actionInterface()->actionNames(), QStringList() << QAccessibleActionInterface::showMenuAction()); iface->actionInterface()->doAction(QAccessibleActionInterface::showMenuAction()); - QVERIFY(combo.view()->isVisible()); + QTRY_VERIFY(combo.view()->isVisible()); delete iface; } { // editable combobox QComboBox editableCombo; + editableCombo.setMinimumWidth(200); editableCombo.show(); editableCombo.setEditable(true); editableCombo.addItems(QStringList() << "foo" << "bar" << "baz"); From c4840d55eae16b580e0352485de8598e2d6094ac Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 11 Oct 2012 16:58:38 +0200 Subject: [PATCH 10/84] Fix missing return in QtOpenGl/paintedwindow example. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I17da0e93bb7c1b0cdbb5b76035ec913cbc616608 Reviewed-by: Topi Reiniö Reviewed-by: Marc Mutz --- examples/opengl/paintedwindow/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/opengl/paintedwindow/main.cpp b/examples/opengl/paintedwindow/main.cpp index 270b0b162a..b0c0060338 100644 --- a/examples/opengl/paintedwindow/main.cpp +++ b/examples/opengl/paintedwindow/main.cpp @@ -50,6 +50,6 @@ int main(int argc, char **argv) PaintedWindow window; window.show(); - app.exec(); + return app.exec(); } From fded075ba4de86e84672a04db55cf49630d79450 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Mon, 1 Oct 2012 12:02:44 +0200 Subject: [PATCH 11/84] Add workaround for typo in libatspi VisualdataChanged MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I6375d77fac4e743a372f18b3e3d63c128ce51271 Reviewed-by: Morten Johan Sørvig --- src/platformsupport/linuxaccessibility/atspiadaptor.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index a4a4d66012..ecc64004d7 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -707,7 +707,8 @@ void AtSpiAdaptor::setBitFlag(const QString &flag) sendObject_text_selection_changed = 1; } else if (right.startsWith(QLatin1String("ValueChanged"))) { sendObject_value_changed = 1; - } else if (right.startsWith(QLatin1String("VisibleDataChanged"))) { + } else if (right.startsWith(QLatin1String("VisibleDataChanged")) + || right.startsWith(QLatin1String("VisibledataChanged"))) { // typo in libatspi sendObject_visible_data_changed = 1; } else { qAtspiDebug() << "WARNING: subscription string not handled:" << flag; From 3d466cbcbb37a00c94e233830d90bacd4ce2aac8 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 28 Sep 2012 20:18:22 +0200 Subject: [PATCH 12/84] Accessibility: Implement GetVersion and GetLocale in app adaptor. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I73a49b22add9e268907025dd0bf7ec76e7fd0c0b Reviewed-by: Morten Johan Sørvig --- .../linuxaccessibility/atspiadaptor.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index ecc64004d7..f4960fca2b 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -1278,7 +1278,16 @@ bool AtSpiAdaptor::applicationInterface(const QAIPointer &interface, const QStri QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(QLatin1String("Qt")))); return connection.send(reply); } - + if (function == "GetVersion") { + Q_ASSERT(message.signature() == "ss"); + QDBusMessage reply = message.createReply(QVariant::fromValue(QDBusVariant(QLatin1String(qVersion())))); + return connection.send(reply); + } + if (function == "GetLocale") { + Q_ASSERT(message.signature() == "u"); + QDBusMessage reply = message.createReply(QVariant::fromValue(QLocale().name())); + return connection.send(reply); + } qAtspiDebug() << "AtSpiAdaptor::applicationInterface " << message.path() << interface << function; return false; } From 8229841a4e1023cd87591a26761f247efec8b2a2 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Thu, 11 Oct 2012 19:04:57 +0200 Subject: [PATCH 13/84] QGtkStyle: fix a warning Commit c0893962ef94f12594f936ef2a50db6d0328eca0 added two definitions of a variable named gtkToggleButtonStyle in nested scopes. Because of name lookup rules, the second one wasn't initialised with the first one, but with itself. This leaves the second gtkToggleButtonStyle uninit'ed. Simply remove the surplus declaration, leaving the name to the original declaration. Change-Id: I2269e1093f54643ff4dce27b39cc033db6697782 Reviewed-by: J-P Nurmi --- src/widgets/styles/qgtkstyle.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/widgets/styles/qgtkstyle.cpp b/src/widgets/styles/qgtkstyle.cpp index 552e2354c5..9bcf45e928 100644 --- a/src/widgets/styles/qgtkstyle.cpp +++ b/src/widgets/styles/qgtkstyle.cpp @@ -1935,7 +1935,6 @@ void QGtkStyle::drawComplexControl(ComplexControl control, const QStyleOptionCom gint interiorFocus = true; d->gtk_widget_style_get(gtkToggleButton, "interior-focus", &interiorFocus, NULL); - GtkStyle *gtkToggleButtonStyle = gtkToggleButtonStyle; int xt = interiorFocus ? gtkToggleButtonStyle->xthickness : 0; int yt = interiorFocus ? gtkToggleButtonStyle->ythickness : 0; if (focus && ((option->state & State_KeyboardFocusChange) || styleHint(SH_UnderlineShortcut, option, widget))) From dc0d5bf387a0b440c74b9e822c46b09e20e00720 Mon Sep 17 00:00:00 2001 From: Jerome Pasion Date: Thu, 11 Oct 2012 16:02:22 +0200 Subject: [PATCH 14/84] Doc: Removed references to stale links. The links are from the qt-webpages.qdoc and no longer exist. Change-Id: I8329032215fa77811117e2767bae745795b209cb Reviewed-by: Martin Smith --- .../widgets/doc/src/editabletreemodel.qdoc | 6 +---- src/testlib/doc/src/qttestlib-manual.qdoc | 8 ------- src/widgets/doc/src/modelview.qdoc | 23 ++++++++----------- 3 files changed, 11 insertions(+), 26 deletions(-) diff --git a/examples/widgets/doc/src/editabletreemodel.qdoc b/examples/widgets/doc/src/editabletreemodel.qdoc index f0b10eff2b..7d30a8eed3 100644 --- a/examples/widgets/doc/src/editabletreemodel.qdoc +++ b/examples/widgets/doc/src/editabletreemodel.qdoc @@ -39,10 +39,6 @@ possible to insert new child items, and this is shown in the supporting example code. - \note The model only shows the basic principles used when creating an - editable, hierarchical model. You may wish to use the \l{ModelTest} - project to test production models. - \section1 Overview As described in the \l{Model Subclassing Reference}, models must @@ -212,7 +208,7 @@ As with the \l{itemviews/simpletreemodel}{Simple Tree Model} example, the \c TreeModel needs to be able to take a model index, find the corresponding \c TreeItem, and return model indexes that correspond to - its parents and children. + its parents and children. In the diagram, we show how the model's \l{TreeModel::parent}{parent()} implementation obtains the model index corresponding to the parent of diff --git a/src/testlib/doc/src/qttestlib-manual.qdoc b/src/testlib/doc/src/qttestlib-manual.qdoc index 008c0b271e..e7ee787d08 100644 --- a/src/testlib/doc/src/qttestlib-manual.qdoc +++ b/src/testlib/doc/src/qttestlib-manual.qdoc @@ -84,11 +84,6 @@ \li Custom types can easily be added to the test data and test output. \endtable - \note For higher-level GUI and application testing needs, please - see the \l{Partner Directory} for Qt testing products provided by - Nokia partners. - - \section1 QTestLib API All public methods are in the \l QTest namespace. In addition, the @@ -835,6 +830,3 @@ for more information on these tools and a simple graphing example. */ - - - diff --git a/src/widgets/doc/src/modelview.qdoc b/src/widgets/doc/src/modelview.qdoc index c133005b54..304af0058d 100644 --- a/src/widgets/doc/src/modelview.qdoc +++ b/src/widgets/doc/src/modelview.qdoc @@ -100,8 +100,8 @@ Let's have a closer look at a standard table widget. A table widget is a 2D array of the data elements that the user can change. The table widget can be integrated into a program flow by reading and writing the data elements that - the table widget provides. - This method is very intuitive and useful in many applications, but displaying + the table widget provides. + This method is very intuitive and useful in many applications, but displaying and editing a database table with a standard table widget can be problematic. Two copies of the data have to be coordinated: one outside the widget; one inside the widget. The developer is responsible for @@ -180,12 +180,12 @@ \section1 2. A Simple Model/View Application - If you want to develop a model/view application, where should you start? - We recommend starting with a simple example and extending it step-by-step. - This makes understanding the architecture a lot easier. Trying to understand - the model/view architecture in detail before invoking the IDE has proven - to be less convenient for many developers. It is substantially easier to - start with a simple model/view application that has demo data. Give it a + If you want to develop a model/view application, where should you start? + We recommend starting with a simple example and extending it step-by-step. + This makes understanding the architecture a lot easier. Trying to understand + the model/view architecture in detail before invoking the IDE has proven + to be less convenient for many developers. It is substantially easier to + start with a simple model/view application that has demo data. Give it a try! Simply replace the data in the examples below with your own. Below are 7 very simple and independent applications that show different @@ -202,7 +202,7 @@ We have the usual \l {modelview-part2-main-cpp.html}{main()} function: - Here is the interesting part: We create an instance of MyModel and use + Here is the interesting part: We create an instance of MyModel and use \l{QTableView::setModel()}{tableView.setModel(&myModel);} to pass a pointer of it to \l{QTableView}{tableView}. \l{QTableView}{tableView} will invoke the methods of the pointer it has received to find out two @@ -606,12 +606,9 @@ \e{Open Source Press}, ISBN 3-937514-12-0. \li \b{Foundations of Qt Development} / Johan Thelin, \e{Apress}, ISBN 1-59059-831-8. \li \b{Advanced Qt Programming} / Mark Summerfield, \e{Prentice Hall}, ISBN 0-321-63590-6. - This book covers Model/View programming on more than 150 pages. + This book covers Model/View programming on more than 150 pages. \endlist - More information about these books is available on the - \l{Books about Qt Programming}{Qt Web site}. - The following list provides an overview of example programs contained in the first three books listed above. Some of them make very good templates for developing similar applications. From 6b04ee10e6a17999679de86e80ce66886ceab963 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Thu, 20 Sep 2012 15:35:21 +0200 Subject: [PATCH 15/84] Auto tests: revise cursor dependant tests Cursor dependant auto tests are currently skipped in various ways. Some are checking PlatformQuirks::haveMouseCursor() that tries to detect if the desktop environment is MeeGo, using obsolete Q_WS_X11. Some are skipped if QT_NO_CURSOR or Q_OS_WINCE is defined and some are actually missing the approriate guards. => unify by defining QTEST_NO_CURSOR in qtest-config.h when appropriate ie. for platforms that have no regular mouse cursor support or when QT_NO_CURSOR is defined. Task-number: QTBUG-22551 Change-Id: I9a1e0e3156617945ae46226c79268955454c8a9a Reviewed-by: Laszlo Papp Reviewed-by: Marc Mutz Reviewed-by: Caroline Chao --- .../io/qdatastream/tst_qdatastream.cpp | 26 ++++++--- .../kernel/qguimetatype/tst_qguimetatype.cpp | 6 ++ .../qguivariant/test/tst_qguivariant.cpp | 9 ++- .../auto/{platformquirks.h => qtest-config.h} | 28 +++------- .../qgraphicsitem/tst_qgraphicsitem.cpp | 19 ++----- .../tst_qgraphicsproxywidget.cpp | 27 ++++----- .../qgraphicsview/tst_qgraphicsview.cpp | 55 +++++++------------ .../qgraphicswidget/tst_qgraphicswidget.cpp | 5 ++ .../kernel/qapplication/tst_qapplication.cpp | 5 ++ .../widgets/kernel/qwidget/tst_qwidget.cpp | 20 ++++--- .../qstylesheetstyle/tst_qstylesheetstyle.cpp | 10 ++-- .../widgets/qlineedit/tst_qlineedit.cpp | 5 +- .../widgets/qmainwindow/tst_qmainwindow.cpp | 6 +- .../qmdisubwindow/tst_qmdisubwindow.cpp | 9 ++- .../qplaintextedit/tst_qplaintextedit.cpp | 8 ++- .../widgets/qtextedit/tst_qtextedit.cpp | 7 ++- 16 files changed, 132 insertions(+), 113 deletions(-) rename tests/auto/{platformquirks.h => qtest-config.h} (86%) diff --git a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp index 19ce2f2c7a..e0f479524f 100644 --- a/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/corelib/io/qdatastream/tst_qdatastream.cpp @@ -48,6 +48,8 @@ #include #include +#include "../../../qtest-config.h" + Q_DECLARE_METATYPE(QBitArray) Q_DECLARE_METATYPE(qint64) @@ -78,8 +80,10 @@ private slots: void stream_QByteArray_data(); void stream_QByteArray(); +#ifndef QTEST_NO_CURSOR void stream_QCursor_data(); void stream_QCursor(); +#endif void stream_QDate_data(); void stream_QDate(); @@ -193,7 +197,9 @@ private: void writeQBrush(QDataStream *s); void writeQColor(QDataStream *s); void writeQByteArray(QDataStream *s); +#ifndef QTEST_NO_CURSOR void writeQCursor(QDataStream *s); +#endif void writeQWaitCursor(QDataStream *s); void writeQDate(QDataStream *s); void writeQTime(QDataStream *s); @@ -220,7 +226,9 @@ private: void readQBrush(QDataStream *s); void readQColor(QDataStream *s); void readQByteArray(QDataStream *s); +#ifndef QTEST_NO_CURSOR void readQCursor(QDataStream *s); +#endif void readQDate(QDataStream *s); void readQTime(QDataStream *s); void readQDateTime(QDataStream *s); @@ -999,7 +1007,7 @@ void tst_QDataStream::readQByteArray(QDataStream *s) } // ************************************ -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR static QCursor qCursorData(int index) { switch (index) { @@ -1018,31 +1026,31 @@ static QCursor qCursorData(int index) } #endif +#ifndef QTEST_NO_CURSOR void tst_QDataStream::stream_QCursor_data() { -#ifndef QT_NO_CURSOR stream_data(9); -#endif } +#endif +#ifndef QTEST_NO_CURSOR void tst_QDataStream::stream_QCursor() { -#ifndef QT_NO_CURSOR STREAM_IMPL(QCursor); -#endif } +#endif +#ifndef QTEST_NO_CURSOR void tst_QDataStream::writeQCursor(QDataStream *s) { -#ifndef QT_NO_CURSOR QCursor d5(qCursorData(dataIndex(QTest::currentDataTag()))); *s << d5; -#endif } +#endif +#ifndef QTEST_NO_CURSOR void tst_QDataStream::readQCursor(QDataStream *s) { -#ifndef QT_NO_CURSOR QCursor test(qCursorData(dataIndex(QTest::currentDataTag()))); QCursor d5; *s >> d5; @@ -1061,8 +1069,8 @@ void tst_QDataStream::readQCursor(QDataStream *s) QPixmap expected = *(test.mask()); QCOMPARE(actual, expected); } -#endif } +#endif // ************************************ diff --git a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp index f167bcb139..45f4791439 100644 --- a/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp +++ b/tests/auto/gui/kernel/qguimetatype/tst_qguimetatype.cpp @@ -44,6 +44,8 @@ #include #include +#include "../../../qtest-config.h" + Q_DECLARE_METATYPE(QMetaType::Type) class tst_QGuiMetaType: public QObject @@ -133,11 +135,13 @@ template<> struct TypeComparator { return v1.size() == v2.size(); } }; +#ifndef QTEST_NO_CURSOR template<> struct TypeComparator { static bool equal(const QCursor &v1, const QCursor &v2) { return v1.shape() == v2.shape(); } }; +#endif template struct DefaultValueFactory @@ -176,9 +180,11 @@ template<> struct TestValueFactory { template<> struct TestValueFactory { static QBitmap *create() { return new QBitmap(16, 32); } }; +#ifndef QTEST_NO_CURSOR template<> struct TestValueFactory { static QCursor *create() { return new QCursor(Qt::WaitCursor); } }; +#endif template<> struct TestValueFactory { static QKeySequence *create() { return new QKeySequence(QKeySequence::Close); } }; diff --git a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp index 38dc1a92f2..4748b7c833 100644 --- a/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp +++ b/tests/auto/gui/kernel/qguivariant/test/tst_qguivariant.cpp @@ -65,6 +65,7 @@ #include "tst_qvariant_common.h" +#include "../../../../qtest-config.h" class tst_QGuiVariant : public QObject { @@ -182,7 +183,7 @@ void tst_QGuiVariant::canConvert_data() var = QVariant::fromValue(QColor()); QTest::newRow("Color") << var << N << N << N << Y << Y << Y << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << Y << N << N << N << N; -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR var = QVariant::fromValue(QCursor()); QTest::newRow("Cursor") << var << N << N << N << N << N << N << Y << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N << N; @@ -508,7 +509,7 @@ void tst_QGuiVariant::writeToReadFromDataStream_data() QTest::newRow( "bitmap_valid" ) << QVariant::fromValue( bitmap ) << false; QTest::newRow( "brush_valid" ) << QVariant::fromValue( QBrush( Qt::red ) ) << false; QTest::newRow( "color_valid" ) << QVariant::fromValue( QColor( Qt::red ) ) << false; -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR QTest::newRow( "cursor_valid" ) << QVariant::fromValue( QCursor( Qt::PointingHandCursor ) ) << false; #endif QTest::newRow( "font_valid" ) << QVariant::fromValue( QFont( "times", 12 ) ) << false; @@ -676,12 +677,16 @@ void tst_QGuiVariant::implicitConstruction() void tst_QGuiVariant::guiVariantAtExit() { // crash test, it should not crash at QGuiApplication exit +#ifndef QTEST_NO_CURSOR static QVariant cursor = QCursor(); +#endif static QVariant point = QPoint(); static QVariant icon = QIcon(); static QVariant image = QImage(); static QVariant palette = QPalette(); +#ifndef QTEST_NO_CURSOR Q_UNUSED(cursor); +#endif Q_UNUSED(point); Q_UNUSED(icon); Q_UNUSED(image); diff --git a/tests/auto/platformquirks.h b/tests/auto/qtest-config.h similarity index 86% rename from tests/auto/platformquirks.h rename to tests/auto/qtest-config.h index 9bd9adda83..b885cbda74 100644 --- a/tests/auto/platformquirks.h +++ b/tests/auto/qtest-config.h @@ -39,27 +39,15 @@ ** ****************************************************************************/ -#ifndef PLATFORMQUIRKS_H -#define PLATFORMQUIRKS_H +#ifndef QTEST_CONFIG_H +#define QTEST_CONFIG_H #include -#ifdef QT_GUI_LIB -#include -#endif - - -struct PlatformQuirks -{ - static inline bool haveMouseCursor() - { -#if defined(Q_WS_X11) - return X11->desktopEnvironment != DE_MEEGO_COMPOSITOR; -#else - return true; -#endif - } -}; - -#endif +#ifndef QTEST_NO_CURSOR +# if defined(QT_NO_CURSOR) || defined(Q_OS_WINCE) || defined(MEEGO_EDITION_HARMATTAN) +# define QTEST_NO_CURSOR +# endif +#endif // QTEST_NO_CURSOR +#endif // QTEST_CONFIG_H diff --git a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp index 73bca1ca3d..f78b40bdf0 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsitem/tst_qgraphicsitem.cpp @@ -73,7 +73,7 @@ Q_DECLARE_METATYPE(QPainterPath) Q_DECLARE_METATYPE(QPointF) Q_DECLARE_METATYPE(QRectF) -#include "../../../platformquirks.h" +#include "../../../qtest-config.h" #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) #include @@ -360,7 +360,9 @@ private slots: void filtersChildEvents(); void filtersChildEvents2(); void ensureVisible(); +#ifndef QTEST_NO_CURSOR void cursor(); +#endif //void textControlGetterSetter(); void defaultItemTest_QGraphicsLineItem(); void defaultItemTest_QGraphicsPixmapItem(); @@ -4145,9 +4147,9 @@ void tst_QGraphicsItem::ensureVisible() QTest::qWait(25); } +#ifndef QTEST_NO_CURSOR void tst_QGraphicsItem::cursor() { -#ifndef QT_NO_CURSOR QGraphicsScene scene; QGraphicsRectItem *item1 = scene.addRect(QRectF(0, 0, 50, 50)); QGraphicsRectItem *item2 = scene.addRect(QRectF(0, 0, 50, 50)); @@ -4203,15 +4205,6 @@ void tst_QGraphicsItem::cursor() QApplication::sendEvent(view.viewport(), &event); } - if (!PlatformQuirks::haveMouseCursor()) - return; -#if !defined(Q_OS_WINCE) - QTest::qWait(250); -#else - // Test environment does not have any cursor, therefore no shape - return; -#endif - QCOMPARE(view.viewport()->cursor().shape(), item1->cursor().shape()); { @@ -4233,8 +4226,8 @@ void tst_QGraphicsItem::cursor() QTest::qWait(25); QCOMPARE(view.viewport()->cursor().shape(), cursor.shape()); -#endif } +#endif /* void tst_QGraphicsItem::textControlGetterSetter() { @@ -4499,7 +4492,7 @@ protected: case QGraphicsItem::ItemSceneHasChanged: break; case QGraphicsItem::ItemCursorChange: -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR oldValues << cursor(); #endif break; diff --git a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp index 88aaab3096..e9865f2b22 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsproxywidget/tst_qgraphicsproxywidget.cpp @@ -49,6 +49,8 @@ #include #endif +#include "../../../qtest-config.h" + static void sendMouseMove(QWidget *widget, const QPoint &point, Qt::MouseButton button = Qt::NoButton) { QMouseEvent event(QEvent::MouseMove, point, widget->mapToGlobal(point), button, button, 0); @@ -115,8 +117,10 @@ private slots: void focusNextPrevChild(); void focusOutEvent_data(); void focusOutEvent(); +#ifndef QTEST_NO_CURSOR void hoverEnterLeaveEvent_data(); void hoverEnterLeaveEvent(); +#endif void hoverMoveEvent_data(); void hoverMoveEvent(); void keyPressEvent_data(); @@ -154,7 +158,9 @@ private slots: void setFocus_complexTwoWidgets(); void popup_basic(); void popup_subwidget(); +#ifndef QTEST_NO_CURSOR void changingCursor_basic(); +#endif void tooltip_basic(); void childPos_data(); void childPos(); @@ -423,7 +429,7 @@ void tst_QGraphicsProxyWidget::setWidget() } QWidget *widget = new QWidget; -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR widget->setCursor(Qt::IBeamCursor); #endif widget->setPalette(QPalette(Qt::magenta)); @@ -461,7 +467,7 @@ void tst_QGraphicsProxyWidget::setWidget() QVERIFY(subWidget->testAttribute(Qt::WA_DontShowOnScreen)); QVERIFY(!subWidget->testAttribute(Qt::WA_QuitOnClose)); QCOMPARE(proxy->acceptHoverEvents(), true); -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR QVERIFY(proxy->hasCursor()); // These should match @@ -938,6 +944,7 @@ protected: } }; +#ifndef QTEST_NO_CURSOR void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent_data() { QTest::addColumn("hasWidget"); @@ -954,10 +961,6 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent() QFETCH(bool, hasWidget); QFETCH(bool, hoverEnabled); -#if defined(Q_OS_WINCE) && (!defined(GWES_ICONCURS) || defined(QT_NO_CURSOR)) - QSKIP("hover events not supported on this platform"); -#endif - // proxy should translate this into events that the widget would expect QGraphicsScene scene; @@ -1003,6 +1006,7 @@ void tst_QGraphicsProxyWidget::hoverEnterLeaveEvent() if (!hasWidget) delete widget; } +#endif void tst_QGraphicsProxyWidget::hoverMoveEvent_data() { @@ -1522,7 +1526,7 @@ void tst_QGraphicsProxyWidget::setWidget_simple() // Properties // QCOMPARE(proxy.focusPolicy(), lineEdit->focusPolicy()); // QCOMPARE(proxy.palette(), lineEdit->palette()); -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR QCOMPARE(proxy.cursor().shape(), lineEdit->cursor().shape()); #endif QCOMPARE(proxy.layoutDirection(), lineEdit->layoutDirection()); @@ -2538,12 +2542,9 @@ void tst_QGraphicsProxyWidget::popup_subwidget() QCOMPARE(popup->size(), child->size().toSize()); } +#ifndef QTEST_NO_CURSOR void tst_QGraphicsProxyWidget::changingCursor_basic() { -#if defined(Q_OS_WINCE) && (!defined(GWES_ICONCURS) || defined(QT_NO_CURSOR)) - QSKIP("hover events not supported on this platform"); -#endif -#ifndef QT_NO_CURSOR // Confirm that mouse events are working properly by checking that // when moving the mouse over a line edit it will change the cursor into the I QGraphicsScene scene; @@ -2568,8 +2569,8 @@ void tst_QGraphicsProxyWidget::changingCursor_basic() QTest::mouseMove(view.viewport(), QPoint(1, 1)); sendMouseMove(view.viewport(), QPoint(1, 1)); QTRY_COMPARE(view.viewport()->cursor().shape(), Qt::ArrowCursor); -#endif } +#endif void tst_QGraphicsProxyWidget::tooltip_basic() { @@ -3617,7 +3618,7 @@ public slots: void tst_QGraphicsProxyWidget::QTBUG_6986_sendMouseEventToAlienWidget() { -#if defined(Q_OS_MAC) || defined(Q_OS_WIN) || defined(QT_NO_CURSOR) +#if defined(Q_OS_MAC) || defined(Q_OS_WIN) || defined(QTEST_NO_CURSOR) QSKIP("Test case unstable on this platform"); #endif QGraphicsView view; diff --git a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp index 96aba11d52..0ddae14738 100644 --- a/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicsview/tst_qgraphicsview.cpp @@ -68,10 +68,11 @@ #include #include #include -#include "../../../platformquirks.h" #include "../../../shared/platforminputcontext.h" #include +#include "../../../qtest-config.h" + Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QList) Q_DECLARE_METATYPE(QMatrix) @@ -196,8 +197,10 @@ private slots: void mapFromScenePath(); void sendEvent(); void wheelEvent(); +#ifndef QTEST_NO_CURSOR void cursor(); void cursor2(); +#endif void transformationAnchor(); void resizeAnchor(); void viewportUpdateMode(); @@ -256,7 +259,9 @@ private slots: void QTBUG_4151_clipAndIgnore_data(); void QTBUG_4151_clipAndIgnore(); void QTBUG_5859_exposedRect(); +#ifndef QTEST_NO_CURSOR void QTBUG_7438_cursor(); +#endif void hoverLeave(); void QTBUG_16063_microFocusRect(); @@ -678,7 +683,7 @@ void tst_QGraphicsView::dragMode_scrollHand() for (int i = 0; i < 2; ++i) { // ScrollHandDrag -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR Qt::CursorShape cursorShape = view.viewport()->cursor().shape(); #endif int horizontalScrollBarValue = view.horizontalScrollBar()->value(); @@ -697,7 +702,7 @@ void tst_QGraphicsView::dragMode_scrollHand() QTRY_VERIFY(item->isSelected()); for (int k = 0; k < 4; ++k) { -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR QCOMPARE(view.viewport()->cursor().shape(), Qt::ClosedHandCursor); #endif { @@ -740,7 +745,7 @@ void tst_QGraphicsView::dragMode_scrollHand() QTRY_VERIFY(item->isSelected()); QCOMPARE(view.horizontalScrollBar()->value(), horizontalScrollBarValue - 10); QCOMPARE(view.verticalScrollBar()->value(), verticalScrollBarValue - 10); -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR QCOMPARE(view.viewport()->cursor().shape(), cursorShape); #endif @@ -800,7 +805,7 @@ void tst_QGraphicsView::dragMode_rubberBand() for (int i = 0; i < 2; ++i) { // RubberBandDrag -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR Qt::CursorShape cursorShape = view.viewport()->cursor().shape(); #endif int horizontalScrollBarValue = view.horizontalScrollBar()->value(); @@ -814,7 +819,7 @@ void tst_QGraphicsView::dragMode_rubberBand() QApplication::sendEvent(view.viewport(), &event); QVERIFY(event.isAccepted()); } -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR QCOMPARE(view.viewport()->cursor().shape(), cursorShape); #endif @@ -862,7 +867,7 @@ void tst_QGraphicsView::dragMode_rubberBand() } QCOMPARE(view.horizontalScrollBar()->value(), horizontalScrollBarValue); QCOMPARE(view.verticalScrollBar()->value(), verticalScrollBarValue); -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR QCOMPARE(view.viewport()->cursor().shape(), cursorShape); #endif @@ -2102,15 +2107,9 @@ void tst_QGraphicsView::wheelEvent() QVERIFY(widget->hasFocus()); } +#ifndef QTEST_NO_CURSOR void tst_QGraphicsView::cursor() { -#ifndef QT_NO_CURSOR -#if defined(Q_OS_WINCE) - QSKIP("Qt/CE does not have regular cursor support"); -#endif - if (PlatformQuirks::haveMouseCursor()) - QSKIP("The Platform does not have regular cursor support"); - QGraphicsScene scene; QGraphicsItem *item = scene.addRect(QRectF(-10, -10, 20, 20)); item->setCursor(Qt::IBeamCursor); @@ -2129,20 +2128,12 @@ void tst_QGraphicsView::cursor() sendMouseMove(view.viewport(), QPoint(5, 5)); QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor); -#endif } +#endif -// Qt/CE does not have regular cursor support. -#if !defined(QT_NO_CURSOR) && !defined(Q_OS_WINCE) +#ifndef QTEST_NO_CURSOR void tst_QGraphicsView::cursor2() { -#ifndef QT_NO_CURSOR -#if defined(Q_OS_WINCE) - QSKIP("Qt/CE does not have regular cursor support"); -#endif - if (PlatformQuirks::haveMouseCursor()) - QSKIP("The Platform does not have regular cursor support"); - QGraphicsScene scene; QGraphicsItem *item = scene.addRect(QRectF(-10, -10, 20, 20)); item->setCursor(Qt::IBeamCursor); @@ -2205,8 +2196,8 @@ void tst_QGraphicsView::cursor2() QCOMPARE(view.viewport()->cursor().shape(), Qt::IBeamCursor); sendMouseMove(view.viewport(), view.mapFromScene(-15, -15)); QCOMPARE(view.viewport()->cursor().shape(), Qt::SizeAllCursor); -#endif } +#endif void tst_QGraphicsView::transformationAnchor() { @@ -3529,7 +3520,7 @@ void tst_QGraphicsView::mouseTracking() QGraphicsView view(&scene); QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10); -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR item->setCursor(Qt::CrossCursor); #endif scene.addItem(item); @@ -3539,7 +3530,7 @@ void tst_QGraphicsView::mouseTracking() // Adding an item to the scene before the scene is set on the view. QGraphicsScene scene(-10000, -10000, 20000, 20000); QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10); -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR item->setCursor(Qt::CrossCursor); #endif scene.addItem(item); @@ -3556,7 +3547,7 @@ void tst_QGraphicsView::mouseTracking() QGraphicsView view3(&scene); QGraphicsRectItem *item = new QGraphicsRectItem(10, 10, 10, 10); -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR item->setCursor(Qt::CrossCursor); #endif scene.addItem(item); @@ -4359,7 +4350,6 @@ void tst_QGraphicsView::task255529_transformationAnchorMouseAndViewportMargins() QEXPECT_FAIL("", message.constData(), Abort); #endif QVERIFY2(dx < slack && dy < slack, message.constData()); -#endif } void tst_QGraphicsView::task259503_scrollingArtifacts() @@ -4505,12 +4495,9 @@ void tst_QGraphicsView::QTBUG_5859_exposedRect() QCOMPARE(item.lastExposedRect, scene.lastBackgroundExposedRect); } +#ifndef QTEST_NO_CURSOR void tst_QGraphicsView::QTBUG_7438_cursor() { -#ifndef QT_NO_CURSOR -#if defined(Q_OS_WINCE) - QSKIP("Qt/CE does not have regular cursor support"); -#endif QGraphicsScene scene; QGraphicsItem *item = scene.addRect(QRectF(-10, -10, 20, 20)); item->setFlag(QGraphicsItem::ItemIsMovable); @@ -4529,8 +4516,8 @@ void tst_QGraphicsView::QTBUG_7438_cursor() QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor); sendMouseRelease(view.viewport(), view.mapFromScene(0, 0)); QCOMPARE(view.viewport()->cursor().shape(), Qt::PointingHandCursor); -#endif } +#endif class GraphicsItemWithHover : public QGraphicsRectItem { diff --git a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp index 177670bb84..1987a37306 100644 --- a/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/widgets/graphicsview/qgraphicswidget/tst_qgraphicswidget.cpp @@ -53,6 +53,7 @@ #include #include +#include "../../../qtest-config.h" class EventSpy : public QObject { @@ -3203,10 +3204,12 @@ void tst_QGraphicsWidget::itemChangeEvents() valueDuringEvents.insert(QEvent::ParentChange, QVariant::fromValue(parentItem())); break; } +#ifndef QTEST_NO_CURSOR case QEvent::CursorChange: { valueDuringEvents.insert(QEvent::CursorChange, int(cursor().shape())); break; } +#endif case QEvent::ToolTipChange: { valueDuringEvents.insert(QEvent::ToolTipChange, toolTip()); break; @@ -3252,9 +3255,11 @@ void tst_QGraphicsWidget::itemChangeEvents() QVERIFY(!item->isVisible()); QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::Hide).toBool()); +#ifndef QTEST_NO_CURSOR // CursorChange should be triggered after the cursor has changed item->setCursor(Qt::PointingHandCursor); QTRY_COMPARE(item->valueDuringEvents.value(QEvent::CursorChange).toInt(), int(item->cursor().shape())); +#endif // ToolTipChange should be triggered after the tooltip has changed item->setToolTip("tooltipText"); diff --git a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp index 9ea8589e76..abb979c76c 100644 --- a/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp +++ b/tests/auto/widgets/kernel/qapplication/tst_qapplication.cpp @@ -71,6 +71,7 @@ #include +#include "../../../qtest-config.h" QT_BEGIN_NAMESPACE static QWindowSystemInterface::TouchPoint touchPoint(const QTouchEvent::TouchPoint& pt) @@ -2231,7 +2232,9 @@ Q_GLOBAL_STATIC(QPixmap, tst_qapp_pixmap); Q_GLOBAL_STATIC(QFont, tst_qapp_font); Q_GLOBAL_STATIC(QRegion, tst_qapp_region); Q_GLOBAL_STATIC(QFontDatabase, tst_qapp_fontDatabase); +#ifndef QTEST_NO_CURSOR Q_GLOBAL_STATIC(QCursor, tst_qapp_cursor); +#endif void tst_QApplication::globalStaticObjectDestruction() { @@ -2250,7 +2253,9 @@ void tst_QApplication::globalStaticObjectDestruction() QVERIFY(tst_qapp_font()); QVERIFY(tst_qapp_region()); QVERIFY(tst_qapp_fontDatabase()); +#ifndef QTEST_NO_CURSOR QVERIFY(tst_qapp_cursor()); +#endif } //QTEST_APPLESS_MAIN(tst_QApplication) diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 855f7fcc49..167bf28fc3 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -76,6 +76,8 @@ #include #include +#include "../../../qtest-config.h" + #if defined(Q_OS_MAC) #include "tst_qwidget_mac_helpers.h" // Abstract the ObjC stuff out so not everyone must run an ObjC++ compile. #endif @@ -273,7 +275,9 @@ private slots: void deleteStyle(); void multipleToplevelFocusCheck(); void setFocus(); +#ifndef QTEST_NO_CURSOR void setCursor(); +#endif void setToolTip(); void testWindowIconChangeEventPropagation(); @@ -344,7 +348,7 @@ private slots: void setClearAndResizeMask(); void maskedUpdate(); -#if !defined(Q_OS_WINCE_WM) +#ifndef QTEST_NO_CURSOR void syntheticEnterLeave(); void taskQTBUG_4055_sendSyntheticEnterLeave(); #endif @@ -5222,9 +5226,9 @@ private: int m_count; }; +#ifndef QTEST_NO_CURSOR void tst_QWidget::setCursor() { -#ifndef QT_NO_CURSOR { QWidget window; window.resize(200, 200); @@ -5339,8 +5343,8 @@ void tst_QWidget::setCursor() widget.unsetCursor(); QCOMPARE(spy.count(), 2); } -#endif } +#endif void tst_QWidget::setToolTip() { @@ -8491,8 +8495,7 @@ void tst_QWidget::maskedUpdate() QTRY_COMPARE(grandChild.paintedRegion, QRegion(grandChild.rect())); // Full update. } -// Windows Mobile has no proper cursor support, so skip this test on that platform. -#if !defined(Q_OS_WINCE_WM) +#ifndef QTEST_NO_CURSOR void tst_QWidget::syntheticEnterLeave() { class MyWidget : public QWidget @@ -8595,8 +8598,7 @@ void tst_QWidget::syntheticEnterLeave() } #endif -// Windows Mobile has no proper cursor support, so skip this test on that platform. -#if !defined(Q_OS_WINCE_WM) +#ifndef QTEST_NO_CURSOR void tst_QWidget::taskQTBUG_4055_sendSyntheticEnterLeave() { if (m_platform == QStringLiteral("windows") || m_platform == QStringLiteral("xcb")) @@ -8812,7 +8814,9 @@ QWidgetBackingStore* backingStore(QWidget &widget) #ifndef Q_OS_WINCE_WM void tst_QWidget::rectOutsideCoordinatesLimit_task144779() { +#ifndef QTEST_NO_CURSOR QApplication::setOverrideCursor(Qt::BlankCursor); //keep the cursor out of screen grabs +#endif QWidget main(0,Qt::FramelessWindowHint); //don't get confused by the size of the window frame QPalette palette; palette.setColor(QPalette::Window, Qt::red); @@ -8845,7 +8849,9 @@ void tst_QWidget::rectOutsideCoordinatesLimit_task144779() QTRY_COMPARE(mainPixmap.toImage().convertToFormat(QImage::Format_RGB32), correct.toImage().convertToFormat(QImage::Format_RGB32)); +#ifndef QTEST_NO_CURSOR QApplication::restoreOverrideCursor(); +#endif } #endif diff --git a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp index 310e43cd53..dc8b1c12f3 100644 --- a/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp +++ b/tests/auto/widgets/styles/qstylesheetstyle/tst_qstylesheetstyle.cpp @@ -47,7 +47,8 @@ #include #include -#include "../../../platformquirks.h" + +#include "../../../qtest-config.h" class tst_QStyleSheetStyle : public QObject { @@ -78,7 +79,9 @@ private slots: void onWidgetDestroyed(); void fontPrecedence(); void focusColors(); +#ifndef QTEST_NO_CURSOR void hoverColors(); +#endif void background(); void tabAlignement(); void attributesList(); @@ -788,10 +791,9 @@ void tst_QStyleSheetStyle::focusColors() } } +#ifndef QTEST_NO_CURSOR void tst_QStyleSheetStyle::hoverColors() { - if (!PlatformQuirks::haveMouseCursor()) - QSKIP("No mouse Cursor on this platform"); QList widgets; widgets << new QPushButton("TESTING TESTING"); widgets << new QLineEdit("TESTING TESTING"); @@ -880,8 +882,8 @@ void tst_QStyleSheetStyle::hoverColors() (QString::fromLatin1(widget->metaObject()->className()) + " did not contain text color #ff0084").toLocal8Bit().constData()); } - } +#endif class SingleInheritanceDialog : public QDialog { diff --git a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp index 215e25ce6e..08913650ad 100644 --- a/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp +++ b/tests/auto/widgets/widgets/qlineedit/tst_qlineedit.cpp @@ -74,6 +74,7 @@ #include "../../../shared/platforminputcontext.h" #include +#include "../../../qtest-config.h" QT_BEGIN_NAMESPACE class QPainter; @@ -240,7 +241,7 @@ private slots: void noTextEditedOnClear(); -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR void cursor(); #endif @@ -3260,7 +3261,7 @@ void tst_QLineEdit::textMargin() QTRY_COMPARE(testWidget.cursorPosition(), cursorPosition); } -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR void tst_QLineEdit::cursor() { testWidget->setReadOnly(false); diff --git a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp index 1e91c63f16..cf2d0de0e2 100644 --- a/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp +++ b/tests/auto/widgets/widgets/qmainwindow/tst_qmainwindow.cpp @@ -57,6 +57,8 @@ #include #include +#include "../../../qtest-config.h" + static uchar restoreData41[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x0, 0x0, 0x0, 0x0, 0xfd, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x64, 0x0, 0x0, 0x1, 0x19, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x34, 0x1, 0x0, 0x0, 0x0, 0x49, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x38, 0x1, 0x0, 0x0, 0x0, 0x8d, 0x0, 0x0, 0x0, 0x43, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0xd4, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x64, 0x0, 0x0, 0x1, 0x19, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x35, 0x1, 0x0, 0x0, 0x0, 0x49, 0x0, 0x0, 0x0, 0x40, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x39, 0x1, 0x0, 0x0, 0x0, 0x8d, 0x0, 0x0, 0x0, 0x43, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0xd4, 0x0, 0x0, 0x0, 0x45, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x1, 0x89, 0x0, 0x0, 0x0, 0xe, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x36, 0x1, 0x0, 0x0, 0x0, 0x63, 0x0, 0x0, 0x0, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0xc8, 0x0, 0x0, 0x0, 0x5e, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x34, 0x1, 0x0, 0x0, 0x1, 0x2a, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x1, 0x89, 0x0, 0x0, 0x0, 0xe, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x37, 0x1, 0x0, 0x0, 0x0, 0x63, 0x0, 0x0, 0x0, 0x61, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0xc8, 0x0, 0x0, 0x0, 0x5e, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x1, 0x2a, 0x0, 0x0, 0x0, 0x5f, 0x0, 0x0, 0x0, 0x0, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0xc1, 0x0, 0x0, 0x1, 0x19}; static uchar restoreData42[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xfc, 0x0, 0x0, 0x0, 0x0, 0xfd, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x24, 0x0, 0x0, 0x2, 0x2b, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x34, 0x1, 0x0, 0x0, 0x0, 0xb6, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x38, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x87, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x32, 0x1, 0x0, 0x0, 0x1, 0xcd, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x98, 0x0, 0x0, 0x2, 0x2b, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x35, 0x1, 0x0, 0x0, 0x0, 0xb6, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x39, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x87, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x33, 0x1, 0x0, 0x0, 0x1, 0xcd, 0x0, 0x0, 0x0, 0x88, 0x0, 0x0, 0x0, 0x21, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x4, 0x4e, 0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x12, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x36, 0x1, 0x0, 0x0, 0x1, 0x16, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x30, 0x1, 0x0, 0x0, 0x2, 0x28, 0x0, 0x0, 0x1, 0x14, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x34, 0x1, 0x0, 0x0, 0x3, 0x40, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x4, 0x4e, 0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x1, 0x12, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x37, 0x1, 0x0, 0x0, 0x1, 0x16, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x31, 0x1, 0x0, 0x0, 0x2, 0x28, 0x0, 0x0, 0x1, 0x14, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x3, 0x40, 0x0, 0x0, 0x1, 0xe, 0x0, 0x0, 0x0, 0xa, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x3, 0x8a, 0x0, 0x0, 0x2, 0x2b, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8}; static uchar restoreData43[] = { 0x0, 0x0, 0x0, 0xff, 0x0, 0x0, 0x0, 0x0, 0xfd, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x50, 0x0, 0x0, 0x0, 0xa0, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x34, 0x1, 0x0, 0x0, 0x0, 0x53, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x38, 0x1, 0x0, 0x0, 0x0, 0x7c, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0xa5, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x1, 0x0, 0x0, 0x0, 0x98, 0x0, 0x0, 0x0, 0xa0, 0xfc, 0x2, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0x2a, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x35, 0x1, 0x0, 0x0, 0x0, 0x53, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x39, 0x1, 0x0, 0x0, 0x0, 0x7c, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0xa5, 0x0, 0x0, 0x0, 0x25, 0x0, 0x0, 0x0, 0x16, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x2, 0x0, 0x0, 0x1, 0xa8, 0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x32, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x68, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x36, 0x1, 0x0, 0x0, 0x0, 0x6c, 0x0, 0x0, 0x0, 0x66, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x30, 0x1, 0x0, 0x0, 0x0, 0xd6, 0x0, 0x0, 0x0, 0x68, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x34, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x66, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0x3, 0x0, 0x0, 0x1, 0xa8, 0x0, 0x0, 0x0, 0x26, 0xfc, 0x1, 0x0, 0x0, 0x0, 0x4, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x33, 0x1, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x68, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xc, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x37, 0x1, 0x0, 0x0, 0x0, 0x6c, 0x0, 0x0, 0x0, 0x66, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x31, 0x1, 0x0, 0x0, 0x0, 0xd6, 0x0, 0x0, 0x0, 0x68, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0xfb, 0x0, 0x0, 0x0, 0xe, 0x0, 0x64, 0x0, 0x6f, 0x0, 0x63, 0x0, 0x6b, 0x0, 0x20, 0x0, 0x31, 0x0, 0x35, 0x1, 0x0, 0x0, 0x1, 0x42, 0x0, 0x0, 0x0, 0x66, 0x0, 0x0, 0x0, 0x50, 0x0, 0xff, 0xff, 0xff, 0x0, 0x0, 0x0, 0xb8, 0x0, 0x0, 0x0, 0xa0, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x4, 0x0, 0x0, 0x0, 0x8, 0x0, 0x0, 0x0, 0x8, 0xfc, 0x0, 0x0, 0x0, 0x0}; @@ -137,7 +139,7 @@ private slots: void statusBar(); #endif void isSeparator(); -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR void setCursor(); #endif void addToolbarAfterShow(); @@ -1646,7 +1648,7 @@ class MainWindow : public QMainWindow { using QMainWindow::event; }; -#ifndef QT_NO_CURSOR +#ifndef QTEST_NO_CURSOR void tst_QMainWindow::setCursor() { MainWindow mw; diff --git a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp index 589f157254..3807bad1ba 100644 --- a/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp +++ b/tests/auto/widgets/widgets/qmdisubwindow/tst_qmdisubwindow.cpp @@ -63,6 +63,8 @@ #include #endif +#include "../../../qtest-config.h" + QT_BEGIN_NAMESPACE #if !defined(Q_WS_WIN) extern bool qt_tab_all_widgets(); @@ -173,8 +175,10 @@ private slots: void showShaded(); void showNormal_data(); void showNormal(); +#ifndef QTEST_NO_CURSOR void setOpaqueResizeAndMove_data(); void setOpaqueResizeAndMove(); +#endif void setWindowFlags_data(); void setWindowFlags(); void mouseDoubleClick(); @@ -677,6 +681,7 @@ private: int _count; }; +#ifndef QTEST_NO_CURSOR void tst_QMdiSubWindow::setOpaqueResizeAndMove_data() { QTest::addColumn("opaqueMode"); @@ -691,9 +696,6 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove_data() void tst_QMdiSubWindow::setOpaqueResizeAndMove() { -#if defined (QT_NO_CURSOR) || defined (Q_OS_WINCE_WM) //For Windows CE we will set QT_NO_CURSOR if there is no cursor support - QSKIP("No cursor available"); -#endif QFETCH(bool, opaqueMode); QFETCH(int, geometryCount); QFETCH(int, expectedGeometryCount); @@ -800,6 +802,7 @@ void tst_QMdiSubWindow::setOpaqueResizeAndMove() QCOMPARE(window->size(), windowSize + QSize(geometryCount, geometryCount)); } } +#endif void tst_QMdiSubWindow::setWindowFlags_data() { diff --git a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp index a71302096f..836333ceb1 100644 --- a/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp +++ b/tests/auto/widgets/widgets/qplaintextedit/tst_qplaintextedit.cpp @@ -60,6 +60,8 @@ #include "qplaintextedit.h" #include "../../../shared/platformclipboard.h" +#include "../../../qtest-config.h" + //Used in copyAvailable typedef QPair keyPairType; typedef QList pairListType; @@ -115,7 +117,9 @@ private slots: void shiftDownInLineLastShouldSelectToEnd(); void undoRedoShouldRepositionTextEditCursor(); void lineWrapModes(); +#ifndef QTEST_NO_CURSOR void mouseCursorShape(); +#endif void implicitClear(); void undoRedoAfterSetContent(); void numPadKeyNavigation(); @@ -869,9 +873,9 @@ void tst_QPlainTextEdit::lineWrapModes() delete window; } +#ifndef QTEST_NO_CURSOR void tst_QPlainTextEdit::mouseCursorShape() { -#ifndef QT_NO_CURSOR // always show an IBeamCursor, see change 170146 QVERIFY(!ed->isReadOnly()); QVERIFY(ed->viewport()->cursor().shape() == Qt::IBeamCursor); @@ -881,8 +885,8 @@ void tst_QPlainTextEdit::mouseCursorShape() ed->setPlainText("Foo"); QVERIFY(ed->viewport()->cursor().shape() == Qt::IBeamCursor); -#endif } +#endif void tst_QPlainTextEdit::implicitClear() { diff --git a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp index cc718ea51f..ec656d35d7 100644 --- a/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp +++ b/tests/auto/widgets/widgets/qtextedit/tst_qtextedit.cpp @@ -68,6 +68,7 @@ #include "../../../shared/platforminputcontext.h" #include +#include "../../../qtest-config.h" //Used in copyAvailable typedef QPair keyPairType; @@ -141,7 +142,9 @@ private slots: void shiftDownInLineLastShouldSelectToEnd(); void undoRedoShouldRepositionTextEditCursor(); void lineWrapModes(); +#ifndef QTEST_NO_CURSOR void mouseCursorShape(); +#endif void implicitClear(); void undoRedoAfterSetContent(); void numPadKeyNavigation(); @@ -1235,9 +1238,9 @@ void tst_QTextEdit::lineWrapModes() QCOMPARE(ed->document()->pageSize().width(), qreal(1000)); } +#ifndef QTEST_NO_CURSOR void tst_QTextEdit::mouseCursorShape() { -#ifndef QT_NO_CURSOR // always show an IBeamCursor, see change 170146 QVERIFY(!ed->isReadOnly()); QVERIFY(ed->viewport()->cursor().shape() == Qt::IBeamCursor); @@ -1247,8 +1250,8 @@ void tst_QTextEdit::mouseCursorShape() ed->setPlainText("Foo"); QVERIFY(ed->viewport()->cursor().shape() == Qt::IBeamCursor); -#endif } +#endif void tst_QTextEdit::implicitClear() { From a87a0cb050d275bc5963d4e9899223b1d1251422 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 12 Oct 2012 09:21:30 +0200 Subject: [PATCH 16/84] qfeatures.txt: cleanup obsolete cde & motif styles both styles were removed in 570ae4 Change-Id: I47b3b268191aecd1c04f1c1f1bd0f500332e3ef8 Reviewed-by: Jens Bache-Wiig --- src/corelib/global/qfeatures.txt | 14 -------------- 1 file changed, 14 deletions(-) diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 1a721e78b0..5e386b8569 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -727,20 +727,6 @@ Requires: Name: QWindowsStyle SeeAlso: ??? -Feature: STYLE_MOTIF -Description: Supports a Motif look and feel. -Section: Styles -Requires: -Name: QMotifStyle -SeeAlso: ??? - -Feature: STYLE_CDE -Description: Supports a CDE look and feel. -Section: Styles -Requires: STYLE_MOTIF -Name: QCDEStyle -SeeAlso: ??? - Feature: STYLE_PLASTIQUE Description: Supports a widget style similar to the Plastik style available in KDE. Section: Styles From aea07d1f41b25c77c788dcd192eb70bda9835ae8 Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Fri, 12 Oct 2012 09:22:40 +0200 Subject: [PATCH 17/84] Remove unused private header This was a leftover after removing motif style from the repo. Change-Id: I98d47a9443ffce2be34d73e779a0787c0b68913f Reviewed-by: Jens Bache-Wiig Reviewed-by: J-P Nurmi --- src/widgets/styles/qmotifstyle_p.h | 82 ------------------------------ 1 file changed, 82 deletions(-) delete mode 100644 src/widgets/styles/qmotifstyle_p.h diff --git a/src/widgets/styles/qmotifstyle_p.h b/src/widgets/styles/qmotifstyle_p.h deleted file mode 100644 index 76f8c01119..0000000000 --- a/src/widgets/styles/qmotifstyle_p.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the QtGui module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** 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, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, 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. -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QMOTIFSTYLE_P_H -#define QMOTIFSTYLE_P_H -#include -#include -#include -#include "qmotifstyle.h" -#include "qcommonstyle_p.h" - -QT_BEGIN_NAMESPACE - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists for the convenience -// of qapplication_*.cpp, qwidget*.cpp and qfiledialog.cpp. This header -// file may change from version to version without notice, or even be removed. -// -// We mean it. -// - -// Private class -class QMotifStylePrivate : public QCommonStylePrivate -{ - Q_DECLARE_PUBLIC(QMotifStyle) -public: - QMotifStylePrivate(); - -public: -#ifndef QT_NO_PROGRESSBAR - QList bars; - int animationFps; - int animateTimer; - QTime startTime; - int animateStep; -#endif // QT_NO_PROGRESSBAR -}; - -QT_END_NAMESPACE - -#endif //QMOTIFSTYLE_P_H From a1082dbc3f61f1747bd756f8fce2a54f558793ed Mon Sep 17 00:00:00 2001 From: Thomas McGuire Date: Tue, 9 Oct 2012 14:07:28 +0200 Subject: [PATCH 18/84] Blackberry: Emit aboutToBlock() and awake() correctly in the dispatcher On Blackberry, select() can actually temporarily wake up to process mative BPS events. Make sure to emit the aboutToBlock() and awake() signals in this situation accordingly. Change-Id: Ib324e702feb1cfebdc6926f80af9c92f291a2b94 Reviewed-by: Rafael Roquetto Reviewed-by: Kevin Krammer Reviewed-by: Sean Harmer --- .../kernel/qeventdispatcher_blackberry.cpp | 39 +++++++++++++++---- 1 file changed, 31 insertions(+), 8 deletions(-) diff --git a/src/corelib/kernel/qeventdispatcher_blackberry.cpp b/src/corelib/kernel/qeventdispatcher_blackberry.cpp index a553999121..33ca1023dd 100644 --- a/src/corelib/kernel/qeventdispatcher_blackberry.cpp +++ b/src/corelib/kernel/qeventdispatcher_blackberry.cpp @@ -295,14 +295,35 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef if (timeout) timeout_bps = (timeout->tv_sec * 1000) + (timeout->tv_usec / 1000); + bool hasProcessedEventsOnce = false; + bps_event_t *event = 0; + // This loop exists such that we can drain the bps event queue of all native events // more efficiently than if we were to return control to Qt after each event. This // is important for handling touch events which can come in rapidly. forever { - // Wait for event or file to be ready - bps_event_t *event = NULL; - const int result = bps_get_event(&event, timeout_bps); + Q_ASSERT(!hasProcessedEventsOnce || event); + // Only emit the awake() and aboutToBlock() signals in the second iteration. For the first + // iteration, the UNIX event dispatcher will have taken care of that already. + if (hasProcessedEventsOnce) + emit awake(); + + // Filtering the native event should happen between the awake() and aboutToBlock() signal + // emissions. The calls awake() - filterNativeEvent() - aboutToBlock() - bps_get_event() + // need not to be interrupted by a break or return statement. + // + // Because of this, the native event is actually processed one loop iteration + // after it was retrieved with bps_get_event(). + if (event) + filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast(event), 0); + + if (hasProcessedEventsOnce) + emit aboutToBlock(); + + // Wait for event or file to be ready + event = 0; + const int result = bps_get_event(&event, timeout_bps); if (result != BPS_SUCCESS) qWarning("QEventDispatcherBlackberry::select: bps_get_event() failed"); @@ -314,14 +335,16 @@ int QEventDispatcherBlackberry::select(int nfds, fd_set *readfds, fd_set *writef if (!event || bps_event_get_domain(event) == bpsIOReadyDomain) break; - // Any other events must be bps native events so we pass all such received - // events through the native event filter chain - filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast(event), 0); - // Update the timeout. If this fails we have exceeded our alloted time or the system // clock has changed time and we cannot calculate a new timeout so we bail out. - if (!updateTimeout(&timeout_bps, startTime)) + if (!updateTimeout(&timeout_bps, startTime)) { + + // No more loop iteration, so we need to filter the event here. + filterNativeEvent(QByteArrayLiteral("bps_event_t"), static_cast(event), 0); break; + } + + hasProcessedEventsOnce = true; } // the number of bits set in the file sets From 49f277482e86d21edf9a055229100486aaf8b4c0 Mon Sep 17 00:00:00 2001 From: Fabian Bumberger Date: Tue, 9 Oct 2012 19:34:29 +0200 Subject: [PATCH 19/84] Blackberry: Populating the QCoreApplicationData Change-Id: I7adb2e207cab89fbad9458cd0bcb856ecd2288f0 Reviewed-by: Peter Hartmann Reviewed-by: Giuseppe D'Angelo --- src/corelib/kernel/qcoreapplication.cpp | 47 +++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index fd423d4479..1e4a6f4c8c 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -264,6 +264,35 @@ struct QCoreApplicationData { data->deref(); // deletes the data and the adopted thread } } + +#ifdef Q_OS_BLACKBERRY + //The QCoreApplicationData struct is only populated on demand, because it is rarely needed and would + //affect startup time + void loadManifest() { + static bool manifestLoadAttempt = false; + if (manifestLoadAttempt) + return; + + manifestLoadAttempt = true; + + QFile metafile(QStringLiteral("app/META-INF/MANIFEST.MF")); + if (!metafile.open(QIODevice::ReadOnly)) { + qWarning() << Q_FUNC_INFO << "Could not open application metafile for reading"; + } else { + while (!metafile.atEnd() && (application.isEmpty() || applicationVersion.isEmpty() || orgName.isEmpty())) { + QByteArray line = metafile.readLine(); + if (line.startsWith("Application-Name:")) + application = QString::fromUtf8(line.mid(18).trimmed()); + else if (line.startsWith("Application-Version:")) + applicationVersion = QString::fromUtf8(line.mid(21).trimmed()); + else if (line.startsWith("Package-Author:")) + orgName = QString::fromUtf8(line.mid(16).trimmed()); + } + metafile.close(); + } + } +#endif + QString orgName, orgDomain, application; QString applicationVersion; @@ -1765,6 +1794,15 @@ QString QCoreApplication::applicationFilePath() #if defined(Q_OS_WIN) d->cachedApplicationFilePath = QFileInfo(qAppFileName()).filePath(); return d->cachedApplicationFilePath; +#elif defined(Q_OS_BLACKBERRY) + QDir dir(QStringLiteral("./app/native/")); + QStringList executables = dir.entryList(QDir::Executable | QDir::Files); + if (!executables.empty()) { + //We assume that there is only one executable in the folder + return dir.absoluteFilePath(executables.first()); + } else { + return QString(); + } #elif defined(Q_OS_MAC) QString qAppFileName_str = qAppFileName(); if(!qAppFileName_str.isEmpty()) { @@ -1930,6 +1968,9 @@ void QCoreApplication::setOrganizationName(const QString &orgName) QString QCoreApplication::organizationName() { +#ifdef Q_OS_BLACKBERRY + coreappdata()->loadManifest(); +#endif return coreappdata()->orgName; } @@ -1977,6 +2018,9 @@ void QCoreApplication::setApplicationName(const QString &application) QString QCoreApplication::applicationName() { +#ifdef Q_OS_BLACKBERRY + coreappdata()->loadManifest(); +#endif QString appname = coreappdata() ? coreappdata()->application : QString(); if (appname.isEmpty() && QCoreApplication::self) appname = QCoreApplication::self->d_func()->appName(); @@ -2003,6 +2047,9 @@ void QCoreApplication::setApplicationVersion(const QString &version) QString QCoreApplication::applicationVersion() { +#ifdef Q_OS_BLACKBERRY + coreappdata()->loadManifest(); +#endif return coreappdata()->applicationVersion; } From 491247acd4b12ce563ecaa67cd144ff073d84cc4 Mon Sep 17 00:00:00 2001 From: Giuseppe D'Angelo Date: Sun, 7 Oct 2012 16:09:46 +0100 Subject: [PATCH 20/84] Make QValidator tests do not require a QApplication Change-Id: I9aae997e33672203470b0429cc061a1adf88dfe9 Reviewed-by: Robin Burchell Reviewed-by: Rohan McGovern Reviewed-by: David Faure Reviewed-by: Marc Mutz --- tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp | 2 +- tests/auto/gui/util/qregexpvalidator/tst_qregexpvalidator.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp b/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp index a000bbebcc..1bdb17682f 100644 --- a/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp +++ b/tests/auto/gui/util/qintvalidator/tst_qintvalidator.cpp @@ -286,5 +286,5 @@ void tst_QIntValidator::notifySignals() QCOMPARE(changedSpy.count(), 6); } -QTEST_MAIN(tst_QIntValidator) +QTEST_APPLESS_MAIN(tst_QIntValidator) #include "tst_qintvalidator.moc" diff --git a/tests/auto/gui/util/qregexpvalidator/tst_qregexpvalidator.cpp b/tests/auto/gui/util/qregexpvalidator/tst_qregexpvalidator.cpp index 77075372f8..b3631d2016 100644 --- a/tests/auto/gui/util/qregexpvalidator/tst_qregexpvalidator.cpp +++ b/tests/auto/gui/util/qregexpvalidator/tst_qregexpvalidator.cpp @@ -122,5 +122,5 @@ void tst_QRegExpValidator::validate() QCOMPARE(changedSpy.count(), 1); } -QTEST_MAIN(tst_QRegExpValidator) +QTEST_APPLESS_MAIN(tst_QRegExpValidator) #include "tst_qregexpvalidator.moc" From eda0e120e9e2e7b7be747f4ed035d686c9547769 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Wed, 10 Oct 2012 15:43:50 -0300 Subject: [PATCH 21/84] Fix number of available printers in CUPS support. If the number of available printers changes, we want to update the count. Additionally, if that number has gone to zero, we want to ensure that the number of available printers in the static object is reset to zero. This fixes a crash that occurs if: * You print * You kill cupsd (or it crashes because you're porting it and your port is unstable) * You try to print again before restarting it. Change-Id: I6c6069db9d800ce7426e75df760829fea278e56e Reviewed-by: Sean Harmer Reviewed-by: Lars Knoll --- src/printsupport/kernel/qcups.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/printsupport/kernel/qcups.cpp b/src/printsupport/kernel/qcups.cpp index dd385526d7..ea18f1edf6 100644 --- a/src/printsupport/kernel/qcups.cpp +++ b/src/printsupport/kernel/qcups.cpp @@ -135,7 +135,7 @@ QCUPSSupport::QCUPSSupport() if (!isAvailable()) return; - prnCount = _cupsGetDests(&printers); + qt_cups_num_printers = prnCount = _cupsGetDests(&printers); for (int i = 0; i < prnCount; ++i) { if (printers[i].is_default) { From 9ab8c0ae98f2e488f362484c2c2d1dc6a5ae1d1e Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 12 Oct 2012 14:06:19 +0200 Subject: [PATCH 22/84] Fix moc preprocessor-only mode with input that contains seemingly invalid identifiers In WebKit we use moc -E to pre-process various files before throwing at further build creation tools. The pre-processing is used to filter out code depending in #ifdef'fed features. The latest addition to the family of pre-processed files is the CSS grammar, which is written in Bison. It contains rule lines like $$ = parser->createFoo() and when pre-processing this moc stumbles over the dollar sign. Instead of ignoring un-tokenizable input we should add it to the current token if we're in preprocessor-only mode, otherwise the $$ gets eaten and we produce data-loss by printing out less characters than. Change-Id: Ib32e7c04b38dd2ba3726201e76f27405f7ea6c0d Reviewed-by: Olivier Goffart --- src/tools/moc/preprocessor.cpp | 7 +++-- tests/auto/tools/moc/pp-dollar-signs.h | 42 ++++++++++++++++++++++++++ tests/auto/tools/moc/tst_moc.cpp | 21 +++++++++++++ 3 files changed, 68 insertions(+), 2 deletions(-) create mode 100644 tests/auto/tools/moc/pp-dollar-signs.h diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index fd8813ee88..40bba33d40 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -193,9 +193,12 @@ static Symbols tokenize(const QByteArray &input, int lineNum = 1, TokenizeMode m token = keywords[state].ident; if (token == NOTOKEN) { - // an error really ++data; - continue; + // an error really, but let's ignore this input + // to not confuse moc later. However in pre-processor + // only mode let's continue. + if (!Preprocessor::preprocessOnly) + continue; } ++column; diff --git a/tests/auto/tools/moc/pp-dollar-signs.h b/tests/auto/tools/moc/pp-dollar-signs.h new file mode 100644 index 0000000000..c19b26136c --- /dev/null +++ b/tests/auto/tools/moc/pp-dollar-signs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the test suite of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +$$ = parser->createFoo() diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index ede486ebc0..0cd6c295cc 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -554,6 +554,7 @@ private slots: void autoPropertyMetaTypeRegistration(); void autoMethodArgumentMetaTypeRegistration(); void parseDefines(); + void preprocessorOnly(); signals: void sigWithUnsignedArg(unsigned foo); @@ -2760,6 +2761,26 @@ void tst_Moc::parseDefines() QVERIFY(count == 2); } +void tst_Moc::preprocessorOnly() +{ +#ifdef MOC_CROSS_COMPILED + QSKIP("Not tested when cross-compiled"); +#endif +#if defined(Q_OS_LINUX) && defined(Q_CC_GNU) && !defined(QT_NO_PROCESS) + QProcess proc; + proc.start("moc", QStringList() << "-E" << srcify("/pp-dollar-signs.h")); + QVERIFY(proc.waitForFinished()); + QCOMPARE(proc.exitCode(), 0); + QByteArray mocOut = proc.readAllStandardOutput(); + QVERIFY(!mocOut.isEmpty()); + QCOMPARE(proc.readAllStandardError(), QByteArray()); + + QVERIFY(mocOut.contains("$$ = parser->createFoo()")); +#else + QSKIP("Only tested on linux/gcc"); +#endif +} + QTEST_MAIN(tst_Moc) #include "tst_moc.moc" From 57fac2e83a27c9a2da1932991692586c42d97ddc Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 4 Oct 2012 15:02:48 +0200 Subject: [PATCH 23/84] Do not accept key events if a widget is disabled The disabled state was handled in qapplication_xxx.cpp before. As the platform integration only knows about windows and not widgets the state check is now done in qwidget. This commit just adds key events to the list of events which are ignored if the widget is disabled. This list also contains mouse events for example. Task-number: QTBUG-27417 Change-Id: I55949e1c1aaa992ba71df51c5b5e8177ec6f1e86 Reviewed-by: Friedemann Kleint Reviewed-by: Marc Mutz --- src/widgets/kernel/qwidget.cpp | 4 +- .../widgets/kernel/qwidget/tst_qwidget.cpp | 39 +++++++++++++++++++ 2 files changed, 42 insertions(+), 1 deletion(-) diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 362a8f4e55..29083b0670 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -7807,7 +7807,7 @@ bool QWidget::event(QEvent *event) { Q_D(QWidget); - // ignore mouse events when disabled + // ignore mouse and key events when disabled if (!isEnabled()) { switch(event->type()) { case QEvent::TabletPress: @@ -7822,6 +7822,8 @@ bool QWidget::event(QEvent *event) case QEvent::TouchEnd: case QEvent::TouchCancel: case QEvent::ContextMenu: + case QEvent::KeyPress: + case QEvent::KeyRelease: #ifndef QT_NO_WHEELEVENT case QEvent::Wheel: #endif diff --git a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp index 167bf28fc3..07ed38fa61 100644 --- a/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp +++ b/tests/auto/widgets/kernel/qwidget/tst_qwidget.cpp @@ -174,6 +174,8 @@ private slots: void palettePropagation(); void palettePropagation2(); void enabledPropagation(); + void ignoreKeyEventsWhenDisabled_QTBUG27417(); + void properTabHandlingWhenDisabled_QTBUG27417(); void popupEnterLeave(); #ifndef QT_NO_DRAGANDDROP void acceptDropsPropagation(); @@ -1053,6 +1055,43 @@ void tst_QWidget::enabledPropagation() QVERIFY( !grandChildWidget->isEnabled() ); } +void tst_QWidget::ignoreKeyEventsWhenDisabled_QTBUG27417() +{ + QLineEdit lineEdit; + lineEdit.setDisabled(true); + lineEdit.show(); + QTest::keyClick(&lineEdit, Qt::Key_A); + QTRY_VERIFY(lineEdit.text().isEmpty()); +} + +void tst_QWidget::properTabHandlingWhenDisabled_QTBUG27417() +{ + QWidget widget; + QVBoxLayout *layout = new QVBoxLayout(); + QLineEdit *lineEdit = new QLineEdit(); + layout->addWidget(lineEdit); + QLineEdit *lineEdit2 = new QLineEdit(); + layout->addWidget(lineEdit2); + QLineEdit *lineEdit3 = new QLineEdit(); + layout->addWidget(lineEdit3); + widget.setLayout(layout); + widget.show(); + + lineEdit->setFocus(); + QTRY_VERIFY(lineEdit->hasFocus()); + QTest::keyClick(&widget, Qt::Key_Tab); + QTRY_VERIFY(lineEdit2->hasFocus()); + QTest::keyClick(&widget, Qt::Key_Tab); + QTRY_VERIFY(lineEdit3->hasFocus()); + + lineEdit2->setDisabled(true); + lineEdit->setFocus(); + QTRY_VERIFY(lineEdit->hasFocus()); + QTest::keyClick(&widget, Qt::Key_Tab); + QTRY_VERIFY(!lineEdit2->hasFocus()); + QVERIFY(lineEdit3->hasFocus()); +} + // Drag'n drop disabled in this build. #ifndef QT_NO_DRAGANDDROP void tst_QWidget::acceptDropsPropagation() From dc57295a7bd41768c131f4154161c274fb4c9857 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mill=C3=A1n=20Soto?= Date: Wed, 26 Sep 2012 13:11:35 +0200 Subject: [PATCH 24/84] Check that row and column are not less than 0 in indexFromLogical Change-Id: Icf6dbb234513de12c772618a046461b8674b01ce Reviewed-by: Marc Mutz --- src/plugins/accessible/widgets/itemviews.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/accessible/widgets/itemviews.cpp b/src/plugins/accessible/widgets/itemviews.cpp index a8c42c9f59..649863ed84 100644 --- a/src/plugins/accessible/widgets/itemviews.cpp +++ b/src/plugins/accessible/widgets/itemviews.cpp @@ -407,7 +407,7 @@ QModelIndex QAccessibleTree::indexFromLogical(int row, int column) const return QModelIndex(); const QTreeView *treeView = qobject_cast(view()); - if (treeView->d_func()->viewItems.count() <= row) { + if ((row < 0) || (column < 0) || (treeView->d_func()->viewItems.count() <= row)) { qWarning() << "QAccessibleTree::indexFromLogical: invalid index: " << row << column << " for " << treeView; return QModelIndex(); } From befea1d93285bdf2ea8134718fb9c74a89bc551e Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 12 Oct 2012 16:57:22 +0200 Subject: [PATCH 25/84] Link to Item Views Puzzle Example in QListView docs. Change-Id: I75972727077fa1aa1ec66995c4d0ea67057d283b Reviewed-by: Geir Vattekar --- src/widgets/itemviews/qlistview.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp index 097802c909..ff703c9d8a 100644 --- a/src/widgets/itemviews/qlistview.cpp +++ b/src/widgets/itemviews/qlistview.cpp @@ -123,7 +123,7 @@ QT_BEGIN_NAMESPACE that can be taken for views that are intended to display items with equal sizes is to set the \l uniformItemSizes property to true. - \sa {View Classes}, QTreeView, QTableView, QListWidget + \sa {View Classes}, {Item Views Puzzle Example}, QTreeView, QTableView, QListWidget */ /*! From ce81da52ea1fffa67188e19eb9dbba66501dd82f Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Wed, 3 Oct 2012 14:53:33 +0200 Subject: [PATCH 26/84] Make sure timestamp is initialized before using it for seting selection owner. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Convention from icccm: Clients attempting to acquire a selection must set the time value of the xcb_set_selection_owner request to the timestamp of the event triggering the acquisition attempt, not to XCB_CURRENT_TIME. In some cases it happened that timestamp was set to XCB_CURRENT_TIME. A zero-length append to a property is a way to obtain a timestamp for this purpose; the timestamp is in the corresponding XCB_PROPERTY_NOTIFY event. We used to have this mechanism in 4.8, it was achieved by XWindowEvent. AFAIK there isn't an equivalent for XWindowEvent in XCB. Therefore i had to introduce a new mechanism in QXcbConnection - getTimestamp. This function blocks until it receives the requested event. Change-Id: Ide46a4fdd44cf026fdd17a79d3c4b17741d1b7d4 Task-number: QTBUG-26783 Reviewed-by: Uli Schlachter Reviewed-by: Lars Knoll Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qxcbclipboard.cpp | 3 ++ src/plugins/platforms/xcb/qxcbconnection.cpp | 53 ++++++++++++++++++++ src/plugins/platforms/xcb/qxcbconnection.h | 3 +- 3 files changed, 58 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbclipboard.cpp b/src/plugins/platforms/xcb/qxcbclipboard.cpp index f021ab8b4a..142a8dfcde 100644 --- a/src/plugins/platforms/xcb/qxcbclipboard.cpp +++ b/src/plugins/platforms/xcb/qxcbclipboard.cpp @@ -300,6 +300,9 @@ void QXcbClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) m_timestamp[mode] = XCB_CURRENT_TIME; } + if (connection()->time() == XCB_CURRENT_TIME) + connection()->setTime(connection()->getTimestamp()); + if (data) { newOwner = owner(); diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 401739f7d5..ad9fb1d19c 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -864,6 +864,59 @@ void QXcbConnection::sendConnectionEvent(QXcbAtom::Atom a, uint id) xcb_flush(xcb_connection()); } +namespace +{ + class PropertyNotifyEvent { + public: + PropertyNotifyEvent(xcb_window_t win, xcb_atom_t property) + : window(win), type(XCB_PROPERTY_NOTIFY), atom(property) {} + xcb_window_t window; + int type; + xcb_atom_t atom; + bool checkEvent(xcb_generic_event_t *event) const { + if (!event) + return false; + if ((event->response_type & ~0x80) != type) { + return false; + } else { + xcb_property_notify_event_t *pn = (xcb_property_notify_event_t *)event; + if ((pn->window == window) && (pn->atom == atom)) + return true; + } + return false; + } + }; +} + +xcb_timestamp_t QXcbConnection::getTimestamp() +{ + // send a dummy event to myself to get the timestamp from X server. + xcb_window_t rootWindow = screens().at(primaryScreen())->root(); + xcb_change_property(xcb_connection(), XCB_PROP_MODE_APPEND, rootWindow, atom(QXcbAtom::CLIP_TEMPORARY), + XCB_ATOM_INTEGER, 32, 0, NULL); + + connection()->flush(); + PropertyNotifyEvent checker(rootWindow, atom(QXcbAtom::CLIP_TEMPORARY)); + + xcb_generic_event_t *event = 0; + // lets keep this inside a loop to avoid a possible race condition, where + // reader thread has not yet had the time to acquire the mutex in order + // to add the new set of events to its event queue + while (true) { + connection()->sync(); + if (event = checkEvent(checker)) + break; + } + + xcb_property_notify_event_t *pn = (xcb_property_notify_event_t *)event; + xcb_timestamp_t timestamp = pn->time; + free(event); + + xcb_delete_property(xcb_connection(), rootWindow, atom(QXcbAtom::CLIP_TEMPORARY)); + + return timestamp; +} + void QXcbConnection::processXcbEvents() { QXcbEventArray *eventqueue = m_reader->lock(); diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 08dd304b3d..8a6c418788 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -319,7 +319,6 @@ public: QByteArray atomName(xcb_atom_t atom); const char *displayName() const { return m_displayName.constData(); } - xcb_connection_t *xcb_connection() const { return m_connection; } const xcb_setup_t *setup() const { return m_setup; } const xcb_format_t *formatForDepth(uint8_t depth) const; @@ -380,6 +379,8 @@ public: bool hasXRandr() const { return has_randr_extension; } bool hasInputShape() const { return has_input_shape; } + xcb_timestamp_t getTimestamp(); + private slots: void processXcbEvents(); From d70cb669324be5ec94fdf7d5620e28b55295c295 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Mon, 1 Oct 2012 14:04:09 +0200 Subject: [PATCH 27/84] Simplify transaction expiry mechanism MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This patch makes transaction mechanism less scattered around and conforms to the xdnd specification: Don't block and keep a history of previous data. This can be very difficult to implement, but it is clearly the ideal behavior from the user's perspective because it allows him to drop something and then continue working with the assurance that the target will get the data regardless of how slow the network connections are. When the source receives XdndFinished, it can remove the item from its history, thereby keeping it from getting too large. The source must also be prepared to throw out extremely old data in case a target malfunctions. I assume that 10min for drag-and-drop operation can be considered 'extremely' old data. Change-Id: I73dcd21aee3ad188d2260e49d80824da6ba040ab Task-numer: QTBUG-14493 Reviewed-by: David Faure (fixes for KDE) Reviewed-by: Samuel Rødal --- src/plugins/platforms/xcb/qxcbdrag.cpp | 63 ++++++++++++++------------ src/plugins/platforms/xcb/qxcbdrag.h | 7 ++- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index 1a2de82fd3..5d887cd06d 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -53,6 +53,7 @@ #include #include #include +#include #include @@ -140,8 +141,7 @@ QXcbDrag::QXcbDrag(QXcbConnection *c) : QXcbObject(c) init(); heartbeat = -1; - - transaction_expiry_timer = -1; + cleanup_timer = -1; } QXcbDrag::~QXcbDrag() @@ -510,17 +510,21 @@ void QXcbDrag::drop(const QMouseEvent *event) if (w && (w->window()->windowType() == Qt::Desktop) /*&& !w->acceptDrops()*/) w = 0; - Transaction t = { connection()->time(), current_target, current_proxy_target, (w ? w->window() : 0), -// current_embedding_widget, - currentDrag() +// current_embeddig_widget, + currentDrag(), + QTime::currentTime() }; transactions.append(t); - restartDropExpiryTimer(); + + // timer is needed only for drops that came from other processes. + if (!t.targetWindow && cleanup_timer == -1) { + cleanup_timer = startTimer(XdndDropTransactionTimeout); + } if (w) { handleDrop(w->window(), &drop); @@ -563,16 +567,6 @@ xcb_atom_t QXcbDrag::toXdndAction(Qt::DropAction a) const } } -// timer used to discard old XdndDrop transactions -enum { XdndDropTransactionTimeout = 5000 }; // 5 seconds - -void QXcbDrag::restartDropExpiryTimer() -{ - if (transaction_expiry_timer != -1) - killTimer(transaction_expiry_timer); - transaction_expiry_timer = startTimer(XdndDropTransactionTimeout); -} - int QXcbDrag::findTransactionByWindow(xcb_window_t window) { int at = -1; @@ -771,8 +765,6 @@ void QXcbDrag::handle_xdnd_position(QWindow *w, const xcb_client_message_event_t response.data.data32[3] = 0; // w, h response.data.data32[4] = toXdndAction(qt_response.acceptedAction()); // action - - if (answerRect.left() < 0) answerRect.setLeft(0); if (answerRect.right() > 4096) @@ -1015,7 +1007,6 @@ void QXcbDrag::handleFinished(const xcb_client_message_event_t *event) if (l[0]) { int at = findTransactionByWindow(l[0]); if (at != -1) { - restartDropExpiryTimer(); Transaction t = transactions.takeAt(at); // QDragManager *manager = QDragManager::self(); @@ -1044,12 +1035,13 @@ void QXcbDrag::handleFinished(const xcb_client_message_event_t *event) // current_proxy_target = proxy_target; // current_embedding_widget = embedding_widget; // manager->object = currentObject; + } else { + qWarning("QXcbDrag::handleFinished - drop data has expired"); } } waiting_for_status = false; } - void QXcbDrag::timerEvent(QTimerEvent* e) { if (e->timerId() == heartbeat && source_sameanswer.isNull()) { @@ -1057,19 +1049,35 @@ void QXcbDrag::timerEvent(QTimerEvent* e) QMouseEvent me(QEvent::MouseMove, pos, pos, pos, Qt::LeftButton, QGuiApplication::mouseButtons(), QGuiApplication::keyboardModifiers()); move(&me); - } else if (e->timerId() == transaction_expiry_timer) { + } else if (e->timerId() == cleanup_timer) { + bool stopTimer = true; for (int i = 0; i < transactions.count(); ++i) { const Transaction &t = transactions.at(i); if (t.targetWindow) { - // dnd within the same process, don't delete these + // dnd within the same process, don't delete, these are taken care of + // in handleFinished() continue; } - t.drag->deleteLater(); - transactions.removeAt(i--); - } + QTime currentTime = QTime::currentTime(); + int delta = t.time.msecsTo(currentTime); + if (delta > XdndDropTransactionTimeout) { + /* delete transactions which are older than XdndDropTransactionTimeout. It could mean + one of these: + - client has crashed and as a result we have never received XdndFinished + - showing dialog box on drop event where user's response takes more time than XdndDropTransactionTimeout (QTBUG-14493) + - dnd takes unusually long time to process data + */ + t.drag->deleteLater(); + transactions.removeAt(i--); + } else { + stopTimer = false; + } - killTimer(transaction_expiry_timer); - transaction_expiry_timer = -1; + } + if (stopTimer && cleanup_timer != -1) { + killTimer(cleanup_timer); + cleanup_timer = -1; + } } } @@ -1123,7 +1131,6 @@ void QXcbDrag::handleSelectionRequest(const xcb_selection_request_event_t *event QDrag *transactionDrag = 0; if (at >= 0) { - restartDropExpiryTimer(); transactionDrag = transactions.at(at).drag; } else if (at == -2) { transactionDrag = currentDrag(); diff --git a/src/plugins/platforms/xcb/qxcbdrag.h b/src/plugins/platforms/xcb/qxcbdrag.h index 99c1e2d78f..41d15505ce 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.h +++ b/src/plugins/platforms/xcb/qxcbdrag.h @@ -52,7 +52,7 @@ #include #include #include - +#include #include #include @@ -146,6 +146,10 @@ private: // timer used when target wants "continuous" move messages (eg. scroll) int heartbeat; + // 10 minute timer used to discard old XdndDrop transactions + enum { XdndDropTransactionTimeout = 600000 }; + int cleanup_timer; + QVector drag_types; struct Transaction @@ -156,6 +160,7 @@ private: QWindow *targetWindow; // QWidget *embedding_widget; QDrag *drag; + QTime time; }; QList transactions; From 889444b403c6d01bf47948a8cc911fd10e3db7a3 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Fri, 12 Oct 2012 11:58:01 +0200 Subject: [PATCH 28/84] Update qfiledialog ui to new style. Simply opened and saved in designer. No changes otherwise. Due to designer adding deprecated property margin, reverted parts manually. Change-Id: I5edbf82126606e224da4d0d51baeedb13b39bd83 Reviewed-by: Marc Mutz --- src/widgets/dialogs/qfiledialog.ui | 165 +++++++++++++++-------------- 1 file changed, 83 insertions(+), 82 deletions(-) diff --git a/src/widgets/dialogs/qfiledialog.ui b/src/widgets/dialogs/qfiledialog.ui index f7fe68fbbf..681d93912d 100644 --- a/src/widgets/dialogs/qfiledialog.ui +++ b/src/widgets/dialogs/qfiledialog.ui @@ -1,4 +1,5 @@ - + + ********************************************************************* ** ** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). @@ -40,8 +41,8 @@ ** ********************************************************************* QFileDialog - - + + 0 0 @@ -49,28 +50,28 @@ 316 - + true - - - - + + + + Look in: - - + + - - - + + + 1 0 - + 50 0 @@ -79,8 +80,8 @@ - - + + Back @@ -92,8 +93,8 @@ - - + + Forward @@ -105,8 +106,8 @@ - - + + Parent Directory @@ -118,8 +119,8 @@ - - + + Create New Folder @@ -131,8 +132,8 @@ - - + + List View @@ -144,8 +145,8 @@ - - + + Detail View @@ -158,87 +159,87 @@ - - - - + + + + 0 0 - + Qt::Horizontal - - - + + + QFrame::NoFrame - + QFrame::Raised - - + + 0 - + 0 - + 0 - + 0 - + 0 - - + + 0 - - - + + + 0 - + 0 - + 0 - + 0 - + 0 - + - - - + + + 0 - + 0 - + 0 - + 0 - + 0 - + @@ -248,15 +249,15 @@ - - - - + + + + 0 0 - + 0 0 @@ -264,43 +265,43 @@ - - - - + + + + 1 0 - - - + + + Qt::Vertical - - QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok - - - - + + + + 0 0 - + Files of type: - - - - + + + + 0 0 From 9e44b76093e08fed7b57b52246f39a38f3265727 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 11 Oct 2012 07:42:08 +0200 Subject: [PATCH 29/84] Added possibleKeys(QKeyEvent *) to QWindowsIntegration Task-number: QTBUG-26902 Change-Id: I08d244816eae8794b52f244f049ee1fb825dac8b Reviewed-by: Friedemann Kleint --- .../platforms/windows/qwindowscontext.cpp | 5 ++++ .../platforms/windows/qwindowscontext.h | 2 ++ .../platforms/windows/qwindowsintegration.cpp | 5 ++++ .../platforms/windows/qwindowsintegration.h | 1 + .../platforms/windows/qwindowskeymapper.cpp | 26 +++++++++++++++++++ .../platforms/windows/qwindowskeymapper.h | 2 ++ 6 files changed, 41 insertions(+) diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 0dade2c49b..c36b9196b1 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -331,6 +331,11 @@ bool QWindowsContext::useRTLExtensions() const return d->m_keyMapper.useRTLExtensions(); } +QList QWindowsContext::possibleKeys(const QKeyEvent *e) const +{ + return d->m_keyMapper.possibleKeys(e); +} + void QWindowsContext::setWindowCreationContext(const QSharedPointer &ctx) { d->m_creationContext = ctx; diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 3f08a742f8..450d6c8f4b 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -60,6 +60,7 @@ class QWindowsMimeConverter; struct QWindowCreationContext; struct QWindowsContextPrivate; class QPoint; +class QKeyEvent; #ifndef Q_OS_WINCE struct QWindowsUser32DLL @@ -170,6 +171,7 @@ public: unsigned systemInfo() const; bool useRTLExtensions() const; + QList possibleKeys(const QKeyEvent *e) const; QWindowsMimeConverter &mimeConverter() const; QWindowsScreenManager &screenManager(); diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 463e01246b..1f26ec5bab 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -447,6 +447,11 @@ Qt::KeyboardModifiers QWindowsIntegration::queryKeyboardModifiers() const return QWindowsKeyMapper::queryKeyboardModifiers(); } +QList QWindowsIntegration::possibleKeys(const QKeyEvent *e) const +{ + return d->m_context.possibleKeys(e); +} + QPlatformNativeInterface *QWindowsIntegration::nativeInterface() const { return &d->m_nativeInterface; diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index fe095cf5d3..49780566dd 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -81,6 +81,7 @@ public: virtual QVariant styleHint(StyleHint hint) const; virtual Qt::KeyboardModifiers queryKeyboardModifiers() const; + virtual QList possibleKeys(const QKeyEvent *e) const; static QWindowsIntegration *instance(); diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 322d66836a..b57a27acb4 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -1119,4 +1119,30 @@ Qt::KeyboardModifiers QWindowsKeyMapper::queryKeyboardModifiers() return modifiers; } +QList QWindowsKeyMapper::possibleKeys(const QKeyEvent *e) const +{ + QList result; + + KeyboardLayoutItem *kbItem = keyLayout[e->nativeVirtualKey()]; + if (!kbItem) + return result; + + quint32 baseKey = kbItem->qtKey[0]; + Qt::KeyboardModifiers keyMods = e->modifiers(); + if (baseKey == Qt::Key_Return && (e->nativeModifiers() & ExtendedKey)) { + result << int(Qt::Key_Enter + keyMods); + return result; + } + result << int(baseKey + keyMods); // The base key is _always_ valid, of course + + for (int i = 1; i < 9; ++i) { + Qt::KeyboardModifiers neededMods = ModsTbl[i]; + quint32 key = kbItem->qtKey[i]; + if (key && key != baseKey && ((keyMods & neededMods) == neededMods)) + result << int(key + (keyMods & ~neededMods)); + } + + return result; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowskeymapper.h b/src/plugins/platforms/windows/qwindowskeymapper.h index 3a13deb0b6..7b3f18a42d 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.h +++ b/src/plugins/platforms/windows/qwindowskeymapper.h @@ -48,6 +48,7 @@ QT_BEGIN_NAMESPACE +class QKeyEvent; class QWindow; struct KeyboardLayoutItem; @@ -70,6 +71,7 @@ public: void setKeyGrabber(QWindow *w) { m_keyGrabber = w; } static Qt::KeyboardModifiers queryKeyboardModifiers(); + QList possibleKeys(const QKeyEvent *e) const; private: bool translateKeyEventInternal(QWindow *receiver, const MSG &msg, bool grab); From bcbcf5e71884b006b0c89c4509af171de5aa59d7 Mon Sep 17 00:00:00 2001 From: Oliver Wolff Date: Thu, 11 Oct 2012 07:40:14 +0200 Subject: [PATCH 30/84] Be able to obtain list of possible key combinations in platform integration As there is no way to obtain the list of possible keys for a shortcut in a platform independent way there needs to be a way to get that from the platform integration. Task-number: QTBUG-26902 Change-Id: I520add56ee09d5c3c58709fb29dad2fbfe4c9d0b Reviewed-by: Friedemann Kleint Reviewed-by: Konstantin Ritt Reviewed-by: Marc Mutz --- src/gui/kernel/qkeymapper_qpa.cpp | 7 ++++++- src/gui/kernel/qplatformintegration.cpp | 14 ++++++++++++++ src/gui/kernel/qplatformintegration.h | 2 ++ 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qkeymapper_qpa.cpp b/src/gui/kernel/qkeymapper_qpa.cpp index 5073720ed8..0c225a4c91 100644 --- a/src/gui/kernel/qkeymapper_qpa.cpp +++ b/src/gui/kernel/qkeymapper_qpa.cpp @@ -43,6 +43,8 @@ #include #include #include +#include +#include QT_BEGIN_NAMESPACE @@ -66,7 +68,10 @@ void QKeyMapperPrivate::clearMappings() QList QKeyMapperPrivate::possibleKeys(QKeyEvent *e) { - QList result; + QList result = QGuiApplicationPrivate::platformIntegration()->possibleKeys(e); + if (!result.isEmpty()) + return result; + if (e->key() && (e->key() != Qt::Key_unknown)) result << int(e->key() + e->modifiers()); else if (!e->text().isEmpty()) diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp index 631f392284..cf55c59bab 100644 --- a/src/gui/kernel/qplatformintegration.cpp +++ b/src/gui/kernel/qplatformintegration.cpp @@ -312,6 +312,20 @@ Qt::KeyboardModifiers QPlatformIntegration::queryKeyboardModifiers() const return QGuiApplication::keyboardModifiers(); } +/*! + Should be used to obtain a list of possible shortcuts for the given key + event. As that needs system functionality it cannot be done in qkeymapper. + + One example for more than 1 possibility is the key combination of Shift+5. + That one might trigger a shortcut which is set as "Shift+5" as well as one + using %. These combinations depend on the currently set keyboard layout + which cannot be obtained by Qt functionality. +*/ +QList QPlatformIntegration::possibleKeys(const QKeyEvent *) const +{ + return QList(); +} + /*! Should be called by the implementation whenever a new screen is added. diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 7bc6c276c0..7e8888407c 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -76,6 +76,7 @@ class QPlatformTheme; class QPlatformDialogHelper; class QPlatformSharedGraphicsCache; class QPlatformServices; +class QKeyEvent; class Q_GUI_EXPORT QPlatformIntegration { @@ -141,6 +142,7 @@ public: virtual QVariant styleHint(StyleHint hint) const; virtual Qt::KeyboardModifiers queryKeyboardModifiers() const; + virtual QList possibleKeys(const QKeyEvent *) const; virtual QStringList themeNames() const; virtual QPlatformTheme *createPlatformTheme(const QString &name) const; From ab926916d2b831979293a1a10af0ad759563913c Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Thu, 11 Oct 2012 13:09:56 +0200 Subject: [PATCH 31/84] Fix "open with" functionality on OSX (FileOpenEvent) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QGuiApplicationPrivate::processWindowSystemEvent needs to handle the FileOpen event type so that applications can receive the events from the Finder. This makes it possible to e.g. double-click a qml file and open it in QML Viewer. Task-number: QTBUG-26855 Change-Id: I1e14e478460e8823095e4a33cee1e0defbf76d8b Reviewed-by: Topi Reiniö Reviewed-by: Gabriel de Dietrich --- src/gui/kernel/qguiapplication.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 84f22de322..f9b38d2e6d 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1207,6 +1207,10 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv QGuiApplicationPrivate::processPlatformPanelEvent( static_cast(e)); break; + case QWindowSystemInterfacePrivate::FileOpen: + QGuiApplicationPrivate::processFileOpenEvent( + static_cast(e)); + break; default: qWarning() << "Unknown user input event type:" << e->type; break; From e2217187c31833569fd8bd21ee805975597a19d7 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 12 Oct 2012 16:35:04 +0200 Subject: [PATCH 32/84] Fix warnings from syncqt. Stop processing in internal headers, use correct include syntax. Change-Id: I9dcf1f6f89907986b7b58658be514083f213a3e6 Reviewed-by: Thiago Macieira --- src/corelib/global/qconfig-nacl.h | 4 ++++ src/gui/opengl/qopengl.h | 4 ++-- src/gui/opengl/qopengles2ext.h | 1 + src/gui/opengl/qopenglext.h | 1 + src/gui/painting/qt_mips_asm_dsp.h | 4 ++++ src/network/kernel/qnetworkfunctions_wince.h | 4 ++++ 6 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h index d62b12fba5..d5172aac29 100644 --- a/src/corelib/global/qconfig-nacl.h +++ b/src/corelib/global/qconfig-nacl.h @@ -39,6 +39,10 @@ ** ****************************************************************************/ +#if 0 +#pragma qt_sync_stop_processing +#endif + #define QT_FONTS_ARE_RESOURCES /* Data structures */ diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h index 291c23b85f..5928b0be2f 100644 --- a/src/gui/opengl/qopengl.h +++ b/src/gui/opengl/qopengl.h @@ -63,7 +63,7 @@ QT_BEGIN_HEADER */ typedef char GLchar; -# include "qopengles2ext.h" +# include # ifndef GL_DOUBLE # define GL_DOUBLE GL_FLOAT # endif @@ -96,7 +96,7 @@ typedef GLfloat GLdouble; # include # endif # include -# include "qopenglext.h" +# include # endif // Q_OS_MAC #endif diff --git a/src/gui/opengl/qopengles2ext.h b/src/gui/opengl/qopengles2ext.h index 564bbc8484..61bfb595cc 100644 --- a/src/gui/opengl/qopengles2ext.h +++ b/src/gui/opengl/qopengles2ext.h @@ -3,6 +3,7 @@ #if 0 #pragma qt_no_master_include +#pragma qt_sync_stop_processing #endif /* $Revision: 18481 $ on $Date:: 2012-07-11 18:07:26 -0700 #$ */ diff --git a/src/gui/opengl/qopenglext.h b/src/gui/opengl/qopenglext.h index 070dd993d9..5d21cb6eea 100644 --- a/src/gui/opengl/qopenglext.h +++ b/src/gui/opengl/qopenglext.h @@ -3,6 +3,7 @@ #if 0 #pragma qt_no_master_include +#pragma qt_sync_stop_processing #endif #ifdef __cplusplus diff --git a/src/gui/painting/qt_mips_asm_dsp.h b/src/gui/painting/qt_mips_asm_dsp.h index af724bf7bb..c2fd234d08 100644 --- a/src/gui/painting/qt_mips_asm_dsp.h +++ b/src/gui/painting/qt_mips_asm_dsp.h @@ -42,6 +42,10 @@ #ifndef QT_MIPS_ASM_DSP_H #define QT_MIPS_ASM_DSP_H +#if 0 +#pragma qt_sync_stop_processing +#endif + #define zero $0 #define AT $1 #define v0 $2 diff --git a/src/network/kernel/qnetworkfunctions_wince.h b/src/network/kernel/qnetworkfunctions_wince.h index ebbdebb2f1..09caab06eb 100644 --- a/src/network/kernel/qnetworkfunctions_wince.h +++ b/src/network/kernel/qnetworkfunctions_wince.h @@ -42,6 +42,10 @@ #ifndef QNETWORKFUNCTIONS_WINCE_H #define QNETWORKFUNCTIONS_WINCE_H +#if 0 +#pragma qt_sync_stop_processing +#endif + #ifdef Q_OS_WINCE #include From 98033240a8fa2fa158b175826186164651937b04 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 9 Oct 2012 16:16:27 +0200 Subject: [PATCH 33/84] Mac OSX: configure will use clang for any version >= 3 Task-number: QTBUG-26140 Change-Id: Ifee00a9d15b053bb9d2c7b0d9bedca45e4d589d3 Reviewed-by: Gabriel de Dietrich Reviewed-by: Oswald Buddenhagen --- configure | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 205cbde2d3..a049488553 100755 --- a/configure +++ b/configure @@ -2311,12 +2311,10 @@ if [ -z "$PLATFORM" ]; then PLATFORM=macx-clang elif [ "$OSX_VERSION" -eq 11 ]; then # We're on Lion. Check if we have a supported Clang version - case "$(clang -v 2>&1 | grep -Po '(?<=version )\d[\d.]+')" in - 3.*) + if [ "$(clang -v 2>&1 | grep -Po '(?<=version )[\d]')" -ge 3 ]; then PLATFORM=macx-clang PLATFORM_NOTES="\n - Also available for Mac OS X: macx-g++\n" - ;; - esac + fi fi ;; AIX:*) From ec5ce61b4ab0fe8e978d9fcfec8dbfa5bb93a73c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Thu, 11 Oct 2012 11:59:40 +0200 Subject: [PATCH 34/84] qmake: fix reversed defines in vcxproj files Change-Id: I9fbb4b563428bb23974d59050f4c71e8d1983ff3 Reviewed-by: Oswald Buddenhagen --- qmake/generators/win32/msbuild_objectmodel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qmake/generators/win32/msbuild_objectmodel.cpp b/qmake/generators/win32/msbuild_objectmodel.cpp index 27f67be525..59825f29f1 100644 --- a/qmake/generators/win32/msbuild_objectmodel.cpp +++ b/qmake/generators/win32/msbuild_objectmodel.cpp @@ -335,7 +335,7 @@ static QStringList unquote(const QStringList &values) { QStringList result; result.reserve(values.size()); - for (int i = values.count(); --i >= 0;) + for (int i = 0; i < values.count(); ++i) result << unquote(values.at(i)); return result; } From 76874dea4449029856a7a1f639b995a9e35c6166 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Thu, 11 Oct 2012 16:34:44 -0700 Subject: [PATCH 35/84] Remove the -falign-stack option from ICC's mkspec. This option was necessary in early ICC 12 releases because of a difference in interpreting the ABI requirements with GCC. According to ICC devs, GCC changed the ABI on its own to require 16-byte-aligned stacks on i386. It looks like this option has been the default in later ICC 12 releases. At least 12.1 update 5 has it by default. ICC 13 does not have the option anymore but accepts it silently for backwards compatibility. Change-Id: Id8bb4c250718eef2f02dc97bd47a0efd95b272fc Reviewed-by: Oswald Buddenhagen --- mkspecs/linux-icc/qmake.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/linux-icc/qmake.conf b/mkspecs/linux-icc/qmake.conf index d7fe808a01..540069499b 100644 --- a/mkspecs/linux-icc/qmake.conf +++ b/mkspecs/linux-icc/qmake.conf @@ -12,7 +12,7 @@ QMAKE_LEX = flex QMAKE_LEXFLAGS = QMAKE_YACC = yacc QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -falign-stack=maintain-16-byte +QMAKE_CFLAGS = QMAKE_CFLAGS_DEPS = -M QMAKE_CFLAGS_WARN_ON = -w1 -Wcheck -wd654,1572,411,873,1125,2259,2261 QMAKE_CFLAGS_WARN_OFF = -w From 69d1a4edb9fa5dfd85a5187ad1be0dc6504903e2 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Fri, 12 Oct 2012 16:32:54 +0200 Subject: [PATCH 36/84] syncqt: Fix warnings about missing QT_BEGIN_HEADER/NAMESPACE. Do not print warnings when stop-processing pragma was encountered. Change-Id: I0dd3b317b3a685afe613527988eb137325037e16 Reviewed-by: Oswald Buddenhagen --- bin/syncqt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/bin/syncqt b/bin/syncqt index 4d3ae59bdd..bbbbe33d50 100755 --- a/bin/syncqt +++ b/bin/syncqt @@ -1206,10 +1206,12 @@ if($check_includes) { my $qt_begin_namespace_found = 0; my $qt_end_namespace_found = 0; my $line; + my $stop_processing = 0; while($line = ) { chomp $line; my $output_line = 1; if($line =~ /^ *\# *pragma (qt_no_included_check|qt_sync_stop_processing)/) { + $stop_processing = 1; last; } elsif($line =~ /^ *\# *include/) { my $include = $line; @@ -1237,7 +1239,7 @@ if($check_includes) { $qt_end_namespace_found = 1; } } - if ($header_skip_qt_begin_header_test == 0) { + if ($header_skip_qt_begin_header_test == 0 and $stop_processing == 0) { if ($qt_begin_header_found == 0) { print "$lib: WARNING: $iheader does not include QT_BEGIN_HEADER\n"; } @@ -1247,7 +1249,7 @@ if($check_includes) { } } - if ($header_skip_qt_begin_namespace_test == 0) { + if ($header_skip_qt_begin_namespace_test == 0 and $stop_processing == 0) { if ($qt_begin_namespace_found == 0) { print "$lib: WARNING: $iheader does not include QT_BEGIN_NAMESPACE\n"; } From faac9bbaf9d7b96df1f92fd89f0ba6ba8c253476 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 11 Oct 2012 14:33:11 +0300 Subject: [PATCH 37/84] Change hostname for dnslookup 'notfound' test cases. Microsoft DNS server used in Digia hosted Qt-Project CI system, returns 'Server failed' error for 'invalid.' hostname. Because the purpose of these autotests is to test 'notfound' use case, it should be ok to use also 'invalid.invalid' hostname in these DNS queries. Change-Id: I9e9c829f3858e7fa23feffd2ede018b19f676857 Reviewed-by: Shane Kearns --- .../network/kernel/qdnslookup/tst_qdnslookup.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp index 0d45d810b1..a3ce31f585 100644 --- a/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp +++ b/tests/auto/network/kernel/qdnslookup/tst_qdnslookup.cpp @@ -80,22 +80,22 @@ void tst_QDnsLookup::lookup_data() QTest::addColumn("txt"); QTest::newRow("a-empty") << int(QDnsLookup::A) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << ""<< "" << QByteArray(); - QTest::newRow("a-notfound") << int(QDnsLookup::A) << "invalid." << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("a-notfound") << int(QDnsLookup::A) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("a-idn") << int(QDnsLookup::A) << QString::fromUtf8("alqualondë.troll.no") << int(QDnsLookup::NoError) << "alqualonde.troll.no" << "10.3.3.55" << "" << "" << "" << "" << QByteArray(); QTest::newRow("a-single") << int(QDnsLookup::A) << "lupinella.troll.no" << int(QDnsLookup::NoError) << "" << "10.3.4.6" << "" << "" << "" << "" << QByteArray(); QTest::newRow("a-multi") << int(QDnsLookup::A) << "multi.dev.troll.no" << int(QDnsLookup::NoError) << "" << "1.2.3.4 1.2.3.5 10.3.3.31" << "" << "" << "" << "" << QByteArray(); QTest::newRow("aaaa-empty") << int(QDnsLookup::AAAA) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("aaaa-notfound") << int(QDnsLookup::AAAA) << "invalid." << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("aaaa-notfound") << int(QDnsLookup::AAAA) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("aaaa-single") << int(QDnsLookup::AAAA) << "dns6-test-dev.troll.no" << int(QDnsLookup::NoError) << "" << "2001:470:1f01:115::10" << "" << "" << "" << "" << QByteArray(); QTest::newRow("aaaa-multi") << int(QDnsLookup::AAAA) << "multi-dns6-test-dev.troll.no" << int(QDnsLookup::NoError) << "" << "2001:470:1f01:115::11 2001:470:1f01:115::12" << "" << "" << "" << "" << QByteArray(); QTest::newRow("any-empty") << int(QDnsLookup::ANY) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("any-notfound") << int(QDnsLookup::ANY) << "invalid." << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("any-notfound") << int(QDnsLookup::ANY) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("any-ascii") << int(QDnsLookup::ANY) << "fluke.troll.no" << int(QDnsLookup::NoError) << "" << "10.3.3.31" << "" << "" << "" << "" << QByteArray(); QTest::newRow("mx-empty") << int(QDnsLookup::MX) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("mx-notfound") << int(QDnsLookup::MX) << "invalid." << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("mx-notfound") << int(QDnsLookup::MX) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("mx-ascii") << int(QDnsLookup::MX) << "troll.no" << int(QDnsLookup::NoError) << "" << "" << "10 smtp.trolltech.com" << "" << "" << "" << QByteArray(); #if 0 // FIXME: we need an IDN MX record in the troll.no domain @@ -103,23 +103,23 @@ void tst_QDnsLookup::lookup_data() #endif QTest::newRow("ns-empty") << int(QDnsLookup::NS) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("ns-notfound") << int(QDnsLookup::NS) << "invalid." << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("ns-notfound") << int(QDnsLookup::NS) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); QTest::newRow("ns-ascii") << int(QDnsLookup::NS) << "troll.no" << int(QDnsLookup::NoError) << "" << "" << "" << "ns-0.trolltech.net ns-1.trolltech.net" << "" << "" << QByteArray(); QTest::newRow("ptr-empty") << int(QDnsLookup::PTR) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("ptr-notfound") << int(QDnsLookup::PTR) << "invalid." << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("ptr-notfound") << int(QDnsLookup::PTR) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); // FIXME: we need PTR records in the troll.no domain QTest::newRow("ptr-ascii") << int(QDnsLookup::PTR) << "8.8.8.8.in-addr.arpa" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "google-public-dns-a.google.com" << "" << QByteArray(); QTest::newRow("srv-empty") << int(QDnsLookup::SRV) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("srv-notfound") << int(QDnsLookup::SRV) << "invalid." << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("srv-notfound") << int(QDnsLookup::SRV) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); #if 0 // FIXME: we need SRV records in the troll.no domain QTest::newRow("srv-idn") << int(QDnsLookup::SRV) << QString::fromUtf8("_xmpp-client._tcp.råkat.se") << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "5 0 5224 jabber.cdr.se" << QByteArray(); #endif QTest::newRow("txt-empty") << int(QDnsLookup::TXT) << "" << int(QDnsLookup::InvalidRequestError) << "" << "" << "" << "" << "" << "" << QByteArray(); - QTest::newRow("txt-notfound") << int(QDnsLookup::TXT) << "invalid." << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); + QTest::newRow("txt-notfound") << int(QDnsLookup::TXT) << "invalid.invalid" << int(QDnsLookup::NotFoundError) << "" << "" << "" << "" << "" << "" << QByteArray(); // FIXME: we need TXT records in the troll.no domain QTest::newRow("txt-ascii") << int(QDnsLookup::TXT) << "gmail.com" << int(QDnsLookup::NoError) << "" << "" << "" << "" << "" << "" << QByteArray("v=spf1 redirect=_spf.google.com"); } From 0ca57a89a2512e62178b44cdcd2653adc3924dd0 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Fri, 12 Oct 2012 07:08:18 +0300 Subject: [PATCH 38/84] Use constFind()/constEnd() for const_iterator-s to make the strict iterators happy. Change-Id: Ief4ec309b815f18dc4b2017d4f34c063db510c31 Reviewed-by: Pierre Rossi --- src/gui/text/qfont.cpp | 6 +++--- src/gui/text/qtextengine.cpp | 4 ++-- src/gui/text/qtextformat.cpp | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index a2132f0fea..24423ee4af 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2648,9 +2648,9 @@ void QFontCache::clear() QFontEngineData *QFontCache::findEngineData(const QFontDef &def) const { - EngineDataCache::ConstIterator it = engineDataCache.find(def), - end = engineDataCache.end(); - if (it == end) return 0; + EngineDataCache::ConstIterator it = engineDataCache.constFind(def); + if (it == engineDataCache.constEnd()) + return 0; // found return it.value(); diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index cff1487278..33f2bba988 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2741,13 +2741,13 @@ void QTextEngine::resolveAdditionalFormats() const const QScriptItem *si = &layoutData->items.at(i); int end = si->position + length(si); - while (startIt != addFormatSortedByStart.end() && + while (startIt != addFormatSortedByStart.constEnd() && specialData->addFormats.at(*startIt).start <= si->position) { currentFormats.insert(std::upper_bound(currentFormats.begin(), currentFormats.end(), *startIt), *startIt); ++startIt; } - while (endIt != addFormatSortedByEnd.end() && + while (endIt != addFormatSortedByEnd.constEnd() && specialData->addFormats.at(*endIt).start + specialData->addFormats.at(*endIt).length < end) { currentFormats.remove(qBinaryFind(currentFormats, *endIt) - currentFormats.begin()); ++endIt; diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 6607c427f5..90cdd7e072 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -3358,8 +3358,8 @@ int QTextFormatCollection::indexForFormat(const QTextFormat &format) bool QTextFormatCollection::hasFormatCached(const QTextFormat &format) const { uint hash = getHash(format.d, format.format_type); - QMultiHash::const_iterator i = hashes.find(hash); - while (i != hashes.end() && i.key() == hash) { + QMultiHash::const_iterator i = hashes.constFind(hash); + while (i != hashes.constEnd() && i.key() == hash) { if (formats.value(i.value()) == format) { return true; } From e3a89dafb0671fe328d14f7bb658b11be83289db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Mill=C3=A1n=20Soto?= Date: Fri, 7 Sep 2012 19:59:00 +0200 Subject: [PATCH 39/84] Notify accessibility events in QAbstractItemView Change-Id: Idd713dc3bc3e817529968384edd0418e151f0e5b Reviewed-by: Frederik Gladhorn --- src/widgets/itemviews/qabstractitemview.cpp | 70 ++++++++++----------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index b30bdbbc6b..8cb6d70d15 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1108,14 +1108,11 @@ void QAbstractItemView::reset() if (d->selectionModel) d->selectionModel->reset(); #ifndef QT_NO_ACCESSIBILITY -#ifdef Q_WS_X11 if (QAccessible::isActive()) { - QAccessible::queryAccessibleInterface(this)->table2Interface()->modelReset(); - QAccessibleEvent event(this, QAccessible::TableModelChanged); - QAccessible::updateAccessibility(&event); + QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::ModelReset); + QAccessible::updateAccessibility(&accessibleEvent); } #endif -#endif } /*! @@ -3243,12 +3240,22 @@ void QAbstractItemView::dataChanged(const QModelIndex &topLeft, const QModelInde // otherwise the items will be update later anyway update(topLeft); } - return; + } else { + d->updateEditorData(topLeft, bottomRight); + if (isVisible() && !d->delayedPendingLayout) + d->viewport->update(); } - d->updateEditorData(topLeft, bottomRight); - if (!isVisible() || d->delayedPendingLayout) - return; // no need to update - d->viewport->update(); + +#ifndef QT_NO_ACCESSIBILITY + if (QAccessible::isActive()) { + QAccessibleTableModelChangeEvent accessibleEvent(this, QAccessibleTableModelChangeEvent::DataChanged); + accessibleEvent.setFirstRow(topLeft.row()); + accessibleEvent.setFirstColumn(topLeft.column()); + accessibleEvent.setLastRow(bottomRight.row()); + accessibleEvent.setLastColumn(bottomRight.column()); + QAccessible::updateAccessibility(&accessibleEvent); + } +#endif } /*! @@ -3343,14 +3350,13 @@ void QAbstractItemViewPrivate::_q_rowsRemoved(const QModelIndex &index, int star q->updateEditorGeometries(); q->setState(QAbstractItemView::NoState); #ifndef QT_NO_ACCESSIBILITY -#ifdef Q_WS_X11 if (QAccessible::isActive()) { - QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsRemoved(index, start, end); - QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); - QAccessible::updateAccessibility(&event); + QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsRemoved); + accessibleEvent.setFirstRow(start); + accessibleEvent.setLastRow(end); + QAccessible::updateAccessibility(&accessibleEvent); } #endif -#endif } /*! @@ -3424,14 +3430,13 @@ void QAbstractItemViewPrivate::_q_columnsRemoved(const QModelIndex &index, int s q->updateEditorGeometries(); q->setState(QAbstractItemView::NoState); #ifndef QT_NO_ACCESSIBILITY -#ifdef Q_WS_X11 if (QAccessible::isActive()) { - QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsRemoved(index, start, end); - QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); - QAccessible::updateAccessibility(&event); + QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsRemoved); + accessibleEvent.setFirstColumn(start); + accessibleEvent.setLastColumn(end); + QAccessible::updateAccessibility(&accessibleEvent); } #endif -#endif } @@ -3447,15 +3452,14 @@ void QAbstractItemViewPrivate::_q_rowsInserted(const QModelIndex &index, int sta Q_UNUSED(end) #ifndef QT_NO_ACCESSIBILITY -#ifdef Q_WS_X11 Q_Q(QAbstractItemView); if (QAccessible::isActive()) { - QAccessible::queryAccessibleInterface(q)->table2Interface()->rowsInserted(index, start, end); - QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); - QAccessible::updateAccessibility(&event); + QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::RowsInserted); + accessibleEvent.setFirstRow(start); + accessibleEvent.setLastRow(end); + QAccessible::updateAccessibility(&accessibleEvent); } #endif -#endif } /*! @@ -3473,14 +3477,13 @@ void QAbstractItemViewPrivate::_q_columnsInserted(const QModelIndex &index, int if (q->isVisible()) q->updateEditorGeometries(); #ifndef QT_NO_ACCESSIBILITY -#ifdef Q_WS_X11 if (QAccessible::isActive()) { - QAccessible::queryAccessibleInterface(q)->table2Interface()->columnsInserted(index, start, end); - QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); - QAccessible::updateAccessibility(&event); + QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ColumnsInserted); + accessibleEvent.setFirstColumn(start); + accessibleEvent.setLastColumn(end); + QAccessible::updateAccessibility(&accessibleEvent); } #endif -#endif } /*! @@ -3501,15 +3504,12 @@ void QAbstractItemViewPrivate::_q_layoutChanged() { doDelayedItemsLayout(); #ifndef QT_NO_ACCESSIBILITY -#ifdef Q_WS_X11 Q_Q(QAbstractItemView); if (QAccessible::isActive()) { - QAccessible::queryAccessibleInterface(q)->table2Interface()->modelReset(); - QAccessibleEvent event(QAccessible::TableModelChanged, q, 0); - QAccessible::updateAccessibility(&event); + QAccessibleTableModelChangeEvent accessibleEvent(q, QAccessibleTableModelChangeEvent::ModelReset); + QAccessible::updateAccessibility(&accessibleEvent); } #endif -#endif } void QAbstractItemViewPrivate::_q_rowsMoved(const QModelIndex &, int, int, const QModelIndex &, int) From ac8cab0cabb54815c315b7b19f531901a887f402 Mon Sep 17 00:00:00 2001 From: Michele Caini Date: Mon, 8 Oct 2012 22:34:39 +0200 Subject: [PATCH 40/84] Review of documentation. Documentation has been updated, changes apply to Qt5 as well as Qt4. Change-Id: I562914a439d8d27dc9e6b1aa117007edce214cc6 Reviewed-by: Joerg Bornemann Reviewed-by: Frederik Gladhorn --- src/corelib/thread/qmutex.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/corelib/thread/qmutex.cpp b/src/corelib/thread/qmutex.cpp index ee1037d4f4..3815ce16a7 100644 --- a/src/corelib/thread/qmutex.cpp +++ b/src/corelib/thread/qmutex.cpp @@ -162,8 +162,9 @@ public: If \a mode is QMutex::Recursive, a thread can lock the same mutex multiple times and the mutex won't be unlocked until a - corresponding number of unlock() calls have been made. The - default is QMutex::NonRecursive. + corresponding number of unlock() calls have been made. Otherwise + a thread may only lock a mutex once. The default is + QMutex::NonRecursive. \sa lock(), unlock() */ @@ -371,6 +372,13 @@ bool QBasicMutex::isRecursive() \sa unlock() */ +/*! + \fn QMutex *QMutexLocker::mutex() + + Returns the mutex on which the QMutexLocker is operating. + +*/ + #ifndef QT_LINUX_FUTEX //linux implementation is in qmutex_linux.cpp /* From 2230e349df70d5840166cfdc0f44378106ff54dd Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 24 Sep 2012 15:25:15 +0200 Subject: [PATCH 41/84] qdoc outputs warnings in a form which Creator will recognize Recently Creator started recognzing the warnings from qdoc, however because warnings are not labeleled with " warning: ", there is no yellow-triangle symbol in the Issues list. This patch makes the output look the same as warnings or errors that come from gcc. Change-Id: I895a656d22ce8b59da90c58b86a444c86c8edf84 Reviewed-by: Martin Smith Reviewed-by: Frederik Gladhorn --- src/tools/qdoc/location.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/tools/qdoc/location.cpp b/src/tools/qdoc/location.cpp index 942fc0f70c..ceb5709aae 100644 --- a/src/tools/qdoc/location.cpp +++ b/src/tools/qdoc/location.cpp @@ -360,7 +360,9 @@ void Location::emitMessage(MessageType type, result += "\n[" + details + QLatin1Char(']'); result.replace("\n", "\n "); if (type == Error) - result.prepend(tr("error: ")); + result.prepend(tr(": error: ")); + else if (type == Warning) + result.prepend(tr(": warning: ")); result.prepend(toString()); fprintf(stderr, "%s\n", result.toLatin1().data()); fflush(stderr); @@ -397,7 +399,6 @@ QString Location::toString() const } str += top(); } - str += QLatin1String(": "); return str; } From 703fa6c361682cab0d64baabd9256c651da34779 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Wed, 10 Oct 2012 14:29:10 -0300 Subject: [PATCH 42/84] Do not skip tst_QClipboard::copy_exit_paste on QNX This test is valid on QNX platforms. Change-Id: Ic9657c2b92628a649ab52367135dcb3a77450913 Reviewed-by: Friedemann Kleint --- tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp index 5e3735ce3d..f31d92751d 100644 --- a/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp +++ b/tests/auto/gui/kernel/qclipboard/tst_qclipboard.cpp @@ -233,7 +233,7 @@ static bool runHelper(const QString &program, const QStringList &arguments, QByt void tst_QClipboard::copy_exit_paste() { #ifndef QT_NO_PROCESS -#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) +#if !defined(Q_OS_WIN) && !defined(Q_OS_MAC) && !defined(Q_OS_QNX) QSKIP("This test does not make sense on X11 and embedded, copied data disappears from the clipboard when the application exits "); // ### It's still possible to test copy/paste - just keep the apps running #endif From 0aa28cf67ae6fab9ce4a677b0a5fd697440b8b11 Mon Sep 17 00:00:00 2001 From: Arvid Picciani Date: Wed, 10 Oct 2012 14:11:30 +0000 Subject: [PATCH 43/84] android-eglfs: open the correct fb device for reading attrs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Icedcab50379834fa3456d0e18aaef8a4dd9cf949 Reviewed-by: Samuel Rødal --- .../qeglfshooks_surfaceflinger.cpp | 69 ++++++++++++++++++- 1 file changed, 68 insertions(+), 1 deletion(-) diff --git a/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp b/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp index bb751eb98d..cef1d1ccbe 100644 --- a/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp +++ b/mkspecs/unsupported/android-g++/qeglfshooks_surfaceflinger.cpp @@ -44,6 +44,10 @@ #include #include #include +#include +#include +#include +#include using namespace android; @@ -53,6 +57,8 @@ class QEglFSPandaHooks : public QEglFSHooks { public: virtual EGLNativeWindowType createNativeWindow(const QSize &size, const QSurfaceFormat &format); + virtual QSize screenSize() const; + virtual int screenDepth() const; private: // androidy things sp mSession; @@ -72,13 +78,74 @@ EGLNativeWindowType QEglFSPandaHooks::createNativeWindow(const QSize &size, cons 0, dinfo.w, dinfo.h, PIXEL_FORMAT_RGB_888); SurfaceComposerClient::openGlobalTransaction(); mControl->setLayer(0x40000000); - mControl->setAlpha(0.4); +// mControl->setAlpha(1); SurfaceComposerClient::closeGlobalTransaction(); mAndroidSurface = mControl->getSurface(); EGLNativeWindowType eglWindow = mAndroidSurface.get(); return eglWindow; } +QSize QEglFSPandaHooks::screenSize() const +{ + static QSize size; + + if (size.isEmpty()) { + int width = qgetenv("QT_QPA_EGLFS_WIDTH").toInt(); + int height = qgetenv("QT_QPA_EGLFS_HEIGHT").toInt(); + + if (width && height) { + // no need to read fb0 + size.setWidth(width); + size.setHeight(height); + return size; + } + + struct fb_var_screeninfo vinfo; + int fd = open("/dev/graphics/fb0", O_RDONLY); + + if (fd != -1) { + if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1) + qWarning("Could not query variable screen info."); + else + size = QSize(vinfo.xres, vinfo.yres); + + close(fd); + } else { + qWarning("Failed to open /dev/graphics/fb0 to detect screen resolution."); + } + + // override fb0 from environment var setting + if (width) + size.setWidth(width); + if (height) + size.setHeight(height); + } + + return size; +} + +int QEglFSPandaHooks::screenDepth() const +{ + static int depth = qgetenv("QT_QPA_EGLFS_DEPTH").toInt(); + + if (depth == 0) { + struct fb_var_screeninfo vinfo; + int fd = open("/dev/graphics/fb0", O_RDONLY); + + if (fd != -1) { + if (ioctl(fd, FBIOGET_VSCREENINFO, &vinfo) == -1) + qWarning("Could not query variable screen info."); + else + depth = vinfo.bits_per_pixel; + + close(fd); + } else { + qWarning("Failed to open /dev/graphics/fb0 to detect screen depth."); + } + } + + return depth == 0 ? 32 : depth; +} static QEglFSPandaHooks eglFSPandaHooks; QEglFSHooks *platformHooks = &eglFSPandaHooks; From ec9056ba667f79d2ffb922537579d42c9594581f Mon Sep 17 00:00:00 2001 From: Arvid Picciani Date: Wed, 10 Oct 2012 14:13:42 +0000 Subject: [PATCH 44/84] android-qt: fix build for jellybean MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2a52770502ec6e70ae0e3928d98c6c573f773579 Reviewed-by: Samuel Rødal --- mkspecs/unsupported/android-g++/qmake.conf | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mkspecs/unsupported/android-g++/qmake.conf b/mkspecs/unsupported/android-g++/qmake.conf index 54e6d61cee..3fc278b0d1 100644 --- a/mkspecs/unsupported/android-g++/qmake.conf +++ b/mkspecs/unsupported/android-g++/qmake.conf @@ -41,9 +41,11 @@ include(../../common/gcc-base-unix.conf) CONFIG = qt warn_on release link_prl QT = core gui -DEFINES += Q_OS_LINUX_ANDROID ANDROID HAVE_ANDROID_OS +DEFINES += Q_OS_LINUX_ANDROID HAVE_ANDROID_OS DEFINES += QT_NO_PRINTER QT_NO_PRINTDIALOG QT_NO_EXCEPTIONS +#note: -DANDROID results in weird behaviour of math.h +DEFINES += ANDROID QT_QPA_DEFAULT_PLATFORM = eglfs EGLFS_PLATFORM_HOOKS_SOURCES = $$PWD/qeglfshooks_surfaceflinger.cpp @@ -53,6 +55,8 @@ EGLFS_PLATFORM_HOOKS_LIBS += -lgui -lutils QMAKE_CC = $${ANDROID_TOOLCHAIN_PREFIX}gcc QMAKE_CFLAGS = $${ANDROID_TARGET_CFLAGS} +QMAKE_CFLAGS -= -Werror=non-virtual-dtor +QMAKE_CFLAGS -= -DNDEBUG QMAKE_CFLAGS_WARN_ON = -Wall -Wextra QMAKE_CFLAGS_WARN_OFF = -Wno-psabi From 386eb2a5c0ebbdf101a3c2e3d094402223669d6a Mon Sep 17 00:00:00 2001 From: Arvid Picciani Date: Thu, 11 Oct 2012 15:16:04 +0000 Subject: [PATCH 45/84] android: set QMAKE_COMPILER MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I5b38bf94f0f0d4080b8d355013441c1805524d71 Reviewed-by: Samuel Rødal --- mkspecs/unsupported/android-g++/qmake.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mkspecs/unsupported/android-g++/qmake.conf b/mkspecs/unsupported/android-g++/qmake.conf index 3fc278b0d1..8e0af9268d 100644 --- a/mkspecs/unsupported/android-g++/qmake.conf +++ b/mkspecs/unsupported/android-g++/qmake.conf @@ -25,13 +25,14 @@ defineReplace(getAndroidBuildVar) { write_file(android_build_vars, store_ANDROID_TARGET_ARCH, append) } -warning(using android build env from cache in $$PWD/android_build_vars . delete this file if you changed your build env ) +info(using android build env from cache in $$PWD/android_build_vars . delete this file if you changed your build env ) exists($$PWD/android_build_vars) { include($$PWD/android_build_vars) } MAKEFILE_GENERATOR = UNIX +QMAKE_COMPILER = gcc TARGET_PLATFORM = unix TEMPLATE = app QMAKE_INCREMENTAL_STYLE = sublib From 7edaf253d5e5baa0368e08d2cec82ad9fb507f21 Mon Sep 17 00:00:00 2001 From: Rafael Roquetto Date: Sat, 13 Oct 2012 16:12:28 -0300 Subject: [PATCH 46/84] QNX: code cleanup, use '0' instead of 'NULL' Qt coding style uses always 0. NULL is wrong. Change-Id: I163677b512214f853677d21d75f13142fe2ca88d Reviewed-by: Sean Harmer --- src/plugins/platforms/qnx/qqnxbuffer.cpp | 2 +- src/plugins/platforms/qnx/qqnxbuffer.h | 4 ++-- src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp | 10 +++++----- src/plugins/platforms/qnx/qqnxscreen.cpp | 2 +- src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp | 2 +- src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/qnx/qqnxbuffer.cpp b/src/plugins/platforms/qnx/qqnxbuffer.cpp index ed3ea49d44..9007af7f70 100644 --- a/src/plugins/platforms/qnx/qqnxbuffer.cpp +++ b/src/plugins/platforms/qnx/qqnxbuffer.cpp @@ -88,7 +88,7 @@ QQnxBuffer::QQnxBuffer(screen_buffer_t buffer) if (result != 0) { qFatal("QQNX: failed to query buffer pointer, errno=%d", errno); } - if (dataPtr == NULL) { + if (dataPtr == 0) { qFatal("QQNX: buffer pointer is NULL, errno=%d", errno); } diff --git a/src/plugins/platforms/qnx/qqnxbuffer.h b/src/plugins/platforms/qnx/qqnxbuffer.h index 7788778a4a..d5adeb8d8b 100644 --- a/src/plugins/platforms/qnx/qqnxbuffer.h +++ b/src/plugins/platforms/qnx/qqnxbuffer.h @@ -57,8 +57,8 @@ public: virtual ~QQnxBuffer(); screen_buffer_t nativeBuffer() const { return m_buffer; } - const QImage *image() const { return (m_buffer != NULL) ? &m_image : NULL; } - QImage *image() { return (m_buffer != NULL) ? &m_image : NULL; } + const QImage *image() const { return (m_buffer != 0) ? &m_image : 0; } + QImage *image() { return (m_buffer != 0) ? &m_image : 0; } QRect rect() const { return m_image.rect(); } diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp index 72a967d5e5..30ca8a5c48 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp @@ -571,7 +571,7 @@ spannable_string_t *toSpannableString(const QString &text) spannable_string_t *pString = reinterpret_cast(malloc(sizeof(spannable_string_t))); pString->str = (wchar_t *)malloc(sizeof(wchar_t) * text.length() + 1); pString->length = text.length(); - pString->spans = NULL; + pString->spans = 0; pString->spans_count = 0; const QChar *pData = text.constData(); @@ -601,7 +601,7 @@ static bool s_imfInitFailed = false; static bool imfAvailable() { - static bool s_imfDisabled = getenv("DISABLE_IMF") != NULL; + static bool s_imfDisabled = getenv("DISABLE_IMF") != 0; static bool s_imfReady = false; if ( s_imfInitFailed || s_imfDisabled) { @@ -611,7 +611,7 @@ static bool imfAvailable() return true; } - if ( p_imf_client_init == NULL ) { + if ( p_imf_client_init == 0 ) { void *handle = dlopen("libinput_client.so.1", 0); if ( handle ) { p_imf_client_init = (int32_t (*)()) dlsym(handle, "imf_client_init"); @@ -632,8 +632,8 @@ static bool imfAvailable() s_imfReady = true; } else { - p_ictrl_open_session = NULL; - p_ictrl_dispatch_event = NULL; + p_ictrl_open_session = 0; + p_ictrl_dispatch_event = 0; s_imfDisabled = true; qCritical() << Q_FUNC_INFO << "libinput_client.so.1 did not contain the correct symbols, library mismatch? IMF services are disabled."; return false; diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 6a092f01a0..593bec8458 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -524,7 +524,7 @@ void QQnxScreen::newWindowCreated(void *window) { Q_ASSERT(thread() == QThread::currentThread()); const screen_window_t windowHandle = reinterpret_cast(window); - screen_display_t display = NULL; + screen_display_t display = 0; if (screen_get_window_property_pv(windowHandle, SCREEN_PROPERTY_DISPLAY, (void**)&display) != 0) { qWarning("QQnx: Failed to get screen for window, errno=%d", errno); return; diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 621440ed53..d8712bf569 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -462,7 +462,7 @@ void QQnxScreenEventHandler::handleCreateEvent(screen_event_t event) void QQnxScreenEventHandler::handleDisplayEvent(screen_event_t event) { - screen_display_t nativeDisplay = NULL; + screen_display_t nativeDisplay = 0; if (screen_get_event_property_pv(event, SCREEN_PROPERTY_DISPLAY, (void **)&nativeDisplay) != 0) { qWarning("QQnx: failed to query display property, errno=%d", errno); return; diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp index 4618b90f81..ab912927bb 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp @@ -130,7 +130,7 @@ bool QQnxVirtualKeyboardPps::connect() m_decoder = new pps_decoder_t; pps_encoder_initialize(m_encoder, false); - pps_decoder_initialize(m_decoder, NULL); + pps_decoder_initialize(m_decoder, 0); errno = 0; m_fd = ::open(ms_PPSPath, O_RDWR); @@ -197,7 +197,7 @@ void QQnxVirtualKeyboardPps::ppsDataReady() m_buffer[nread] = 0; pps_decoder_parse_pps_str(m_decoder, m_buffer); - pps_decoder_push(m_decoder, NULL); + pps_decoder_push(m_decoder, 0); #if defined(QQNXVIRTUALKEYBOARD_DEBUG) pps_decoder_dump_tree(m_decoder, stderr); #endif From 6cf322910556b8a9c907d4cc2c7716521e4ba704 Mon Sep 17 00:00:00 2001 From: Mark Brand Date: Sat, 13 Oct 2012 13:07:38 +0200 Subject: [PATCH 47/84] QSqlTableModel: let select() and selectRow() be slots It's convenient to be able to connect a button to select() and signals that provide a row to selectRow(). Change-Id: I520d5564943f679ec9e68331878a211dd52b4a06 Reviewed-by: Konstantin Ritt Reviewed-by: David Faure --- src/sql/models/qsqltablemodel.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sql/models/qsqltablemodel.h b/src/sql/models/qsqltablemodel.h index 0b038e1d70..df1946fb9f 100644 --- a/src/sql/models/qsqltablemodel.h +++ b/src/sql/models/qsqltablemodel.h @@ -66,9 +66,6 @@ public: explicit QSqlTableModel(QObject *parent = 0, QSqlDatabase db = QSqlDatabase()); virtual ~QSqlTableModel(); - virtual bool select(); - virtual bool selectRow(int row); - virtual void setTable(const QString &tableName); QString tableName() const; @@ -111,6 +108,9 @@ public: virtual void revertRow(int row); public Q_SLOTS: + virtual bool select(); + virtual bool selectRow(int row); + bool submit(); void revert(); From 289a8147784f830f214859e00367486587d9a027 Mon Sep 17 00:00:00 2001 From: Konstantin Ritt Date: Tue, 9 Oct 2012 16:18:49 +0300 Subject: [PATCH 48/84] QCommonStyle: Reduce code duplication by re-using viewItemTextLayout() helper function. Also use QTextLayout(QString, QFont) c-tor which is a bit faster than using setText() + setFont() setters. Change-Id: I0d09ba43bad2296e932f49fcb9cfd28f42c1f95d Reviewed-by: Marc Mutz Reviewed-by: Jens Bache-Wiig --- src/widgets/styles/qcommonstyle.cpp | 112 ++++++++++++---------------- 1 file changed, 48 insertions(+), 64 deletions(-) diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index 85d46bb0a3..5c34caef6b 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -712,67 +712,6 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut #ifndef QT_NO_ITEMVIEWS -QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int role) const -{ - const QWidget *widget = option->widget; - switch (role) { - case Qt::CheckStateRole: - if (option->features & QStyleOptionViewItem::HasCheckIndicator) - return QSize(proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth, option, widget), - proxyStyle->pixelMetric(QStyle::PM_IndicatorHeight, option, widget)); - break; - case Qt::DisplayRole: - if (option->features & QStyleOptionViewItem::HasDisplay) { - QTextOption textOption; - textOption.setWrapMode(QTextOption::WordWrap); - QTextLayout textLayout; - textLayout.setTextOption(textOption); - textLayout.setFont(option->font); - textLayout.setText(option->text); - const bool wrapText = option->features & QStyleOptionViewItem::WrapText; - const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget) + 1; - QRect bounds = option->rect; - switch (option->decorationPosition) { - case QStyleOptionViewItem::Left: - case QStyleOptionViewItem::Right: - bounds.setWidth(wrapText && bounds.isValid() ? bounds.width() - 2 * textMargin : QFIXED_MAX); - break; - case QStyleOptionViewItem::Top: - case QStyleOptionViewItem::Bottom: - bounds.setWidth(wrapText ? option->decorationSize.width() : QFIXED_MAX); - break; - default: - break; - } - - qreal height = 0, widthUsed = 0; - textLayout.beginLayout(); - while (true) { - QTextLine line = textLayout.createLine(); - if (!line.isValid()) - break; - line.setLineWidth(bounds.width()); - line.setPosition(QPointF(0, height)); - height += line.height(); - widthUsed = qMax(widthUsed, line.naturalTextWidth()); - } - textLayout.endLayout(); - const QSize size(qCeil(widthUsed), qCeil(height)); - return QSize(size.width() + 2 * textMargin, size.height()); - } - break; - case Qt::DecorationRole: - if (option->features & QStyleOptionViewItem::HasDecoration) { - return option->decorationSize; - } - break; - default: - break; - } - - return QSize(0, 0); -} - static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth) { qreal height = 0; @@ -791,6 +730,53 @@ static QSizeF viewItemTextLayout(QTextLayout &textLayout, int lineWidth) return QSizeF(widthUsed, height); } +QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int role) const +{ + const QWidget *widget = option->widget; + switch (role) { + case Qt::CheckStateRole: + if (option->features & QStyleOptionViewItem::HasCheckIndicator) + return QSize(proxyStyle->pixelMetric(QStyle::PM_IndicatorWidth, option, widget), + proxyStyle->pixelMetric(QStyle::PM_IndicatorHeight, option, widget)); + break; + case Qt::DisplayRole: + if (option->features & QStyleOptionViewItem::HasDisplay) { + QTextOption textOption; + textOption.setWrapMode(QTextOption::WordWrap); + QTextLayout textLayout(option->text, option->font); + textLayout.setTextOption(textOption); + const bool wrapText = option->features & QStyleOptionViewItem::WrapText; + const int textMargin = proxyStyle->pixelMetric(QStyle::PM_FocusFrameHMargin, option, widget) + 1; + QRect bounds = option->rect; + switch (option->decorationPosition) { + case QStyleOptionViewItem::Left: + case QStyleOptionViewItem::Right: + bounds.setWidth(wrapText && bounds.isValid() ? bounds.width() - 2 * textMargin : QFIXED_MAX); + break; + case QStyleOptionViewItem::Top: + case QStyleOptionViewItem::Bottom: + bounds.setWidth(wrapText ? option->decorationSize.width() : QFIXED_MAX); + break; + default: + break; + } + + const int lineWidth = bounds.width(); + const QSizeF size = viewItemTextLayout(textLayout, lineWidth); + return QSize(qCeil(size.width()) + 2 * textMargin, qCeil(size.height())); + } + break; + case Qt::DecorationRole: + if (option->features & QStyleOptionViewItem::HasDecoration) { + return option->decorationSize; + } + break; + default: + break; + } + + return QSize(0, 0); +} void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewItem *option, const QRect &rect) const { @@ -803,10 +789,8 @@ void QCommonStylePrivate::viewItemDrawText(QPainter *p, const QStyleOptionViewIt textOption.setWrapMode(wrapText ? QTextOption::WordWrap : QTextOption::ManualWrap); textOption.setTextDirection(option->direction); textOption.setAlignment(QStyle::visualAlignment(option->direction, option->displayAlignment)); - QTextLayout textLayout; + QTextLayout textLayout(option->text, option->font); textLayout.setTextOption(textOption); - textLayout.setFont(option->font); - textLayout.setText(option->text); viewItemTextLayout(textLayout, textRect.width()); From 21426f281e09b6043e3c1f9b5d3a48644a4965fe Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Fri, 12 Oct 2012 13:37:21 +0200 Subject: [PATCH 49/84] moc: parse properly the gcc extension for variadic macro Task-number: QTBUG-27547 Change-Id: I983b96b09c405e5330327092e56164b9921a2d0f Reviewed-by: Lars Knoll --- src/tools/moc/preprocessor.cpp | 14 ++++++++++++-- tests/auto/tools/moc/parse-defines.h | 12 ++++++++++++ tests/auto/tools/moc/tst_moc.cpp | 6 ++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp index 40bba33d40..566be9c039 100644 --- a/src/tools/moc/preprocessor.cpp +++ b/src/tools/moc/preprocessor.cpp @@ -1201,8 +1201,18 @@ void Preprocessor::parseDefineArguments(Macro *m) t = next(); if (t == PP_RPAREN) break; - if (t != PP_COMMA) - error("Unexpected character in macro argument list."); + if (t == PP_COMMA) + continue; + if (lexem() == "...") { + //GCC extension: #define FOO(x, y...) x(y) + // The last argument was already parsed. Just mark the macro as variadic. + m->isVariadic = true; + while (test(PP_WHITESPACE)); + if (!test(PP_RPAREN)) + error("missing ')' in macro argument list"); + break; + } + error("Unexpected character in macro argument list."); } m->arguments = arguments; while (test(PP_WHITESPACE)); diff --git a/tests/auto/tools/moc/parse-defines.h b/tests/auto/tools/moc/parse-defines.h index bc22444b5b..eb47253587 100644 --- a/tests/auto/tools/moc/parse-defines.h +++ b/tests/auto/tools/moc/parse-defines.h @@ -65,6 +65,14 @@ #if defined(Q_COMPILER_VARIADIC_MACROS) #define PD_VARARG(x, ...) x(__VA_ARGS__) + +#if defined(Q_CC_GNU) || defined(Q_MOC_RUN) +//GCC extension for variadic macros +#define PD_VARARGEXT(x, y...) x(y) +#else +#define PD_VARARGEXT(x, ...) x(__VA_ARGS__) +#endif + #endif PD_BEGIN_NAMESPACE @@ -95,6 +103,10 @@ public slots: PD_VARARG(void vararg1) {} PD_VARARG(void vararg2, int) {} PD_VARARG(void vararg3, int, int) {} + + PD_VARARGEXT(void vararg4) {} + PD_VARARGEXT(void vararg5, int) {} + PD_VARARGEXT(void vararg6, int, int) {} #endif }; diff --git a/tests/auto/tools/moc/tst_moc.cpp b/tests/auto/tools/moc/tst_moc.cpp index 0cd6c295cc..d861b84e00 100644 --- a/tests/auto/tools/moc/tst_moc.cpp +++ b/tests/auto/tools/moc/tst_moc.cpp @@ -2744,6 +2744,12 @@ void tst_Moc::parseDefines() QVERIFY(index != -1); index = mo->indexOfSlot("vararg3(int,int)"); QVERIFY(index != -1); + index = mo->indexOfSlot("vararg4()"); + QVERIFY(index != -1); + index = mo->indexOfSlot("vararg5(int)"); + QVERIFY(index != -1); + index = mo->indexOfSlot("vararg6(int,int)"); + QVERIFY(index != -1); #endif int count = 0; From 24a231d7a3f54a4a3ac23aed4759bb9b7556c15f Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 18 Sep 2012 13:54:35 +0200 Subject: [PATCH 50/84] Re-revert "Delay creation of the process manager" This reverts commit daba2c507ad42c66dafa6a29cffa94e9641e0c58, re-applying commit d9c06bf25210b3d0b31ee6126e57bcb82c292da1, because the change was accidentally brought back in commit eae8fb85997d82ecec0743ba3e470681129bff41. There's a potential deadlock when a QProcess is created while a QCoreApplication is instantiated but never executed, or if the main thread waits() for the child thread. Task-number: QTBUG-27260 Change-Id: I9e0fdc0341b3063de90979377bac35f2a827b260 Reviewed-by: Oswald Buddenhagen --- src/corelib/io/qprocess_unix.cpp | 15 +--- src/corelib/kernel/qcoreapplication.cpp | 18 ++-- src/corelib/kernel/qcoreapplication.h | 1 - src/corelib/kernel/qcoreapplication_p.h | 2 - tests/auto/corelib/io/io.pro | 1 + .../qprocess-noapplication.pro | 5 ++ .../tst_qprocessnoapplication.cpp | 84 +++++++++++++++++++ 7 files changed, 98 insertions(+), 28 deletions(-) create mode 100644 tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro create mode 100644 tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp index 1ef7af586f..0a928e4603 100644 --- a/src/corelib/io/qprocess_unix.cpp +++ b/src/corelib/io/qprocess_unix.cpp @@ -177,7 +177,7 @@ static QProcessManager *processManager() QMutexLocker locker(&processManagerGlobalMutex); if (!processManagerInstance) - QProcessPrivate::initializeProcessManager(); + new QProcessManager; Q_ASSERT(processManagerInstance); return processManagerInstance; @@ -185,9 +185,6 @@ static QProcessManager *processManager() QProcessManager::QProcessManager() { - // can only be called from main thread - Q_ASSERT(!qApp || qApp->thread() == QThread::currentThread()); - #if defined (QPROCESS_DEBUG) qDebug() << "QProcessManager::QProcessManager()"; #endif @@ -1434,15 +1431,7 @@ bool QProcessPrivate::startDetached(const QString &program, const QStringList &a void QProcessPrivate::initializeProcessManager() { - if (qApp && qApp->thread() != QThread::currentThread()) { - // The process manager must be initialized in the main thread - // Note: The call below will re-enter this function, but in the right thread, - // so the else statement below will be executed. - QMetaObject::invokeMethod(qApp, "_q_initializeProcessManager", Qt::BlockingQueuedConnection); - } else { - static QProcessManager processManager; - Q_UNUSED(processManager); - } + (void) processManager(); } QT_END_NAMESPACE diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 1e4a6f4c8c..df0ffce12d 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -392,16 +392,6 @@ void QCoreApplicationPrivate::createEventDispatcher() #endif } -void QCoreApplicationPrivate::_q_initializeProcessManager() -{ -#ifndef QT_NO_PROCESS -# ifdef Q_OS_UNIX - QProcessPrivate::initializeProcessManager(); -# endif -#endif -} - - QThread *QCoreApplicationPrivate::theMainThread = 0; QThread *QCoreApplicationPrivate::mainThread() { @@ -625,6 +615,12 @@ void QCoreApplication::init() d->appendApplicationPathToLibraryPaths(); #endif +#if defined(Q_OS_UNIX) && !(defined(QT_NO_PROCESS)) + // Make sure the process manager thread object is created in the main + // thread. + QProcessPrivate::initializeProcessManager(); +#endif + #ifdef QT_EVAL extern void qt_core_eval_init(uint); qt_core_eval_init(d->application_type); @@ -2364,5 +2360,3 @@ void QCoreApplication::setEventDispatcher(QAbstractEventDispatcher *eventDispatc */ QT_END_NAMESPACE - -#include "moc_qcoreapplication.cpp" diff --git a/src/corelib/kernel/qcoreapplication.h b/src/corelib/kernel/qcoreapplication.h index 388877cbec..622139e6f8 100644 --- a/src/corelib/kernel/qcoreapplication.h +++ b/src/corelib/kernel/qcoreapplication.h @@ -178,7 +178,6 @@ protected: QCoreApplication(QCoreApplicationPrivate &p); private: - Q_PRIVATE_SLOT(d_func(), void _q_initializeProcessManager()) static bool sendSpontaneousEvent(QObject *receiver, QEvent *event); bool notifyInternal(QObject *receiver, QEvent *event); diff --git a/src/corelib/kernel/qcoreapplication_p.h b/src/corelib/kernel/qcoreapplication_p.h index 393ae1c55a..321f6905a4 100644 --- a/src/corelib/kernel/qcoreapplication_p.h +++ b/src/corelib/kernel/qcoreapplication_p.h @@ -76,8 +76,6 @@ public: bool sendThroughObjectEventFilters(QObject *, QEvent *); bool notify_helper(QObject *, QEvent *); - void _q_initializeProcessManager(); - QString appName() const; virtual void createEventDispatcher(); static void removePostedEvent(QEvent *); diff --git a/tests/auto/corelib/io/io.pro b/tests/auto/corelib/io/io.pro index f6542d9fd3..03b42a2cbb 100644 --- a/tests/auto/corelib/io/io.pro +++ b/tests/auto/corelib/io/io.pro @@ -16,6 +16,7 @@ SUBDIRS=\ qipaddress \ qnodebug \ qprocess \ + qprocess-noapplication \ qprocessenvironment \ qresourceengine \ qsettings \ diff --git a/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro b/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro new file mode 100644 index 0000000000..2f409ebdbc --- /dev/null +++ b/tests/auto/corelib/io/qprocess-noapplication/qprocess-noapplication.pro @@ -0,0 +1,5 @@ +CONFIG += testcase +CONFIG += parallel_test +CONFIG -= app_bundle debug_and_release_target +QT = core testlib +SOURCES = tst_qprocessnoapplication.cpp diff --git a/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp b/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp new file mode 100644 index 0000000000..33146cafd1 --- /dev/null +++ b/tests/auto/corelib/io/qprocess-noapplication/tst_qprocessnoapplication.cpp @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Intel Corporation. +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** 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, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, 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. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include +#include + +class tst_QProcessNoApplication : public QObject +{ + Q_OBJECT + +private Q_SLOTS: + void initializationDeadlock(); +}; + +void tst_QProcessNoApplication::initializationDeadlock() +{ + // see QTBUG-27260 + // QProcess on Unix uses (or used to, at the time of the writing of this test) + // a global class called QProcessManager. + // This class is instantiated (or was) only in the main thread, which meant that + // blocking the main thread while waiting for QProcess could mean a deadlock. + + struct MyThread : public QThread + { + void run() + { + // what we execute does not matter, as long as we try to + // and that the process exits + QProcess::execute("true"); + } + }; + + static char argv0[] = "tst_QProcessNoApplication"; + char *argv[] = { argv0, 0 }; + int argc = 1; + QCoreApplication app(argc, argv); + MyThread thread; + thread.start(); + QVERIFY(thread.wait(10000)); +} + +QTEST_APPLESS_MAIN(tst_QProcessNoApplication) + +#include "tst_qprocessnoapplication.moc" From 6343a46bc5160baf9e7dd79e43419ee1be52d505 Mon Sep 17 00:00:00 2001 From: Sergio Ahumada Date: Sun, 14 Oct 2012 17:05:41 +0200 Subject: [PATCH 51/84] Change copyrights from Nokia to Digia Change copyrights and license headers from Nokia to Digia Change-Id: Ia683171b30b5bf7cedb56cc3087b4b68644a3da1 Reviewed-by: Lars Knoll --- examples/webkit/webkit-guide/_copyright.txt | 8 +++++--- examples/webkit/webkit-guide/_image_assets.htm | 5 +++-- examples/webkit/webkit-guide/anim_accord.htm | 5 +++-- examples/webkit/webkit-guide/anim_demo-rotate.htm | 5 +++-- examples/webkit/webkit-guide/anim_demo-scale.htm | 5 +++-- examples/webkit/webkit-guide/anim_demo-skew.htm | 5 +++-- examples/webkit/webkit-guide/anim_gallery.htm | 5 +++-- examples/webkit/webkit-guide/anim_panel.htm | 5 +++-- examples/webkit/webkit-guide/anim_pulse.htm | 5 +++-- examples/webkit/webkit-guide/anim_skew.htm | 5 +++-- examples/webkit/webkit-guide/anim_slide1.htm | 5 +++-- examples/webkit/webkit-guide/anim_slide2.htm | 5 +++-- examples/webkit/webkit-guide/anim_slide3.htm | 5 +++-- examples/webkit/webkit-guide/anim_tabbedSkew.htm | 5 +++-- examples/webkit/webkit-guide/css3_backgrounds.htm | 5 +++-- examples/webkit/webkit-guide/css3_border-img.htm | 5 +++-- examples/webkit/webkit-guide/css3_grad-radial.htm | 5 +++-- examples/webkit/webkit-guide/css3_gradientBack.htm | 5 +++-- examples/webkit/webkit-guide/css3_gradientBackStop.htm | 5 +++-- examples/webkit/webkit-guide/css3_gradientButton.htm | 5 +++-- examples/webkit/webkit-guide/css3_mask-grad.htm | 5 +++-- examples/webkit/webkit-guide/css3_mask-img.htm | 5 +++-- examples/webkit/webkit-guide/css3_multicol.htm | 5 +++-- examples/webkit/webkit-guide/css3_reflect.htm | 5 +++-- examples/webkit/webkit-guide/css3_scroll.htm | 5 +++-- examples/webkit/webkit-guide/css3_sel-nth.htm | 5 +++-- examples/webkit/webkit-guide/css3_shadow.htm | 5 +++-- examples/webkit/webkit-guide/css3_text-overflow.htm | 5 +++-- examples/webkit/webkit-guide/css3_text-shadow.htm | 5 +++-- examples/webkit/webkit-guide/css3_text-stroke.htm | 5 +++-- examples/webkit/webkit-guide/form_tapper.htm | 5 +++-- examples/webkit/webkit-guide/form_toggler.htm | 5 +++-- examples/webkit/webkit-guide/layout_link-fmt.htm | 5 +++-- examples/webkit/webkit-guide/layout_tbl-keyhole.htm | 5 +++-- examples/webkit/webkit-guide/mob_condjs.htm | 5 +++-- examples/webkit/webkit-guide/mob_layout.htm | 5 +++-- examples/webkit/webkit-guide/mob_mediaquery.htm | 5 +++-- examples/webkit/webkit-guide/storage.htm | 5 +++-- 38 files changed, 116 insertions(+), 77 deletions(-) diff --git a/examples/webkit/webkit-guide/_copyright.txt b/examples/webkit/webkit-guide/_copyright.txt index 198140cdeb..b90716cf3a 100644 --- a/examples/webkit/webkit-guide/_copyright.txt +++ b/examples/webkit/webkit-guide/_copyright.txt @@ -1,8 +1,10 @@