From 29a6523dd8d3fac9be198c73153691c6dcdb3b21 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 10 Aug 2010 15:58:25 +0200 Subject: Make selection work across ligatures For widgets like QPlainTextEdit, selection across ligatures (typically 'fi', 'ffi', 'fl', etc.) end up highlighting the entire ligature glyphs, this patch fixed that by dividing width inside the ligature so that selection will not expand past the actual selected characters. Since cursor position already considered this, we merely adopted the algorithm and made it a separated helper function for all necessary cases. Dividing width directly looks like a temporary workaround but works well enough so far for cursor positions. Task-number: QTBUG-11969 Reviewed-by: Eskil (cherry picked from commit 99fd5825dfb4d50cff93165995701a65b7a8e4ed) --- src/gui/text/qtextlayout.cpp | 64 +++++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 21 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index c34a04b..7328ea9 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1011,6 +1011,35 @@ QScriptItem &QTextLineItemIterator::next() return *si; } +static QFixed offsetInLigature(const unsigned short *logClusters, + const QGlyphLayout &glyphs, + int pos, int max, int glyph_pos) +{ + int offsetInCluster = 0; + for (int i = pos - 1; i >= 0; i--) { + if (logClusters[i] == glyph_pos) + offsetInCluster++; + else + break; + } + + // in the case that the offset is inside a (multi-character) glyph, + // interpolate the position. + if (offsetInCluster > 0) { + int clusterLength = 0; + for (int i = pos - offsetInCluster; i < max; i++) { + if (logClusters[i] == glyph_pos) + clusterLength++; + else + break; + } + if (clusterLength) + return glyphs.advances_x[glyph_pos] * offsetInCluster / clusterLength; + } + + return 0; +} + bool QTextLineItemIterator::getSelectionBounds(QFixed *selectionX, QFixed *selectionWidth) const { *selectionX = *selectionWidth = 0; @@ -1050,8 +1079,19 @@ bool QTextLineItemIterator::getSelectionBounds(QFixed *selectionX, QFixed *selec swidth += glyphs.effectiveAdvance(g); } - *selectionX = x + soff; - *selectionWidth = swidth; + // If the starting character is in the middle of a ligature, + // selection should only contain the right part of that ligature + // glyph, so we need to get the width of the left part here and + // add it to *selectionX + QFixed leftOffsetInLigature = offsetInLigature(logClusters, glyphs, from, + to, start_glyph); + *selectionX = x + soff + leftOffsetInLigature; + *selectionWidth = swidth - leftOffsetInLigature; + // If the ending character is also part of a ligature, swidth does + // not contain that part yet, we also need to find out the width of + // that left part + *selectionWidth += offsetInLigature(logClusters, glyphs, to, + eng->length(item), end_glyph); } return true; } @@ -2465,14 +2505,6 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const if(pos == l) x += si->width; } else { - int offsetInCluster = 0; - for (int i=pos-1; i >= 0; i--) { - if (logClusters[i] == glyph_pos) - offsetInCluster++; - else - break; - } - if (reverse) { int end = qMin(lineEnd, si->position + l) - si->position; int glyph_end = end == l ? si->num_glyphs : logClusters[end]; @@ -2484,17 +2516,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const for (int i = glyph_start; i < glyph_pos; i++) x += glyphs.effectiveAdvance(i); } - if (offsetInCluster > 0) { // in the case that the offset is inside a (multi-character) glyph, interpolate the position. - int clusterLength = 0; - for (int i=pos - offsetInCluster; i < line.length; i++) { - if (logClusters[i] == glyph_pos) - clusterLength++; - else - break; - } - if (clusterLength) - x+= glyphs.advances_x[glyph_pos] * offsetInCluster / clusterLength; - } + x += offsetInLigature(logClusters, glyphs, pos, line.length, glyph_pos); } *cursorPos = pos + si->position; -- cgit v0.12 From d80949eee06ff464d58bd97a6c89bae7e961f3c8 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Thu, 19 May 2011 12:40:03 +0200 Subject: Fix ligature offset in multi-line text Reviewed-by: Eskil --- src/gui/text/qtextlayout.cpp | 4 ++-- tests/auto/qtextlayout/tst_qtextlayout.cpp | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 7328ea9..de4ca4f 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2505,8 +2505,8 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const if(pos == l) x += si->width; } else { + int end = qMin(lineEnd, si->position + l) - si->position; if (reverse) { - int end = qMin(lineEnd, si->position + l) - si->position; int glyph_end = end == l ? si->num_glyphs : logClusters[end]; for (int i = glyph_end - 1; i >= glyph_pos; i--) x += glyphs.effectiveAdvance(i); @@ -2516,7 +2516,7 @@ qreal QTextLine::cursorToX(int *cursorPos, Edge edge) const for (int i = glyph_start; i < glyph_pos; i++) x += glyphs.effectiveAdvance(i); } - x += offsetInLigature(logClusters, glyphs, pos, line.length, glyph_pos); + x += offsetInLigature(logClusters, glyphs, pos, end, glyph_pos); } *cursorPos = pos + si->position; diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index ad33b70..964679a 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -126,6 +126,7 @@ private slots: void textWidthWithStackedTextEngine(); void textWidthWithLineSeparator(); void textWithSurrogates_qtbug15679(); + void cursorInLigatureWithMultipleLines(); private: QFont testFont; @@ -1436,5 +1437,21 @@ void tst_QTextLayout::textWithSurrogates_qtbug15679() QCOMPARE(x[2] - x[0], x[5] - x[3]); } +void tst_QTextLayout::cursorInLigatureWithMultipleLines() +{ +#if !defined(Q_WS_MAC) + QSKIP("This test can only be run on Mac", SkipAll); +#endif + QTextLayout layout("first line finish", QFont("Times", 20)); + layout.beginLayout(); + QTextLine line = layout.createLine(); + line.setLineWidth(70); + line = layout.createLine(); + layout.endLayout(); + + // The second line will be "finish", with "fi" as a ligature + QVERIFY(line.cursorToX(0) != line.cursorToX(1)); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From e5f38bb543696813a70995c90cd5450602c0356c Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Thu, 19 May 2011 10:29:49 +0200 Subject: Support placing cursor in ligature with mouse or touch We need to find out the closest element in the ligature to the point we clicked (or tapped), currently we do this by dividing the width of that ligature glyph evenly by the number of characters it covered. We only support Common and Greek script at this point, ligatures in other scripts are still handled as a whole. Task-number: QTBUG-19260 Reviewed-by: Eskil --- src/gui/text/qtextengine.cpp | 66 ++++++++++++++++++++++++++++++ src/gui/text/qtextengine_p.h | 3 ++ src/gui/text/qtextlayout.cpp | 12 +++--- tests/auto/qtextlayout/tst_qtextlayout.cpp | 25 +++++++++++ 4 files changed, 99 insertions(+), 7 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 806779a..62de1fe 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2697,6 +2697,72 @@ QFixed QTextEngine::leadingSpaceWidth(const QScriptLine &line) return width(line.from + pos, line.length - pos); } +// Scan in logClusters[from..to-1] for glyph_pos +int QTextEngine::getClusterLength(unsigned short *logClusters, + const HB_CharAttributes *attributes, + int from, int to, int glyph_pos, int *start) +{ + int clusterLength = 0; + for (int i = from; i < to; i++) { + if (logClusters[i] == glyph_pos && attributes[i].charStop) { + if (*start < 0) + *start = i; + clusterLength++; + } + else if (clusterLength) + break; + } + return clusterLength; +} + +int QTextEngine::positionInLigature(const QScriptItem *si, int end, + QFixed x, QFixed edge, int glyph_pos) +{ + unsigned short *logClusters = this->logClusters(si); + int clusterStart = -1; + int clusterLength = 0; + + if (si->analysis.script != QUnicodeTables::Common && + si->analysis.script != QUnicodeTables::Greek) { + if (glyph_pos == -1) + return si->position + end; + else { + int i; + for (i = 0; i < end; i++) + if (logClusters[i] == glyph_pos) + break; + return si->position + i; + } + } + + if (glyph_pos == -1 && end > 0) + glyph_pos = logClusters[end - 1]; + else { + if (x < edge) + glyph_pos--; + } + + const HB_CharAttributes *attrs = attributes(); + clusterLength = getClusterLength(logClusters, attrs, 0, end, glyph_pos, &clusterStart); + + if (clusterLength) { + const QGlyphLayout &glyphs = shapedGlyphs(si); + QFixed glyphWidth = glyphs.effectiveAdvance(glyph_pos); + // the approximate width of each individual element of the ligature + QFixed perItemWidth = glyphWidth / clusterLength; + QFixed left = x > edge ? edge : edge - glyphWidth; + int n = ((x - left) / perItemWidth).floor().toInt(); + QFixed dist = x - left - n * perItemWidth; + int closestItem = dist > (perItemWidth / 2) ? n + 1 : n; + int pos = si->position + clusterStart + closestItem; + // Jump to the next charStop + while (!attrs[pos].charStop && pos < end) + pos++; + return pos; + } + return si->position + end; +} + QStackTextEngine::QStackTextEngine(const QString &string, const QFont &f) : QTextEngine(string, f), _layoutData(string, _memory, MemSize) diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index 5e33f21..f8939e3 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -594,6 +594,8 @@ public: void shapeLine(const QScriptLine &line); QFixed leadingSpaceWidth(const QScriptLine &line); + int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos); + private: void setBoundary(int strPos) const; void addRequiredBoundaries() const; @@ -608,6 +610,7 @@ private: void splitItem(int item, int pos) const; void resolveAdditionalFormats() const; + int getClusterLength(unsigned short *logClusters, const HB_CharAttributes *attributes, int from, int to, int glyph_pos, int *start); }; class QStackTextEngine : public QTextEngine { diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index de4ca4f..5857f33 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2622,6 +2622,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const } int glyph_pos = -1; + QFixed edge; // has to be inside run if (cpos == QTextLine::CursorOnCharacter) { if (si.analysis.bidiLevel % 2) { @@ -2632,6 +2633,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const if (pos < x) break; glyph_pos = gs; + edge = pos; break; } pos -= glyphs.effectiveAdvance(gs); @@ -2644,6 +2646,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const if (pos > x) break; glyph_pos = gs; + edge = pos; } pos += glyphs.effectiveAdvance(gs); ++gs; @@ -2672,15 +2675,10 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const } } if (qAbs(x-pos) < dist) - return si.position + end; + return eng->positionInLigature(&si, end, x, pos, -1); } Q_ASSERT(glyph_pos != -1); - int j; - for (j = 0; j < eng->length(item); ++j) - if (logClusters[j] == glyph_pos) - break; -// qDebug("at pos %d (in run: %d)", si.position + j, j); - return si.position + j; + return eng->positionInLigature(&si, end, x, edge, glyph_pos); } } // right of last item diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 964679a..df84c8f 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -127,6 +127,7 @@ private slots: void textWidthWithLineSeparator(); void textWithSurrogates_qtbug15679(); void cursorInLigatureWithMultipleLines(); + void xToCursorForLigatures(); private: QFont testFont; @@ -1453,5 +1454,29 @@ void tst_QTextLayout::cursorInLigatureWithMultipleLines() QVERIFY(line.cursorToX(0) != line.cursorToX(1)); } +void tst_QTextLayout::xToCursorForLigatures() +{ +#if !defined(Q_WS_MAC) + QSKIP("This test can not be run on Mac", SkipAll); +#endif + QTextLayout layout("fi", QFont("Times", 20)); + layout.beginLayout(); + QTextLine line = layout.createLine(); + layout.endLayout(); + + QVERIFY(line.xToCursor(0) != line.xToCursor(line.naturalTextWidth() / 2)); + + // U+0061 U+0308 + QTextLayout layout2(QString::fromUtf8("\x61\xCC\x88"), QFont("Times", 20)); + + layout2.beginLayout(); + line = layout2.createLine(); + layout2.endLayout(); + + qreal width = line.naturalTextWidth(); + QVERIFY(line.xToCursor(0) == line.xToCursor(width / 2) || + line.xToCursor(width) == line.xToCursor(width / 2)); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" -- cgit v0.12 From b001e886b35d06ca2551709280f0541cdc75c34a Mon Sep 17 00:00:00 2001 From: Xizhi Zhu Date: Tue, 24 May 2011 13:43:45 +0300 Subject: Fix the state of default network configuration. PMO Bug 257336 - Default configuration remains in QNetworkConfiguration::Active state even when device moves out of WLAN coverage This fix sets the default network configuration (of type UserChoice) back to Discovered when the network session is disconnected. Reviewed-by: Cristiano di Flora --- src/plugins/bearer/icd/qnetworksession_impl.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/bearer/icd/qnetworksession_impl.cpp b/src/plugins/bearer/icd/qnetworksession_impl.cpp index f08d8bf..a99c0a7 100644 --- a/src/plugins/bearer/icd/qnetworksession_impl.cpp +++ b/src/plugins/bearer/icd/qnetworksession_impl.cpp @@ -183,6 +183,12 @@ void QNetworkSessionPrivateImpl::updateState(QNetworkSession::State newState) icdConfig->mutex.lock(); icdConfig->state = QNetworkConfiguration::Defined; icdConfig->mutex.unlock(); + + // Reset the state of the default configuration to Discovered + icdConfig = toIcdConfig(privateConfiguration(publicConfig)); + icdConfig->mutex.lock(); + icdConfig->state = QNetworkConfiguration::Discovered; + icdConfig->mutex.unlock(); } else { if (!activeConfig.isValid()) { // Active configuration (IAP) was removed from system -- cgit v0.12 From 7214d84f3296a05e6db09f0ed12702b21c3fcb30 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 24 May 2011 14:18:23 +0200 Subject: Fix xToCursor issue due to backporting from 4.8 Task-number: QTBUG-19260 Reviewed-by: TrustMe --- src/gui/text/qtextlayout.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 5857f33..a9179ed 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2659,6 +2659,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const while (gs <= ge) { if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) { glyph_pos = gs; + edge = pos; dist = qAbs(x-pos); } pos -= glyphs.effectiveAdvance(gs); @@ -2668,6 +2669,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const while (gs <= ge) { if (glyphs.attributes[gs].clusterStart && qAbs(x-pos) < dist) { glyph_pos = gs; + edge = pos; dist = qAbs(x-pos); } pos += glyphs.effectiveAdvance(gs); -- cgit v0.12 From 67ed18497705fa938728c505d165173dc5d3de68 Mon Sep 17 00:00:00 2001 From: Martin Jones Date: Wed, 25 May 2011 13:01:33 +1000 Subject: Flickable could flick in wrong direction if given too few touch samples If we got <= QML_FLICK_DISCARDSAMPLES the previous velocity was not cleared, so the view would continue flicking with the previous velocity, and therefore the previous direction. Change-Id: I876610f4522f32c814449309b01ec3787c5f6cc6 Task-number: QT-4903 Reviewed-by: Andrew den Exter --- src/declarative/graphicsitems/qdeclarativeflickable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp index 82ed18c..2bf863b 100644 --- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp +++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp @@ -232,8 +232,8 @@ void QDeclarativeFlickablePrivate::AxisData::addVelocitySample(qreal v, qreal ma void QDeclarativeFlickablePrivate::AxisData::updateVelocity() { + velocity = 0; if (velocityBuffer.count() > QML_FLICK_DISCARDSAMPLES) { - velocity = 0; int count = velocityBuffer.count()-QML_FLICK_DISCARDSAMPLES; for (int i = 0; i < count; ++i) { qreal v = velocityBuffer.at(i); -- cgit v0.12 From 1013cf05d579dbcf61890b5529a6e970aa562a19 Mon Sep 17 00:00:00 2001 From: shiroki Date: Wed, 25 May 2011 11:26:23 +0200 Subject: fix the "Host" header for ipv6 URLs in QNAM Reviewed-by: Markus Goetz --- src/network/access/qhttpnetworkconnection.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp index 61230fc..d76a5fd 100644 --- a/src/network/access/qhttpnetworkconnection.cpp +++ b/src/network/access/qhttpnetworkconnection.cpp @@ -256,7 +256,17 @@ void QHttpNetworkConnectionPrivate::prepareRequest(HttpMessagePair &messagePair) // set the host value = request.headerField("host"); if (value.isEmpty()) { - QByteArray host = QUrl::toAce(hostName); + QHostAddress add; + QByteArray host; + if(add.setAddress(hostName)) { + if(add.protocol() == QAbstractSocket::IPv6Protocol) { + host = "[" + hostName.toAscii() + "]";//format the ipv6 in the standard way + } else { + host = QUrl::toAce(hostName); + } + } else { + host = QUrl::toAce(hostName); + } int port = request.url().port(); if (port != -1) { -- cgit v0.12 From e38aaf9f7c91efb6197f7f579e3064e0e6dcce1e Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 25 May 2011 10:55:52 +0200 Subject: Fix cursor position test on CursorOnCharacter case Reviewed-by: TrustMe --- src/gui/text/qtextengine.cpp | 5 ++++- src/gui/text/qtextengine_p.h | 2 +- src/gui/text/qtextlayout.cpp | 6 ++++-- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 62de1fe..69598cf 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2716,7 +2716,8 @@ int QTextEngine::getClusterLength(unsigned short *logClusters, } int QTextEngine::positionInLigature(const QScriptItem *si, int end, - QFixed x, QFixed edge, int glyph_pos) + QFixed x, QFixed edge, int glyph_pos, + bool cursorOnCharacter) { unsigned short *logClusters = this->logClusters(si); int clusterStart = -1; @@ -2754,6 +2755,8 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end, int n = ((x - left) / perItemWidth).floor().toInt(); QFixed dist = x - left - n * perItemWidth; int closestItem = dist > (perItemWidth / 2) ? n + 1 : n; + if (cursorOnCharacter && closestItem > 0) + closestItem--; int pos = si->position + clusterStart + closestItem; // Jump to the next charStop while (!attrs[pos].charStop && pos < end) diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index f8939e3..09610ff 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -594,7 +594,7 @@ public: void shapeLine(const QScriptLine &line); QFixed leadingSpaceWidth(const QScriptLine &line); - int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos); + int positionInLigature(const QScriptItem *si, int end, QFixed x, QFixed edge, int glyph_pos, bool cursorOnCharacter); private: void setBoundary(int strPos) const; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index a9179ed..4b3c9e7 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2677,10 +2677,12 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const } } if (qAbs(x-pos) < dist) - return eng->positionInLigature(&si, end, x, pos, -1); + return eng->positionInLigature(&si, end, x, pos, -1, + cpos == QTextLine::CursorOnCharacter); } Q_ASSERT(glyph_pos != -1); - return eng->positionInLigature(&si, end, x, edge, glyph_pos); + return eng->positionInLigature(&si, end, x, edge, glyph_pos, + cpos == QTextLine::CursorOnCharacter); } } // right of last item -- cgit v0.12 From 3f82ecbd0e2cdf477e57c7fe41b63c09d7e84787 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Wed, 25 May 2011 18:24:30 +0200 Subject: Fix boundry conditions for cursor hit test Clicking at the edge of a glyph means lookup for the left glyph. Reviewed-by: TrustMe (cherry picked from commit 31110bf84bb06d57983501fa65fe0db3f7c61927) --- src/gui/text/qtextengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 69598cf..9271f34 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -2739,7 +2739,7 @@ int QTextEngine::positionInLigature(const QScriptItem *si, int end, if (glyph_pos == -1 && end > 0) glyph_pos = logClusters[end - 1]; else { - if (x < edge) + if (x <= edge) glyph_pos--; } -- cgit v0.12 From 6c10e72fc838f8f9f5c3a3e4a297088b1725262c Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Thu, 26 May 2011 13:56:54 +0200 Subject: Fix infinite recursion when changing geometry on Mac Some complex widgets might get a negatively sized rectangle when calling QWidgetPrivate:setGeometry_sys_helper(), triggering a infinite recursion. Normalizing the rectangle size before checking for size change is enough to break this infinite recursion. Reviewed-by: Richard Task-number: QTBUG-17333 --- src/gui/kernel/qwidget_mac.mm | 12 +++++------- tests/auto/qwidget/tst_qwidget.cpp | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 2f33f55..9481a85 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -4434,6 +4434,11 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM QPoint oldp = q->pos(); QSize olds = q->size(); + // Apply size restrictions, applicable for Windows & Widgets. + if (QWExtra *extra = extraData()) { + w = qBound(extra->minw, w, extra->maxw); + h = qBound(extra->minh, h, extra->maxh); + } const bool isResize = (olds != QSize(w, h)); if (!realWindow && !isResize && QPoint(x, y) == oldp) @@ -4443,13 +4448,6 @@ void QWidgetPrivate::setGeometry_sys_helper(int x, int y, int w, int h, bool isM data.window_state = data.window_state & ~Qt::WindowMaximized; const bool visible = q->isVisible(); - // Apply size restrictions, applicable for Windows & Widgets. - if (QWExtra *extra = extraData()) { - w = qMin(w, extra->maxw); - h = qMin(h, extra->maxh); - w = qMax(w, extra->minw); - h = qMax(h, extra->minh); - } data.crect = QRect(x, y, w, h); if (realWindow) { diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp index f85d469..43dd077 100644 --- a/tests/auto/qwidget/tst_qwidget.cpp +++ b/tests/auto/qwidget/tst_qwidget.cpp @@ -71,6 +71,7 @@ #include #include #include +#include #include #include @@ -406,6 +407,7 @@ private slots: void childAt(); #ifdef Q_WS_MAC void childAt_unifiedToolBar(); + void taskQTBUG_17333_ResizeInfiniteRecursion(); #ifdef QT_MAC_USE_COCOA void taskQTBUG_11373(); #endif // QT_MAC_USE_COCOA @@ -10593,6 +10595,18 @@ void tst_QWidget::childAt_unifiedToolBar() QCOMPARE(mainWindow.childAt(labelTopLeft), static_cast(label)); } +void tst_QWidget::taskQTBUG_17333_ResizeInfiniteRecursion() +{ + QTableView tb; + const char *s = "border: 1px solid;"; + tb.setStyleSheet(s); + tb.show(); + + QTest::qWaitForWindowShown(&tb); + tb.setGeometry(QRect(100, 100, 0, 100)); + // No crash, it works. +} + #ifdef QT_MAC_USE_COCOA void tst_QWidget::taskQTBUG_11373() { -- cgit v0.12 From fbe0d24bdd429248dbf9e9be592f15fd7b1648bc Mon Sep 17 00:00:00 2001 From: Joona Petrell Date: Thu, 14 Apr 2011 10:36:38 +0300 Subject: Remove unnecessary QtQuick 1.1 effectiveLayoutDirection, effectiveHorizontalAlignment and anchors.mirror properties * these properties are seldomly used * they confuse developers that do not care about right-to-left user interfaces * LayoutMirroring.enabled property can be used instead to determine if mirroring is enabled * if needed, you can easily determine the effective layout directions and alignments with a little bit of JavaScript: function effectiveLayoutDirection() { if (LayoutMirroring.enabled) return (listView.layoutDirection == Qt.LeftToRight) ? Qt.RightToLeft : Qt.LeftToRight; else return listView.layoutDirection; } Task-number: QTBUG-11042 Reviewed-by: Martin Jones --- doc/src/declarative/righttoleft.qdoc | 17 +++---- doc/src/declarative/whatsnew.qdoc | 14 +---- .../layoutdirection/layoutdirection.qml | 12 ++++- .../graphicsitems/qdeclarativeanchors_p.h | 2 - .../graphicsitems/qdeclarativegridview.cpp | 22 +++----- .../graphicsitems/qdeclarativegridview_p.h | 2 - src/declarative/graphicsitems/qdeclarativeitem.cpp | 1 - .../graphicsitems/qdeclarativelistview.cpp | 20 +++----- .../graphicsitems/qdeclarativelistview_p.h | 2 - .../graphicsitems/qdeclarativepositioners.cpp | 59 +++++++--------------- .../graphicsitems/qdeclarativepositioners_p.h | 6 --- src/declarative/graphicsitems/qdeclarativetext.cpp | 9 +--- src/declarative/graphicsitems/qdeclarativetext_p.h | 2 - .../graphicsitems/qdeclarativetextedit.cpp | 8 +-- .../graphicsitems/qdeclarativetextedit_p.h | 2 - .../graphicsitems/qdeclarativetextinput.cpp | 9 ++-- .../graphicsitems/qdeclarativetextinput_p.h | 2 - .../tst_qdeclarativeanchors.cpp | 5 +- 18 files changed, 58 insertions(+), 136 deletions(-) diff --git a/doc/src/declarative/righttoleft.qdoc b/doc/src/declarative/righttoleft.qdoc index 7db6136..cafc702 100644 --- a/doc/src/declarative/righttoleft.qdoc +++ b/doc/src/declarative/righttoleft.qdoc @@ -64,8 +64,7 @@ This default locale-based alignment can be overriden by setting the \c horizonta property for the text element, or by enabling layout mirroring using the \l LayoutMirroring attached property, which causes any explicit left and right horizontal alignments to be mirrored. Note that when \l LayoutMirroring is set, the \c horizontalAlignment property value remains unchanged; -the effective alignment of the text element that takes the mirroring into account can be read from the -\c effectiveHorizontalAlignment property. +use the property \c LayoutMirroring.enabled instead to query whether the mirroring is in effect. \snippet doc/src/snippets/declarative/righttoleft.qml 0 @@ -79,9 +78,9 @@ property for controlling the horizontal direction of the layouts. Setting \c lay the left-to-right layout direction. The horizontal layout direction can also be reversed through the \l LayoutMirroring attached property. -This causes the effective \c layoutDirection of positioners and views to be mirrored. Note the actual value -of the \c layoutDirection property will remain unchanged; the effective layout direction of positioners and -views that takes the mirroring into account can be read from the \c effectiveLayoutDirection property. +This causes the effective \c layoutDirection of positioners and views to be mirrored. Note though that the actual +value of the \c layoutDirection property will remain unchanged; use the property \c LayoutMirroring.enabled instead +to query whether the mirroring is in effect. \snippet doc/src/snippets/declarative/righttoleft.qml 1 @@ -101,12 +100,8 @@ Or set all child elements to also inherit the layout direction: \snippet doc/src/snippets/declarative/righttoleft.qml 3 Applying mirroring in this manner does not change the actual value of the relevant anchor, -\c layoutDirection or \c horizontalAlignment properties. The separate read-only property -\c effectiveLayoutDirection can be used to query the effective layout -direction of positioners and model views that takes the mirroring into account. Similarly the \l Text, -\l TextInput and \l TextEdit elements have gained the read-only property \c effectiveHorizontalAlignment -for querying the effective visual alignment of text. For anchors, the read only -\l {Item::anchors}{anchors.mirrored} property reflects whether anchors have been mirrored. +\c layoutDirection or \c horizontalAlignment properties. You can use \c LayoutMirroring.enabled to +query whether the mirroring is in effect. Note that application layouts and animations that are defined using \l {Item::}{x} property values (as opposed to anchors or positioner elements) are not affected by the \l LayoutMirroring attached property. diff --git a/doc/src/declarative/whatsnew.qdoc b/doc/src/declarative/whatsnew.qdoc index 6eb1548..c36a88c 100644 --- a/doc/src/declarative/whatsnew.qdoc +++ b/doc/src/declarative/whatsnew.qdoc @@ -41,13 +41,6 @@ PinchArea provides support for the common two finger pinch gesture. \l {LayoutMirroring}{Layout mirroring} is useful when you need to support both left-to-right and right-to-left layout versions of your application that target different language areas. -\section2 Anchors - -Added the following property: -\list -\o \l {Item::}{anchors.mirrored} -\endlist - \section2 Text Added the following properties: @@ -57,7 +50,6 @@ Added the following properties: \o \l {Text::}{lineCount} \o \l {Text::}{maximumLineCount} \o \l {Text::}{truncated} -\o \l {Text::}{effectiveHorizontalAlignment} \endlist horizontalAlignment now accepts Text.AlignJustify alignment mode. @@ -70,7 +62,6 @@ Added the following properties, methods and signal handlers: \o \l {TextEdit::}{lineCount} \o \l {TextEdit::}{inputMethodComposing} \o \l {TextEdit::}{mouseSelectionMode} -\o \l {TextEdit::}{effectiveHorizontalAlignment} \o \l {TextEdit::}{deselect()} \o \l {TextEdit::}{isRightToLeft()} \o \l {TextEdit::}{moveCursorSelection()} to enable selection by word @@ -84,7 +75,6 @@ Added the following properties and methods: \o \l {TextInput::}{canPaste} \o \l {TextInput::}{inputMethodComposing} \o \l {TextInput::}{mouseSelectionMode} -\o \l {TextInput::}{effectiveHorizontalAlignment} \o \l {TextInput::}{deselect()} \o \l {TextInput::}{isRightToLeft()} \o \l {TextInput::}{moveCursorSelection()} to enable selection by word @@ -125,17 +115,15 @@ Added the following property: Added the following properties and methods: \list \o \l{ListView::}{layoutDirection} -\o \l{ListView::}{effectiveLayoutDirection} \o \l{ListView::}{positionViewAtBeginning()} \o \l{ListView::}{positionViewAtEnd()} \endlist \section2 Flow, Grid and Row -Added the following properties: +Added the following property: \list \o \l{Flow::}{layoutDirection} -\o \l{Flow::}{effectiveLayoutDirection} \endlist \section2 Repeater diff --git a/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml b/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml index b4efebe..197ea39 100644 --- a/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml +++ b/examples/declarative/righttoleft/layoutdirection/layoutdirection.qml @@ -226,7 +226,17 @@ Rectangle { Component { id: viewDelegate Item { - width: (listView.effectiveLayoutDirection == Qt.LeftToRight ? (index == 48 - 1) : (index == 0)) ? 40 : 50 + function effectiveLayoutDirection() { + if (LayoutMirroring.enabled) + if (listView.layoutDirection == Qt.LeftToRight) + return Qt.RightToLeft; + else + return Qt.LeftToRight; + else + return listView.layoutDirection; + } + + width: (effectiveLayoutDirection() == Qt.LeftToRight ? (index == 48 - 1) : (index == 0)) ? 40 : 50 Rectangle { width: 40; height: 40 color: Qt.rgba(0.5+(48 - index)*Math.random()/48, diff --git a/src/declarative/graphicsitems/qdeclarativeanchors_p.h b/src/declarative/graphicsitems/qdeclarativeanchors_p.h index 388d6b9..f07ac23 100644 --- a/src/declarative/graphicsitems/qdeclarativeanchors_p.h +++ b/src/declarative/graphicsitems/qdeclarativeanchors_p.h @@ -79,7 +79,6 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeAnchors : public QObject Q_PROPERTY(qreal baselineOffset READ baselineOffset WRITE setBaselineOffset NOTIFY baselineOffsetChanged) Q_PROPERTY(QGraphicsObject *fill READ fill WRITE setFill RESET resetFill NOTIFY fillChanged) Q_PROPERTY(QGraphicsObject *centerIn READ centerIn WRITE setCenterIn RESET resetCenterIn NOTIFY centerInChanged) - Q_PROPERTY(bool mirrored READ mirrored NOTIFY mirroredChanged REVISION 1) public: QDeclarativeAnchors(QObject *parent=0); @@ -184,7 +183,6 @@ Q_SIGNALS: void verticalCenterOffsetChanged(); void horizontalCenterOffsetChanged(); void baselineOffsetChanged(); - Q_REVISION(1) void mirroredChanged(); private: friend class QDeclarativeItem; diff --git a/src/declarative/graphicsitems/qdeclarativegridview.cpp b/src/declarative/graphicsitems/qdeclarativegridview.cpp index 460f2c3..184569e 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview.cpp +++ b/src/declarative/graphicsitems/qdeclarativegridview.cpp @@ -206,7 +206,6 @@ public: void mirrorChange() { Q_Q(QDeclarativeGridView); regenerate(); - emit q->effectiveLayoutDirectionChanged(); } qreal position() const { @@ -1802,9 +1801,12 @@ void QDeclarativeGridView::setHighlightRangeMode(HighlightRangeMode mode) on the \l GridView:flow property. \endlist - \bold Note: If GridView::flow is set to GridView.LeftToRight, this is not to be confused if - GridView::layoutDirection is set to Qt.RightToLeft. The GridView.LeftToRight flow value simply - indicates that the flow is horizontal. + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the layout direction of the grid view will be mirrored. However, the actual property + \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeGridView::layoutDirection() const @@ -1820,21 +1822,9 @@ void QDeclarativeGridView::setLayoutDirection(Qt::LayoutDirection layoutDirectio d->layoutDirection = layoutDirection; d->regenerate(); emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); } } -/*! - \qmlproperty enumeration GridView::effectiveLayoutDirection - This property holds the effective layout direction of the grid. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the grid will be mirrored. However, the - property \l {GridView::layoutDirection}{layoutDirection} will remain unchanged. - - \sa GridView::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeGridView::effectiveLayoutDirection() const { Q_D(const QDeclarativeGridView); diff --git a/src/declarative/graphicsitems/qdeclarativegridview_p.h b/src/declarative/graphicsitems/qdeclarativegridview_p.h index 4d99a14..628e98e 100644 --- a/src/declarative/graphicsitems/qdeclarativegridview_p.h +++ b/src/declarative/graphicsitems/qdeclarativegridview_p.h @@ -75,7 +75,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeGridView : public QDeclarativeFlickable Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(int cellWidth READ cellWidth WRITE setCellWidth NOTIFY cellWidthChanged) @@ -194,7 +193,6 @@ Q_SIGNALS: void delegateChanged(); void flowChanged(); Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); void keyNavigationWrapsChanged(); void cacheBufferChanged(); void snapModeChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativeitem.cpp b/src/declarative/graphicsitems/qdeclarativeitem.cpp index 6602dda..93d3222 100644 --- a/src/declarative/graphicsitems/qdeclarativeitem.cpp +++ b/src/declarative/graphicsitems/qdeclarativeitem.cpp @@ -898,7 +898,6 @@ void QDeclarativeItemPrivate::setLayoutMirror(bool mirror) _anchors->d_func()->fillChanged(); _anchors->d_func()->centerInChanged(); _anchors->d_func()->updateHorizontalAnchors(); - emit _anchors->mirroredChanged(); } mirrorChange(); if (attachedLayoutDirection) { diff --git a/src/declarative/graphicsitems/qdeclarativelistview.cpp b/src/declarative/graphicsitems/qdeclarativelistview.cpp index 79d67e7..734c732 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview.cpp +++ b/src/declarative/graphicsitems/qdeclarativelistview.cpp @@ -298,7 +298,6 @@ public: void mirrorChange() { Q_Q(QDeclarativeListView); regenerate(); - emit q->effectiveLayoutDirectionChanged(); } bool isRightToLeft() const { @@ -2169,7 +2168,12 @@ void QDeclarativeListView::setOrientation(QDeclarativeListView::Orientation orie \o Qt.RightToLeft - Items will be laid out from right to let. \endlist - \sa ListView::effectiveLayoutDirection + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the layout direction of the horizontal list will be mirrored. However, the actual property + \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeListView::layoutDirection() const @@ -2185,21 +2189,9 @@ void QDeclarativeListView::setLayoutDirection(Qt::LayoutDirection layoutDirectio d->layoutDirection = layoutDirection; d->regenerate(); emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); } } -/*! - \qmlproperty enumeration ListView::effectiveLayoutDirection - This property holds the effective layout direction of the horizontal list. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the horizontal list will be mirrored. However, the - property \l {ListView::layoutDirection}{layoutDirection} will remain unchanged. - - \sa ListView::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeListView::effectiveLayoutDirection() const { Q_D(const QDeclarativeListView); diff --git a/src/declarative/graphicsitems/qdeclarativelistview_p.h b/src/declarative/graphicsitems/qdeclarativelistview_p.h index 3b12225..70ca9de 100644 --- a/src/declarative/graphicsitems/qdeclarativelistview_p.h +++ b/src/declarative/graphicsitems/qdeclarativelistview_p.h @@ -114,7 +114,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeListView : public QDeclarativeFlickable Q_PROPERTY(qreal spacing READ spacing WRITE setSpacing NOTIFY spacingChanged) Q_PROPERTY(Orientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) Q_PROPERTY(bool keyNavigationWraps READ isWrapEnabled WRITE setWrapEnabled NOTIFY keyNavigationWrapsChanged) Q_PROPERTY(int cacheBuffer READ cacheBuffer WRITE setCacheBuffer NOTIFY cacheBufferChanged) Q_PROPERTY(QDeclarativeViewSection *section READ sectionCriteria CONSTANT) @@ -229,7 +228,6 @@ Q_SIGNALS: void spacingChanged(); void orientationChanged(); Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); void currentIndexChanged(); void currentSectionChanged(); void highlightMoveSpeedChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativepositioners.cpp b/src/declarative/graphicsitems/qdeclarativepositioners.cpp index e76fc03..55ec961 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners.cpp +++ b/src/declarative/graphicsitems/qdeclarativepositioners.cpp @@ -597,7 +597,12 @@ QDeclarativeRow::QDeclarativeRow(QDeclarativeItem *parent) the right anchor remains to the right of the row. \endlist - \sa Grid::layoutDirection, Flow::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example} + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the visual layout direction of the row positioner will be mirrored. However, the + property \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa Grid::layoutDirection, Flow::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}, {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeRow::layoutDirection() const { @@ -616,21 +621,9 @@ void QDeclarativeRow::setLayoutDirection(Qt::LayoutDirection layoutDirection) d->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry); prePositioning(); emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); } } -/*! - \qmlproperty enumeration Row::effectiveLayoutDirection - This property holds the effective layout direction of the row positioner. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the row positioner will be mirrored. However, the - property \l {Row::layoutDirection}{layoutDirection} will remain unchanged. - - \sa Row::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeRow::effectiveLayoutDirection() const { return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this); @@ -900,7 +893,12 @@ void QDeclarativeGrid::setFlow(Flow flow) \l Grid::flow property. \endlist - \sa Flow::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example} + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the visual layout direction of the grid positioner will be mirrored. However, the + property \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa Flow::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}, {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeGrid::layoutDirection() const { @@ -918,22 +916,10 @@ void QDeclarativeGrid::setLayoutDirection(Qt::LayoutDirection layoutDirection) else d->removeItemChangeListener(d, QDeclarativeItemPrivate::Geometry); prePositioning(); - emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); + emit layoutDirectionChanged();; } } -/*! - \qmlproperty enumeration Grid::effectiveLayoutDirection - This property holds the effective layout direction of the grid positioner. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the grid positioner will be mirrored. However, the - property \l {Grid::layoutDirection}{layoutDirection} will remain unchanged. - - \sa Grid::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeGrid::effectiveLayoutDirection() const { return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this); @@ -1265,7 +1251,12 @@ void QDeclarativeFlow::setFlow(Flow flow) \l Flow::flow property. \endlist - \sa Grid::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example} + When using the attached property \l {LayoutMirroring::enabled} for locale layouts, + the visual layout direction of the flow positioner will be mirrored. However, the + property \c layoutDirection will remain unchanged. You can use the property + \l {LayoutMirroring::enabled} to determine whether the direction has been mirrored. + + \sa Grid::layoutDirection, Row::layoutDirection, {declarative/righttoleft/layoutdirection}{Layout directions example}, {LayoutMirroring}{LayoutMirroring} */ Qt::LayoutDirection QDeclarativeFlow::layoutDirection() const @@ -1281,21 +1272,9 @@ void QDeclarativeFlow::setLayoutDirection(Qt::LayoutDirection layoutDirection) d->layoutDirection = layoutDirection; prePositioning(); emit layoutDirectionChanged(); - emit effectiveLayoutDirectionChanged(); } } -/*! - \qmlproperty enumeration Flow::effectiveLayoutDirection - This property holds the effective layout direction of the flow positioner. - - When using the attached property \l {LayoutMirroring::enabled}{LayoutMirroring::enabled} for locale layouts, - the visual layout direction of the grid positioner will be mirrored. However, the - property \l {Flow::layoutDirection}{layoutDirection} will remain unchanged. - - \sa Flow::layoutDirection, {LayoutMirroring}{LayoutMirroring} -*/ - Qt::LayoutDirection QDeclarativeFlow::effectiveLayoutDirection() const { return QDeclarativeBasePositionerPrivate::getEffectiveLayoutDirection(this); diff --git a/src/declarative/graphicsitems/qdeclarativepositioners_p.h b/src/declarative/graphicsitems/qdeclarativepositioners_p.h index 214c04f..5c6c3c8 100644 --- a/src/declarative/graphicsitems/qdeclarativepositioners_p.h +++ b/src/declarative/graphicsitems/qdeclarativepositioners_p.h @@ -130,7 +130,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeRow: public QDeclarativeBasePositioner { Q_OBJECT Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) public: QDeclarativeRow(QDeclarativeItem *parent=0); @@ -140,7 +139,6 @@ public: Q_SIGNALS: Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); @@ -156,7 +154,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeGrid : public QDeclarativeBasePositioner Q_PROPERTY(int columns READ columns WRITE setColumns NOTIFY columnsChanged) Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) public: QDeclarativeGrid(QDeclarativeItem *parent=0); @@ -180,7 +177,6 @@ Q_SIGNALS: void columnsChanged(); void flowChanged(); Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); @@ -199,7 +195,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeFlow: public QDeclarativeBasePositioner Q_OBJECT Q_PROPERTY(Flow flow READ flow WRITE setFlow NOTIFY flowChanged) Q_PROPERTY(Qt::LayoutDirection layoutDirection READ layoutDirection WRITE setLayoutDirection NOTIFY layoutDirectionChanged REVISION 1) - Q_PROPERTY(Qt::LayoutDirection effectiveLayoutDirection READ effectiveLayoutDirection NOTIFY effectiveLayoutDirectionChanged REVISION 1) public: QDeclarativeFlow(QDeclarativeItem *parent=0); @@ -214,7 +209,6 @@ public: Q_SIGNALS: void flowChanged(); Q_REVISION(1) void layoutDirectionChanged(); - Q_REVISION(1) void effectiveLayoutDirectionChanged(); protected: virtual void doPositioning(QSizeF *contentSize); diff --git a/src/declarative/graphicsitems/qdeclarativetext.cpp b/src/declarative/graphicsitems/qdeclarativetext.cpp index 1d51840..c2947be 100644 --- a/src/declarative/graphicsitems/qdeclarativetext.cpp +++ b/src/declarative/graphicsitems/qdeclarativetext.cpp @@ -1063,7 +1063,6 @@ void QDeclarativeText::setStyleColor(const QColor &color) /*! \qmlproperty enumeration Text::horizontalAlignment \qmlproperty enumeration Text::verticalAlignment - \qmlproperty enumeration Text::effectiveHorizontalAlignment Sets the horizontal and vertical alignment of the text within the Text items width and height. By default, the text is vertically aligned to the top. Horizontal @@ -1079,10 +1078,10 @@ void QDeclarativeText::setStyleColor(const QColor &color) need to either modify the Item::anchors, or set horizontalAlignment to Text.AlignHCenter and bind the width to that of the parent. - When using the attached property LayoutMirroring::enabled to mirror application + When using the attached property \l {LayoutMirroring::enabled} to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment - of Text, use the read-only property \c effectiveHorizontalAlignment. + of Text, use the property \l {LayoutMirroring::enabled}. */ QDeclarativeText::HAlignment QDeclarativeText::hAlign() const { @@ -1132,10 +1131,7 @@ bool QDeclarativeTextPrivate::setHAlign(QDeclarativeText::HAlignment alignment, if (hAlign != alignment || forceAlign) { QDeclarativeText::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); hAlign = alignment; - emit q->horizontalAlignmentChanged(hAlign); - if (oldEffectiveHAlign != q->effectiveHAlign()) - emit q->effectiveHorizontalAlignmentChanged(); return true; } return false; @@ -1157,7 +1153,6 @@ void QDeclarativeTextPrivate::mirrorChange() if (q->isComponentComplete()) { if (!hAlignImplicit && (hAlign == QDeclarativeText::AlignRight || hAlign == QDeclarativeText::AlignLeft)) { updateLayout(); - emit q->effectiveHorizontalAlignmentChanged(); } } } diff --git a/src/declarative/graphicsitems/qdeclarativetext_p.h b/src/declarative/graphicsitems/qdeclarativetext_p.h index a1153c2..d1f5906 100644 --- a/src/declarative/graphicsitems/qdeclarativetext_p.h +++ b/src/declarative/graphicsitems/qdeclarativetext_p.h @@ -70,7 +70,6 @@ class Q_DECLARATIVE_PRIVATE_EXPORT QDeclarativeText : public QDeclarativeImplici Q_PROPERTY(TextStyle style READ style WRITE setStyle NOTIFY styleChanged) Q_PROPERTY(QColor styleColor READ styleColor WRITE setStyleColor NOTIFY styleColorChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) - Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) @@ -191,7 +190,6 @@ Q_SIGNALS: void paintedSizeChanged(); Q_REVISION(1) void lineHeightChanged(qreal lineHeight); Q_REVISION(1) void lineHeightModeChanged(LineHeightMode mode); - Q_REVISION(1) void effectiveHorizontalAlignmentChanged(); protected: void mousePressEvent(QGraphicsSceneMouseEvent *event); diff --git a/src/declarative/graphicsitems/qdeclarativetextedit.cpp b/src/declarative/graphicsitems/qdeclarativetextedit.cpp index af2c8f3..93fa8a5 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextedit.cpp @@ -459,7 +459,6 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color) /*! \qmlproperty enumeration TextEdit::horizontalAlignment \qmlproperty enumeration TextEdit::verticalAlignment - \qmlproperty enumeration TextEdit::effectiveHorizontalAlignment Sets the horizontal and vertical alignment of the text within the TextEdit item's width and height. By default, the text alignment follows the natural alignment @@ -481,10 +480,10 @@ void QDeclarativeTextEdit::setSelectedTextColor(const QColor &color) \o TextEdit.AlignVCenter \endlist - When using the attached property LayoutMirroring::enabled to mirror application + When using the attached property \l {LayoutMirroring::enabled} to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment - of TextEdit, use the read-only property \c effectiveHorizontalAlignment. + of TextEdit, use the property \l {LayoutMirroring::enabled}. */ QDeclarativeTextEdit::HAlignment QDeclarativeTextEdit::hAlign() const { @@ -539,8 +538,6 @@ bool QDeclarativeTextEditPrivate::setHAlign(QDeclarativeTextEdit::HAlignment ali QDeclarativeTextEdit::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); hAlign = alignment; emit q->horizontalAlignmentChanged(alignment); - if (oldEffectiveHAlign != q->effectiveHAlign()) - emit q->effectiveHorizontalAlignmentChanged(); return true; } return false; @@ -563,7 +560,6 @@ void QDeclarativeTextEditPrivate::mirrorChange() if (!hAlignImplicit && (hAlign == QDeclarativeTextEdit::AlignRight || hAlign == QDeclarativeTextEdit::AlignLeft)) { updateDefaultTextOption(); q->updateSize(); - emit q->effectiveHorizontalAlignmentChanged(); } } } diff --git a/src/declarative/graphicsitems/qdeclarativetextedit_p.h b/src/declarative/graphicsitems/qdeclarativetextedit_p.h index 25ca1e7..7a17bd8 100644 --- a/src/declarative/graphicsitems/qdeclarativetextedit_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextedit_p.h @@ -73,7 +73,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextEdit : public QDeclarativeImplicitSizePa Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) - Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(VAlignment verticalAlignment READ vAlign WRITE setVAlign NOTIFY verticalAlignmentChanged) Q_PROPERTY(WrapMode wrapMode READ wrapMode WRITE setWrapMode NOTIFY wrapModeChanged) Q_PROPERTY(int lineCount READ lineCount NOTIFY lineCountChanged REVISION 1) @@ -249,7 +248,6 @@ Q_SIGNALS: Q_REVISION(1) void linkActivated(const QString &link); Q_REVISION(1) void canPasteChanged(); Q_REVISION(1) void inputMethodComposingChanged(); - Q_REVISION(1) void effectiveHorizontalAlignmentChanged(); public Q_SLOTS: void selectAll(); diff --git a/src/declarative/graphicsitems/qdeclarativetextinput.cpp b/src/declarative/graphicsitems/qdeclarativetextinput.cpp index 226cce9..0d10bb6 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput.cpp +++ b/src/declarative/graphicsitems/qdeclarativetextinput.cpp @@ -326,7 +326,6 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color) /*! \qmlproperty enumeration TextInput::horizontalAlignment - \qmlproperty enumeration TextInput::effectiveHorizontalAlignment Sets the horizontal alignment of the text within the TextInput item's width and height. By default, the text alignment follows the natural alignment @@ -342,10 +341,10 @@ void QDeclarativeTextInput::setSelectedTextColor(const QColor &color) The valid values for \c horizontalAlignment are \c TextInput.AlignLeft, \c TextInput.AlignRight and \c TextInput.AlignHCenter. - When using the attached property LayoutMirroring::enabled to mirror application + When using the attached property \l {LayoutMirroring::enabled} to mirror application layouts, the horizontal alignment of text will also be mirrored. However, the property \c horizontalAlignment will remain unchanged. To query the effective horizontal alignment - of TextInput, use the read-only property \c effectiveHorizontalAlignment. + of TextInput, use the property \l {LayoutMirroring::enabled}. */ QDeclarativeTextInput::HAlignment QDeclarativeTextInput::hAlign() const { @@ -398,8 +397,6 @@ bool QDeclarativeTextInputPrivate::setHAlign(QDeclarativeTextInput::HAlignment a QDeclarativeTextInput::HAlignment oldEffectiveHAlign = q->effectiveHAlign(); hAlign = alignment; emit q->horizontalAlignmentChanged(alignment); - if (oldEffectiveHAlign != q->effectiveHAlign()) - emit q->effectiveHorizontalAlignmentChanged(); return true; } return false; @@ -422,7 +419,7 @@ void QDeclarativeTextInputPrivate::mirrorChange() if (q->isComponentComplete()) { if (!hAlignImplicit && (hAlign == QDeclarativeTextInput::AlignRight || hAlign == QDeclarativeTextInput::AlignLeft)) { q->updateCursorRectangle(); - emit q->effectiveHorizontalAlignmentChanged(); + updateHorizontalScroll(); } } } diff --git a/src/declarative/graphicsitems/qdeclarativetextinput_p.h b/src/declarative/graphicsitems/qdeclarativetextinput_p.h index 171db92..04c6ff4 100644 --- a/src/declarative/graphicsitems/qdeclarativetextinput_p.h +++ b/src/declarative/graphicsitems/qdeclarativetextinput_p.h @@ -71,7 +71,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeTextInput : public QDeclarativeImplicitSizeP Q_PROPERTY(QColor selectedTextColor READ selectedTextColor WRITE setSelectedTextColor NOTIFY selectedTextColorChanged) Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY fontChanged) Q_PROPERTY(HAlignment horizontalAlignment READ hAlign WRITE setHAlign RESET resetHAlign NOTIFY horizontalAlignmentChanged) - Q_PROPERTY(HAlignment effectiveHorizontalAlignment READ effectiveHAlign NOTIFY effectiveHorizontalAlignmentChanged REVISION 1) Q_PROPERTY(bool readOnly READ isReadOnly WRITE setReadOnly NOTIFY readOnlyChanged) Q_PROPERTY(bool cursorVisible READ isCursorVisible WRITE setCursorVisible NOTIFY cursorVisibleChanged) Q_PROPERTY(int cursorPosition READ cursorPosition WRITE setCursorPosition NOTIFY cursorPositionChanged) @@ -247,7 +246,6 @@ Q_SIGNALS: Q_REVISION(1) void mouseSelectionModeChanged(SelectionMode mode); Q_REVISION(1) void canPasteChanged(); Q_REVISION(1) void inputMethodComposingChanged(); - Q_REVISION(1) void effectiveHorizontalAlignmentChanged(); protected: virtual void geometryChanged(const QRectF &newGeometry, diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp index 0442350..3d8d2d9 100644 --- a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -58,7 +58,6 @@ Q_DECLARE_METATYPE(QDeclarativeAnchors::Anchor) Q_DECLARE_METATYPE(QDeclarativeAnchorLine::AnchorLine) - class tst_qdeclarativeanchors : public QObject { Q_OBJECT @@ -291,7 +290,7 @@ void tst_qdeclarativeanchors::basicAnchorsRTL() QDeclarativeItem* rootItem = qobject_cast(view->rootObject()); foreach(QObject *child, rootItem->children()) { - bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->property("mirrored").toBool(); + bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->mirrored(); QCOMPARE(mirrored, false); } @@ -299,7 +298,7 @@ void tst_qdeclarativeanchors::basicAnchorsRTL() mirrorAnchors(qobject_cast(child)); foreach(QObject *child, rootItem->children()) { - bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->property("mirrored").toBool(); + bool mirrored = QDeclarativeItemPrivate::get(qobject_cast(child))->anchors()->mirrored(); QCOMPARE(mirrored, true); } -- cgit v0.12 From 575e832fd053df98e60aefebbc5843a4864f2523 Mon Sep 17 00:00:00 2001 From: John Tapsell Date: Fri, 27 May 2011 07:31:55 +0100 Subject: Fixed move a QGraphicsWidget and invalidate its layout at the same time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QGraphicsWidget::setGeometry() could sometimes call QGraphicsLayoutItem::setGeometry() with an uninitialized rectangle. This happened in the specific case where the widget had a layout that was not active, and where setPos was called on the widget. This would in turn cause it to enter setGeometry() where it would act as expected. However, due to the fact that we sent a LayoutRequest event at the end of that function, it could result in that QGraphicsLayout::activate() would call setGeometry again. Now, we would actually enter setGeometry, where wd->inSetPos == 1. Then, we would not enter the "if (!wd->inSetPos)" block nor the "if (moved)" block. It would then end up calling QGraphicsLayoutItem::setGeometry(newGeom), where newGeom was uninitialized. Bug happens only when QGraphicsLayout::setInstantInvalidatePropagation(true) was used, because that was the condition for sending the layout request from setGeometry() Tracked down and written by Stanislav Ionascu. Reviewed-by: Jan-Arve Sther --- src/gui/graphicsview/qgraphicswidget.cpp | 3 +- tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp | 73 ++++++++++++++++++++++ 2 files changed, 74 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 804394a..7048fcc 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -347,11 +347,10 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) { QGraphicsWidgetPrivate *wd = QGraphicsWidget::d_func(); QGraphicsLayoutItemPrivate *d = QGraphicsLayoutItem::d_ptr.data(); - QRectF newGeom; + QRectF newGeom = rect; QPointF oldPos = d->geom.topLeft(); if (!wd->inSetPos) { setAttribute(Qt::WA_Resized); - newGeom = rect; newGeom.setSize(rect.size().expandedTo(effectiveSizeHint(Qt::MinimumSize)) .boundedTo(effectiveSizeHint(Qt::MaximumSize))); diff --git a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp index d5d56fc..9411f97 100644 --- a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp +++ b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp @@ -63,6 +63,8 @@ private slots: void automaticReparenting(); void verifyActivate(); void invalidate(); + void invalidateAndMove_data(); + void invalidateAndMove(); void constructors(); void alternativeLayoutItems(); void ownership(); @@ -556,6 +558,77 @@ void tst_QGraphicsLayout::invalidate() QGraphicsLayout::setInstantInvalidatePropagation(false); } +void tst_QGraphicsLayout::invalidateAndMove_data() +{ + QTest::addColumn("instantInvalidatePropagation"); + QTest::newRow("Without instantInvalidatePropagation") << false; + QTest::newRow("With instantInvalidatePropagation") << true; + +} +void tst_QGraphicsLayout::invalidateAndMove() +{ + // Check that if we set the position of an item and invalidate its layout at the same + // time, the widget keeps its correct size + QFETCH(bool, instantInvalidatePropagation); + QGraphicsLayout::setInstantInvalidatePropagation(instantInvalidatePropagation); + QGraphicsScene scene; + + QGraphicsWidget *widget = new QGraphicsWidget; + new QGraphicsLinearLayout(widget); + + widget->setMinimumSize(1,1); + widget->setPreferredSize(34,34); + widget->setMaximumSize(100,100); + widget->resize(widget->preferredSize()); + + scene.addItem(widget); + + qApp->processEvents(); + + /* Invalidate and reactivate. The size should not have changed */ + widget->layout()->invalidate(); + widget->layout()->activate(); + + QCOMPARE(widget->geometry().size(), widget->preferredSize()); + QCOMPARE(widget->layout()->geometry().size(), widget->preferredSize()); + qApp->processEvents(); + QCOMPARE(widget->geometry().size(), widget->preferredSize()); + QCOMPARE(widget->layout()->geometry().size(), widget->preferredSize()); + + widget->layout()->invalidate(); + widget->setX(1); //Change just the position using setX + QCOMPARE(widget->geometry().size(), widget->preferredSize()); + QCOMPARE(widget->layout()->geometry().size(), widget->preferredSize()); + qApp->processEvents(); + QCOMPARE(widget->geometry().size(), widget->preferredSize()); + QCOMPARE(widget->layout()->geometry().size(), widget->preferredSize()); + + widget->layout()->invalidate(); + widget->setGeometry(1,1,34,34); //Change just the position using setGeometry + QCOMPARE(widget->geometry().size(), widget->preferredSize()); + QCOMPARE(widget->layout()->geometry().size(), widget->preferredSize()); + qApp->processEvents(); + QCOMPARE(widget->geometry().size(), widget->preferredSize()); + QCOMPARE(widget->layout()->geometry().size(), widget->preferredSize()); + + widget->layout()->invalidate(); + widget->setGeometry(1,1,60,60); //Change just the size using setGeometry + QCOMPARE(widget->geometry().size(), QSizeF(60,60)); + QCOMPARE(widget->layout()->geometry().size(), QSizeF(60,60)); + qApp->processEvents(); + QCOMPARE(widget->geometry().size(), QSizeF(60,60)); + QCOMPARE(widget->layout()->geometry().size(), QSizeF(60,60)); + + widget->layout()->invalidate(); + widget->setGeometry(0,0,34,34); //Change the size and position using setGeometry + QCOMPARE(widget->geometry().size(), widget->preferredSize()); + QCOMPARE(widget->layout()->geometry().size(), widget->preferredSize()); + qApp->processEvents(); + QCOMPARE(widget->geometry().size(), widget->preferredSize()); + QCOMPARE(widget->layout()->geometry().size(), widget->preferredSize()); + + QGraphicsLayout::setInstantInvalidatePropagation(false); +} class Layout : public QGraphicsLayout { public: -- cgit v0.12 From f370dd07560c449ba17d13475721f7d3b46e6b24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 30 May 2011 09:38:47 +0200 Subject: Fixed clipping errors for non-extended paint engines. Partially revert change a33ef62469fd71bec for the non-extended paint engine path. Task-number: QTBUG-19525 Reviewed-by: Andy Shaw --- src/gui/painting/qpainter.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index dfb9a04..a4ab00a 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2788,6 +2788,9 @@ void QPainter::setClipRect(const QRect &rect, Qt::ClipOperation op) return; } + if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + op = Qt::ReplaceClip; + d->state->clipRegion = rect; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) @@ -2843,6 +2846,9 @@ void QPainter::setClipRegion(const QRegion &r, Qt::ClipOperation op) return; } + if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + op = Qt::ReplaceClip; + d->state->clipRegion = r; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) @@ -3248,6 +3254,9 @@ void QPainter::setClipPath(const QPainterPath &path, Qt::ClipOperation op) return; } + if (d->state->clipOperation == Qt::NoClip && op == Qt::IntersectClip) + op = Qt::ReplaceClip; + d->state->clipPath = path; d->state->clipOperation = op; if (op == Qt::NoClip || op == Qt::ReplaceClip) -- cgit v0.12 From 48ff7e5af99923396243940979d15d4ec2e2730c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Mon, 30 May 2011 11:39:18 +0200 Subject: Missing glyphs transforming QStaticText on X11/raster with subpixel AA Static text took an untested and broken code path for the combo of subpixel AA, X11, raster engine and transformation. This would cause missing glyphs. The reason was that QStaticText took an unused code path which turned out not to work. The workaround is to use gray AA on transformed text, like we already do for the GL engine. In Qt 4.8, the static text code path has been rewritten to use the Freetype cache instead of the image glyph cache, so the bug will be fixed more properly there. Reviewed-by: Samuel --- src/gui/painting/qpaintengine_raster.cpp | 10 +++++++++- src/gui/painting/qtextureglyphcache.cpp | 8 ++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 01b22da..cd9206c 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3105,7 +3105,15 @@ void QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, Q_D(QRasterPaintEngine); QRasterPaintEngineState *s = state(); - QFontEngineGlyphCache::Type glyphType = fontEngine->glyphFormat >= 0 ? QFontEngineGlyphCache::Type(fontEngine->glyphFormat) : d->glyphCacheType; + QFontEngineGlyphCache::Type glyphType; + if (fontEngine->glyphFormat >= 0) { + glyphType = QFontEngineGlyphCache::Type(fontEngine->glyphFormat); + } else if (s->matrix.type() > QTransform::TxTranslate + && d->glyphCacheType == QFontEngineGlyphCache::Raster_RGBMask) { + glyphType = QFontEngineGlyphCache::Raster_A8; + } else { + glyphType = d->glyphCacheType; + } QImageTextureGlyphCache *cache = static_cast(fontEngine->glyphCache(0, glyphType, s->matrix)); diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 16df6c1..2c1da24 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -178,14 +178,10 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g) const { #if defined(Q_WS_X11) - if (m_transform.type() > QTransform::TxTranslate && m_current_fontengine->type() == QFontEngine::Freetype) { + if (m_type != Raster_RGBMask && m_transform.type() > QTransform::TxTranslate && m_current_fontengine->type() == QFontEngine::Freetype) { QFontEngineFT::GlyphFormat format = QFontEngineFT::Format_None; QImage::Format imageFormat = QImage::Format_Invalid; switch (m_type) { - case Raster_RGBMask: - format = QFontEngineFT::Format_A32; - imageFormat = QImage::Format_RGB32; - break; case Raster_A8: format = QFontEngineFT::Format_A8; imageFormat = QImage::Format_Indexed8; @@ -266,7 +262,7 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g) } #endif - if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { + if (m_type == QFontEngineGlyphCache::Raster_RGBMask) { QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()), qMax(mask.width(), c.w), qMax(mask.height(), c.h), m_image.bytesPerLine(), m_image.format()); -- cgit v0.12 From e159f97f6ecefb49d50a82b1084fd1b1b9e5e2cf Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt Date: Tue, 31 May 2011 11:29:46 +0200 Subject: Fix glyph metrics with QStaticText/Freetype/raster and light/no hinting This is a back-port of part of cad70d64d0bbada. In the raster engine's drawCachedGlyphs(), which is used by QStaticText, we would use the wrong metrics to lay out the glyphs, because loadGlyphMetrics() would assume full hinting. A visible effect of this was that the baseline of rotated text became wavy. Task-number: QTBUG-18185 Reviewed-by: Jiang Jiang --- src/gui/text/qfontengine_ft.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index c4e89d5..1056aed 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -762,9 +762,18 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph return g; int load_flags = FT_LOAD_DEFAULT | default_load_flags; + int load_target = default_hint_style == HintLight + ? FT_LOAD_TARGET_LIGHT + : FT_LOAD_TARGET_NORMAL; + if (set->outline_drawing) load_flags = FT_LOAD_NO_BITMAP; + if (default_hint_style == HintNone) + load_flags |= FT_LOAD_NO_HINTING; + else + load_flags |= load_target; + // apply our matrix to this, but note that the metrics will not be affected by this. FT_Face face = lockFace(); FT_Matrix matrix = this->matrix; -- cgit v0.12 From 348894a550510e54e7709d18676b4b10c9e5e9e3 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Tue, 31 May 2011 12:15:55 +0200 Subject: Avoid buffer overrun in QMacPixmapData resizing Shouldn't use size bigger than the original (source) pixels buffer or the new one (just allocated). Task-number: QTBUG-18547 Reviewed-by: aavit --- src/gui/image/qpixmap_mac.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/image/qpixmap_mac.cpp b/src/gui/image/qpixmap_mac.cpp index aac159e..6872cfa 100644 --- a/src/gui/image/qpixmap_mac.cpp +++ b/src/gui/image/qpixmap_mac.cpp @@ -637,7 +637,7 @@ void QMacPixmapData::macCreatePixels() } if (pixels) - memcpy(base_pixels, pixels, pixelsSize); + memcpy(base_pixels, pixels, qMin(pixelsSize, (uint) numBytes)); pixels = base_pixels; pixelsSize = numBytes; } -- cgit v0.12 From f8d71ee8c5f29eabb759ff4b0d5c8a153023a254 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Tue, 31 May 2011 17:57:14 +0200 Subject: QDeclarative: Fix QPerformanceTimer on Symbian QPerformanceTimer::elapsed() always returned 0 on Symbian. This is because Q_OS_UNIX define is also set for Symbian. Fixed by moving Q_OS_SYMBIAN before Q_OS_SYMBIAN, and fixing the logic. Reviewed-by: Alessandro Portale Task-number: QTBUG-19669 --- src/declarative/declarative.pro | 2 +- src/declarative/qml/qperformancetimer.cpp | 55 ++++++++++++++++--------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index f3a7db9..27ceaf0 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -26,7 +26,7 @@ include(debugger/debugger.pri) symbian: { TARGET.UID3=0x2001E623 - LIBS += -lefsrv + LIBS += -lefsrv -lhal } linux-g++-maemo:DEFINES += QDECLARATIVEVIEW_NOBACKGROUND diff --git a/src/declarative/qml/qperformancetimer.cpp b/src/declarative/qml/qperformancetimer.cpp index 1d7ca80..bdd5da1 100644 --- a/src/declarative/qml/qperformancetimer.cpp +++ b/src/declarative/qml/qperformancetimer.cpp @@ -45,14 +45,15 @@ #include #include #include -#elif defined(Q_OS_UNIX) -#include -#include -#include #elif defined(Q_OS_SYMBIAN) #include #include #include +#include +#elif defined(Q_OS_UNIX) +#include +#include +#include #elif defined(Q_OS_WIN) #include #endif @@ -84,6 +85,29 @@ qint64 QPerformanceTimer::elapsed() const return absoluteToNSecs(cpu_time - t1); } +////////////////////////////// Symbian ////////////////////////////// +#elif defined(Q_OS_SYMBIAN) + +static qint64 getTimeFromTick(quint64 elapsed) +{ + static TInt freq = 0; + if (!freq) + HAL::Get(HALData::EFastCounterFrequency, freq); + + return (elapsed * 1000000000) / freq; +} + +void QPerformanceTimer::start() +{ + t1 = User::FastCounter(); +} + +qint64 QPerformanceTimer::elapsed() const +{ + return getTimeFromTick(User::FastCounter() - t1); +} + + ////////////////////////////// Unix ////////////////////////////// #elif defined(Q_OS_UNIX) @@ -158,29 +182,6 @@ qint64 QPerformanceTimer::elapsed() const return sec * Q_INT64_C(1000000000) + frac; } -////////////////////////////// Symbian ////////////////////////////// -#elif defined(Q_OS_SYMBIAN) - -static qint64 getTimeFromTick(quint64 elapsed) -{ - static TInt freq; - if (!freq) - HAL::Get(HALData::EFastCounterFrequency, freq); - - // ### not sure on units - return elapsed / freq; -} - -void QPerformanceTimer::start() -{ - t1 = User::FastCounter(); -} - -qint64 QPerformanceTimer::elapsed() const -{ - return getTimeFromTick(User::FastCounter() - t1); -} - ////////////////////////////// Windows ////////////////////////////// #elif defined(Q_OS_WIN) -- cgit v0.12 From 5b1a0a5564a69331d581bcf4f94da0e11d14a31f Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Thu, 2 Jun 2011 11:07:21 +1000 Subject: Add private method for flushing the pixmap cache. Change-Id: I7330383b89a3a313dd845274d17d38c714db20ce Reviewed-by: Martin Jones --- src/declarative/util/qdeclarativepixmapcache.cpp | 14 ++++++++++++++ src/declarative/util/qdeclarativepixmapcache_p.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/src/declarative/util/qdeclarativepixmapcache.cpp b/src/declarative/util/qdeclarativepixmapcache.cpp index a29854f..831aa75 100644 --- a/src/declarative/util/qdeclarativepixmapcache.cpp +++ b/src/declarative/util/qdeclarativepixmapcache.cpp @@ -584,6 +584,7 @@ public: void unreferencePixmap(QDeclarativePixmapData *); void referencePixmap(QDeclarativePixmapData *); + void flushCache(); protected: virtual void timerEvent(QTimerEvent *); @@ -682,6 +683,14 @@ void QDeclarativePixmapStore::timerEvent(QTimerEvent *) } } +/* + Remove all unreferenced pixmaps from the cache. +*/ +void QDeclarativePixmapStore::flushCache() +{ + shrinkCache(m_unreferencedCost); +} + QDeclarativePixmapReply::QDeclarativePixmapReply(QDeclarativePixmapData *d) : data(d), reader(0), requestSize(d->requestSize), loading(false), redirectCount(0) { @@ -1075,6 +1084,11 @@ bool QDeclarativePixmap::connectDownloadProgress(QObject *object, int method) return QMetaObject::connect(d->reply, QDeclarativePixmapReply::downloadProgressIndex, object, method); } +void QDeclarativePixmap::flushCache() +{ + pixmapStore()->flushCache(); +} + QT_END_NAMESPACE #include diff --git a/src/declarative/util/qdeclarativepixmapcache_p.h b/src/declarative/util/qdeclarativepixmapcache_p.h index 1cf76dd..48c9f8b 100644 --- a/src/declarative/util/qdeclarativepixmapcache_p.h +++ b/src/declarative/util/qdeclarativepixmapcache_p.h @@ -103,6 +103,8 @@ public: bool connectDownloadProgress(QObject *, const char *); bool connectDownloadProgress(QObject *, int); + static void flushCache(); + private: Q_DISABLE_COPY(QDeclarativePixmap) QDeclarativePixmapData *d; -- cgit v0.12 From de48af046a093834b8178238a2afb2efc8636efd Mon Sep 17 00:00:00 2001 From: Alan Alpert Date: Fri, 3 Jun 2011 11:19:44 +1000 Subject: Revert some of "Make QMLViewer startup animation stop after a while" This reverts most of commit c6e6a35aeb8794d68a3ca0c4e27a3a1181c066b5. Only the startup.qml changes were meant to go in. The other stuff is an experimental feature that was not supposed to be merged in. Reviewed-by: Michael Brasser --- src/declarative/graphicsitems/qdeclarativemousearea.cpp | 16 ---------------- src/declarative/graphicsitems/qdeclarativemousearea_p.h | 3 --- .../graphicsitems/qdeclarativemousearea_p_p.h | 17 ----------------- 3 files changed, 36 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativemousearea.cpp b/src/declarative/graphicsitems/qdeclarativemousearea.cpp index 6633256..ea04c19 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea.cpp +++ b/src/declarative/graphicsitems/qdeclarativemousearea.cpp @@ -496,9 +496,6 @@ void QDeclarativeMouseArea::mousePressEvent(QGraphicsSceneMouseEvent *event) d->pressAndHoldTimer.start(PressAndHoldDelay, this); setKeepMouseGrab(d->stealMouse); event->setAccepted(setPressed(true)); - - if(!event->isAccepted() && d->forwardToList.count()) - d->forwardEvent(event); } } @@ -576,9 +573,6 @@ void QDeclarativeMouseArea::mouseMoveEvent(QGraphicsSceneMouseEvent *event) me.setX(d->lastPos.x()); me.setY(d->lastPos.y()); emit positionChanged(&me); - - if(!event->isAccepted() && d->forwardToList.count()) - d->forwardEvent(event); } @@ -600,9 +594,6 @@ void QDeclarativeMouseArea::mouseReleaseEvent(QGraphicsSceneMouseEvent *event) if (s && s->mouseGrabberItem() == this) ungrabMouse(); setKeepMouseGrab(false); - - if(!event->isAccepted() && d->forwardToList.count()) - d->forwardEvent(event); } d->doubleClick = false; } @@ -994,11 +985,4 @@ QDeclarativeDrag *QDeclarativeMouseArea::drag() */ -QDeclarativeListProperty QDeclarativeMouseArea::forwardTo() -{ - Q_D(QDeclarativeMouseArea); - return d->forwardTo; -} - - QT_END_NAMESPACE diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p.h index 0fe8c6a..b0dbc30 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p.h @@ -130,7 +130,6 @@ class Q_AUTOTEST_EXPORT QDeclarativeMouseArea : public QDeclarativeItem Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged) Q_PROPERTY(QDeclarativeDrag *drag READ drag CONSTANT) //### add flicking to QDeclarativeDrag or add a QDeclarativeFlick ??? Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged REVISION 1) - Q_PROPERTY(QDeclarativeListProperty forwardTo READ forwardTo); public: QDeclarativeMouseArea(QDeclarativeItem *parent=0); @@ -158,8 +157,6 @@ public: bool preventStealing() const; void setPreventStealing(bool prevent); - QDeclarativeListProperty forwardTo(); - Q_SIGNALS: void hoveredChanged(); void pressedChanged(); diff --git a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h index 7248c92..67694fb 100644 --- a/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h +++ b/src/declarative/graphicsitems/qdeclarativemousearea_p_p.h @@ -70,8 +70,6 @@ public: : absorb(true), hovered(false), pressed(false), longPress(false), moved(false), stealMouse(false), doubleClick(false), preventStealing(false), drag(0) { - Q_Q(QDeclarativeMouseArea); - forwardTo = QDeclarativeListProperty(q, forwardToList); } ~QDeclarativeMouseAreaPrivate(); @@ -91,18 +89,6 @@ public: lastModifiers = event->modifiers(); } - void forwardEvent(QGraphicsSceneMouseEvent* event) - { - Q_Q(QDeclarativeMouseArea); - for(int i=0; i < forwardToList.count(); i++){ - event->setPos(forwardToList[i]->mapFromScene(event->scenePos())); - forwardToList[i]->scene()->sendEvent(forwardToList[i], event); - if(event->isAccepted()) - break; - } - event->setPos(q->mapFromScene(event->scenePos())); - } - bool isPressAndHoldConnected() { Q_Q(QDeclarativeMouseArea); static int idx = QObjectPrivate::get(q)->signalIndex("pressAndHold(QDeclarativeMouseEvent*)"); @@ -135,9 +121,6 @@ public: Qt::MouseButtons lastButtons; Qt::KeyboardModifiers lastModifiers; QBasicTimer pressAndHoldTimer; - - QDeclarativeListProperty forwardTo; - QList forwardToList; }; QT_END_NAMESPACE -- cgit v0.12 From 7eb590b5bb00e5cfb8e153938f55013eebe94880 Mon Sep 17 00:00:00 2001 From: Takumi ASAKI Date: Mon, 6 Jun 2011 12:13:58 +0200 Subject: Update Japanese translations. * Fix some inconsistent translations. * Translate some missing messages. * Update Japanese phrasebook. Merge-request: 1249 Reviewed-by: ossi --- tools/linguist/phrasebooks/japanese.qph | 15 ++- translations/assistant_ja.ts | 2 +- translations/designer_ja.ts | 52 ++++---- translations/linguist_ja.ts | 124 ++++++++++--------- translations/qt_help_ja.ts | 18 +-- translations/qt_ja.ts | 209 +++++++++++++++++++++----------- translations/qtconfig_ja.ts | 22 +++- 7 files changed, 274 insertions(+), 168 deletions(-) diff --git a/tools/linguist/phrasebooks/japanese.qph b/tools/linguist/phrasebooks/japanese.qph index 3ecd9e3..b04e525 100644 --- a/tools/linguist/phrasebooks/japanese.qph +++ b/tools/linguist/phrasebooks/japanese.qph @@ -1,4 +1,5 @@ - + + About について @@ -1018,4 +1019,16 @@ Yes はい + + &Next + 次を検索(&N) + + + List View + 一覧表示 + + + &Run + 実行(&R) + diff --git a/translations/assistant_ja.ts b/translations/assistant_ja.ts index a3169ab..5c990de 100644 --- a/translations/assistant_ja.ts +++ b/translations/assistant_ja.ts @@ -610,7 +610,7 @@ Reason: Next - 進む + 次へ Case Sensitive diff --git a/translations/designer_ja.ts b/translations/designer_ja.ts index ab87644..7fcc66d 100644 --- a/translations/designer_ja.ts +++ b/translations/designer_ja.ts @@ -764,7 +764,7 @@ The skin configuration file '%1' could not be opened. - スキンの設定ファイル '%1' がオープンできませんでした。 + スキンの設定ファイル '%1' を開けませんでした。 Syntax error: %1 @@ -1060,7 +1060,7 @@ Parsing grid layout minimum size values &Open... - オープン(&O)... + 開く(&O)... &Recent Forms @@ -1304,7 +1304,7 @@ UI ファイルの記述が矛盾しています。 Unknown error - 不明なエラー + 未知のエラー An error occurred while running the script for %1: %2 @@ -1451,7 +1451,7 @@ Do you want to update the file location or generate a new form? Could not open file - ファイルをオープンできませんでした + ファイルを開けませんでした Saved image %1. @@ -1471,7 +1471,7 @@ Do you want to update the file location or generate a new form? Could not write file - ファイルに書き込むことができませんでした + ファイルに書き込めませんでした &Close Preview @@ -1491,7 +1491,7 @@ Do you want to update the file location or generate a new form? Save &As... - 名前をつけて保存(&A)... + 名前を付けて保存(&A)... Save A&ll @@ -1525,7 +1525,7 @@ Do you want to update the file location or generate a new form? The file %1 could not be opened. Reason: %2 Would you like to retry or select a different file? - ファイル %1 はオープンできませんでした。 + ファイル %1 を開けませんでした。 原因: %2 リトライしますか、それとも他のファイルを選択しますか? @@ -1533,7 +1533,7 @@ Would you like to retry or select a different file? It was not possible to write the entire file %1 to disk. Reason:%2 Would you like to retry? - ファイル %1 の全体をディスクに書き込むことができませんでした。 + ファイル %1 の全体をディスクに書き込めませんでした。 原因: %2 リトライしますか? @@ -1876,7 +1876,7 @@ Container pages should only be added by specifying them in XML returned by the d The file <b>%1</b> could not be opened. - ファイル <b>%1</b> はオープンできませんでした。 + ファイル <b>%1</b> を開けませんでした。 There are %n forms with unsaved changes. Do you want to review these changes before quitting? @@ -2164,7 +2164,7 @@ Empty class name passed to widget factory method What's This - ヘルプ + ヒント Busy @@ -2190,7 +2190,7 @@ Empty class name passed to widget factory method Italic - イタリック + 斜体 Underline @@ -2778,7 +2778,7 @@ to Could not write %1: %2 - %1 に書き込むことが出来ませんでした: %2 + %1 に書き込めませんでした: %2 Open Resource File @@ -2790,11 +2790,11 @@ to Move Up - 上へ移動 + 上に移動 Move Down - 下へ移動 + 下に移動 Add Prefix @@ -3082,7 +3082,7 @@ Do you want overwrite the template? There was an error opening template %1 for writing. Reason: %2 - %1 というテンプレートを書き込み用にオープンしようとしてエラーになりました。理由: %2 + %1 というテンプレートを書き込み用に開こうととしてエラーになりました。理由: %2 Write Error @@ -3534,7 +3534,7 @@ Do you want overwrite the template? The file %1 could not be opened: %2 - ファイル %1 はオープンできませんでした: %2 + ファイル %1 を開けませんでした: %2 The file %1 could not be written: %2 @@ -3797,19 +3797,19 @@ Do you want overwrite the template? Unable to open the file '%1' for writing: %2 - ファイル '%1' を書き込み用にオープンできませんでした: %2 + ファイル '%1' を書き込み用に開けません: %2 Open profile - プロファイルをオープン + プロファイルを開く Open Profile - Error - プロファイルをオープン - Error + プロファイルを開く - エラー Unable to open the file '%1' for reading: %2 - ファイル '%1' を読み込み用にオープンできませんでした: %2 + ファイル '%1' を読み込み用に開けません: %2 '%1' is not a valid profile: %2 @@ -4558,7 +4558,7 @@ Please select another name. Unable to open the form template file '%1': %2 - フォームのテンプレートファイル '%1' をオープンできません: %2 + フォームのテンプレートファイル '%1' を開けません: %2 Internal error: No template selected. @@ -4761,7 +4761,7 @@ Please select another name. Refresh - リフレッシュ + 更新 Scan for newly installed custom widget plugins. @@ -5256,7 +5256,7 @@ Class: %2 &OK - OK(&O) + &OK &Cancel @@ -5287,7 +5287,7 @@ Class: %2 Italic - イタリック + 斜体 CTRL+I @@ -5730,7 +5730,7 @@ Class: %2 List View - リスト表示 + 一覧表示 Icon View @@ -5792,7 +5792,7 @@ UI ファイルに矛盾が発生しています。 qdesigner_internal::WizardContainerWidgetTaskMenu Next - 進む + 次へ Back diff --git a/translations/linguist_ja.ts b/translations/linguist_ja.ts index 40bb778..9164b75 100644 --- a/translations/linguist_ja.ts +++ b/translations/linguist_ja.ts @@ -84,6 +84,10 @@ DataModel + The translation file '%1' will not be loaded because it is empty. + 翻訳ファイル '%1' が空のためロードできません。 + + <qt>Duplicate messages found in '%1': <qt>'%1' に重複したメッセージが見つかりました: @@ -345,7 +349,7 @@ Return value: 2 on read failures 3 on write failures - + 使い方: lconvert [オプション] <入力ファイル> [<入力ファイル>...] @@ -365,8 +369,8 @@ lconvert は Qt Linguist ツールチェインの一部です。 -i <入力ファイル> --input-file <入力ファイル> 入力ファイルを指定します。<入力ファイル> の指定はダッシュ記号で始まっていてもよいです。 - This option can be used several times to merge inputs. - May be '-' (標準入力) for use in a pipe. + このオプションはマージする入力ファイルを指定する際に複数回使用できます。 + パイプで利用する場合には '-' で標準入力を指定します。 -o <出力ファイル> --output-file <出力ファイル> @@ -382,29 +386,30 @@ lconvert は Qt Linguist ツールチェインの一部です。 出力形式を指定します。-if を参照してください。 --input-codec <コーデック> - Specify encoding for QM and PO input files. Default is 'Latin1' - for QM and 'UTF-8' for PO files. UTF-8 is always tried as well for - QM, corresponding to the possible use of the trUtf8() function. + QM や PO ファイルのエンコーディングを指定します。デフォルトでは + QM ファイルでは 'Latin1' を PO ファイルでは 'UTF-8' を使用します。 + QM ファイルでは通常 trUtf8() 関数が組み合わせて利用されるため、 + UTF-8 の利用も試みます。 --output-codec <コーデック> - Specify encoding for PO output files.デフォルトは 'UTF-8' です。 + PO 出力ファイルのエンコーディングを指定します。デフォルトは 'UTF-8' です。 --drop-tags <正規表現> - Drop named extra tags when writing TS or XLIFF files. - May be specified repeatedly. + TS ファイルや XLIFF ファイルに出力する際に名前付き拡張タグを削除します。 + 複数回指定可能です。 --drop-translations - Drop existing translations and reset the status to 'unfinished'. - 注意: --no-obsolete と同等です。 + 既存の翻訳を削除してステータスを'未完了'にリセットします。 + 注意: --no-obsolete の指定を含みます。 --source-language <language>[_<region>] - Specify/override the language of the source strings. Defaults to - POSIX if not specified and the file does not name it yet. + ソーステキストの言語を指定もしくは上書きします。 + 未指定でファイルにも記述されていない場合、POSIX をデフォルトで使用します。 --target-language <language>[_<region>] - Specify/override the language of the translation. - The target language is guessed from the file name if this option - is not specified and the file contents name no language yet. + 翻訳で使用される言語を指定もしくは上書きします。 + オプションやファイル内で言語が指定されていない場合は、 + ファイル名から言語を推測します。 --no-obsolete 未使用のメッセージを取り除きます。 @@ -416,14 +421,14 @@ lconvert は Qt Linguist ツールチェインの一部です。 出力する TS ファイル内のコンテキストをアルファベット順にソートします。 --locations {absolute|relative|none} - Override how source code references are saved in TS files. - Default is absolute. + TS ファイル内に保存されているソースコードへの参照を上書きします。 + デフォルトは absolute (絶対パス) です。 --no-ui-lines UI ファイルを参照している行番号を取り除きます。 --verbose - be a bit more verbose + より詳しいログを出力します。 長すぎるオプションの指定はダッシュ記号で括る事で1つにできます。 @@ -489,13 +494,14 @@ Options: -version Display the version of lrelease and exit - 使い方: + 使い方: lrelease [オプション] project-file lrelease [オプション] ts-files [-qm qm-file] -lrelease is part of Qt's Linguist tool chain. It can be used as a -stand-alone tool to convert XML-based translations files in the TS -format into the 'compiled' QM format used by QTranslator objects. +lrelease は Qt Linguist ツールチェインの一部です。 +XMLベースの翻訳ファイルであるTSフォーマットを +QTranslatorで利用可能な「コンパイル済み」のQMフォーマットに +変換する事ができるスタンドアロンのツールです。 オプション: -help このヘルプを表示して終了します @@ -506,13 +512,13 @@ format into the 'compiled' QM format used by QTranslator objects. -nounfinished 未完了の翻訳をインクルードしません -removeidentical - If the translated text is the same as - the source text, do not include the message + 翻訳後の文字列がソースと同じ場合、 + メッセージをQMファイルに組み込みません -markuntranslated <プレフィクス> - If a message has no real translation, use the source text - prefixed with the given string instead + メッセージが翻訳されていない場合、ソースの文字列に + <プレフィックス>を追加した文字列を代わりに使用します -silent - 完了した事を通知しません + 実行内容を表示しません -version lrelease のバージョンを表示して終了します @@ -823,62 +829,62 @@ Options: @lst-file Read additional file names (one per line) from lst-file. - 使い方: + 使い方: lupdate [オプション] [プロジェクトファイル]... lupdate [オプション] [source-file|path|@lst-file]... -ts ts-files|@lst-file -lupdate は Qt' Linguist ツールチェインの一部です。Qt UI ファイル、C++ 、Java、 +lupdate は Qt Linguist ツールチェインの一部です。Qt UI ファイル、C++ 、Java、 JavaScript/QtScript のソースコードからメッセージを抽出します。 -Extracted messages are stored in textual translation source files (typically -Qt TS XML). 新しく追加されたり変更されたメッセージは既存の TS ファイル内のメッセージから -マージされます。 +抽出されたメッセージは原文として翻訳ソースファイル(通常は Qt TS XML)に保存されます。 +新しく追加されたり変更されたメッセージは既存の TS ファイル内のメッセージからマージされます。 オプション: -help このヘルプを表示して終了します。 -no-obsolete - すべての未使用の文字列を取り除きます。 + すべての未使用の文字列を取り除きます。 -extensions <ext>[,<ext>]... - 与えられた拡張子のファイルだけ処理します。 - 拡張子のリストはカンマで区切り、空白スペースを含んではいけません。 - デフォルト: '%1' + 与えられた拡張子のファイルだけを処理します。 + 拡張子のリストはカンマで区切り、空白スペースを含んではいけません。 + デフォルト: '%1' -pluralonly - 複数形のメッセージだけインクルードします。 + 複数形のメッセージだけインクルードします。 -silent - 完了した事を通知しません + 完了した事を通知しません -no-sort - TS ファイル内のコンテキストをソートしません。 + TS ファイル内のコンテキストをソートしません。 -no-recursive - ディレクトリ内を再帰的に処理しません。 + ディレクトリ内を再帰的に処理しません。 -recursive - ディレクトリ内を再帰的に処理します。(デフォルト) + ディレクトリ内を再帰的に処理します。(デフォルト) -I <includepath> or -I<includepath> - Additional location to look for include files. - May be specified multiple times. + include ファイルを検索するパスを追加します。 + 複数回の指定が可能です。 -locations {absolute|relative|none} - Specify/override how source code references are saved in TS files. - Default is absolute. + TS ファイルに保存されるソースコードの参照方法を指定/上書きします。 + デフォルトは absolute (絶対パス)です。 -no-ui-lines - UI ファイルを参照する行番号を記録しません。 + UI ファイルを参照する行番号を記録しません。 -disable-heuristic {sametext|similartext|number} - Disable the named merge heuristic. Can be specified multiple times. + 指定された手法のあいまいマージを行いません。複数回の指定が可能です。 -pro <ファイル名> - .pro ファイルの名前を指定します。Useful for files with .pro file syntax but - different file suffix. Projects are recursed into and merged. + .pro ファイルの名前を指定します。.pro ファイルの書式に従いながら、 + 拡張子が異なる場合に有用です。 + プロジェクトは再帰的に検索し、複数指定時はマージされます。 -source-language <language>[_<region>] - Specify the language of the source strings for new files. - Defaults to POSIX if not specified. + 新しくファイルを作成する場合のソース文字列の言語を指定します。 + 指定されない場合のデフォルトは POSIX です。 -target-language <language>[_<region>] - Specify the language of the translations for new files. - Guessed from the file name if not specified. + 新しくファイルを作成する場合の翻訳言語を指定します。 + 指定されない場合はファイル名から推測されます。 -ts <ts-file>... - 出力ファイルを指定します。This will override the TRANSLATIONS - and nullify the CODECFORTR from possibly specified project files. + 出力ファイルを指定します。プロジェクトファイルで指定された + TRANSLATIONS と CODECFORTR は無視されます。 -codecfortr <codec> - Specify the codec assumed for tr() calls. Effective only with -ts. + tr() の呼び出し時に想定されるコーデックを指定します。-ts オプションを指定した場合にのみ有効です。 -version - lupdate のバージョン情報を表示して終了します。 + lupdate のバージョン情報を表示して終了します。 @lst-file - Read additional file names (one per line) from lst-file. + lst-file を使って追加で読み込むファイル名(1行に1ファイル)を指定します。 diff --git a/translations/qt_help_ja.ts b/translations/qt_help_ja.ts index 2a725ca..59036e0 100644 --- a/translations/qt_help_ja.ts +++ b/translations/qt_help_ja.ts @@ -43,7 +43,7 @@ Cannot open collection file: %1 - コレクションファイルをオープンできません: %1 + コレクションファイルを開けません: %1 Cannot create tables in file %1! @@ -67,7 +67,7 @@ Cannot open database '%1' to optimize! - 最適化用にデータベース '%1' をオープンできません! + 最適化用にデータベース '%1' を開けません! Cannot create directory: %1 @@ -83,7 +83,7 @@ Cannot open documentation file %1! - ドキュメントファイル %1 をオープンできません! + ドキュメントファイル %1 を開けません! The namespace %1 was not registered! @@ -99,14 +99,14 @@ Cannot open database '%1' '%2': %3 The placeholders are: %1 - The name of the database which cannot be opened %2 - The unique id for the connection %3 - The actual error string - データベース '%1' '%2' がオープンできません: %3 + データベース '%1' '%2' を開けません: %3 QHelpEngineCore Cannot open documentation file %1: %2! - ドキュメントファイル %1 をオープンできません: %2! + ドキュメントファイル %1 を開けません: %2! The specified namespace does not exist! @@ -133,7 +133,7 @@ Cannot open data base file %1! - データベースファイル %1 をオープンできません! + データベースファイル %1 を開けません! Cannot register namespace %1! @@ -177,7 +177,7 @@ Cannot open file %1! Skipping it. - ファイル %1 をオープンできません! スキップします。 + ファイル %1 を開けません! スキップします。 The filter %1 is already registered! @@ -209,7 +209,7 @@ File '%1' cannot be opened. - ファイル '%1' をオープンできません。 + ファイル '%1' を開けません。 File '%1' contains an invalid link to file '%2' @@ -256,7 +256,7 @@ The input file %1 could not be opened! - 入力ファイル %1 がオープンできません! + 入力ファイル %1 を開けません! diff --git a/translations/qt_ja.ts b/translations/qt_ja.ts index db8a917..094e34d 100644 --- a/translations/qt_ja.ts +++ b/translations/qt_ja.ts @@ -75,7 +75,7 @@ Accessibility - アクセシビリティ + ユーザー補助 @@ -136,7 +136,7 @@ libgstreamer-plugins-base はインストールされていますか。 Could not open media source. - メディアソースを開くことができません。 + メディアソースを開けませんでした。 Invalid source type. @@ -148,11 +148,11 @@ libgstreamer-plugins-base はインストールされていますか。 Could not open audio device. The device is already in use. - オーディオデバイスを開くことができません。デバイスは既に他のプロセスにより使用されています。 + オーディオデバイスを開けませんでした。デバイスは既に他のプロセスにより使用されています。 Could not decode media source. - メディアソースを開くことができません。見つからないか、未知の形式です。 + メディアソースを開けませんでした。見つからないか、未知の形式です。 @@ -320,6 +320,10 @@ libgstreamer-plugins-base はインストールされていますか。Playback complete 再生が終了しました + + Download error + ダウンロードエラー + Phonon::MMF::AbstractVideoPlayer @@ -439,6 +443,10 @@ libgstreamer-plugins-base はインストールされていますか。Error opening source: media type could not be determined ソースのオープン時にエラーが発生しました: メディアのタイプが不明です + + Failed to set requested IAP + 要求されたIAPのセットに失敗しました + Phonon::MMF::StereoWidening @@ -511,7 +519,7 @@ libgstreamer-plugins-base はインストールされていますか。 Open - オープン + 開く Select a Directory @@ -559,7 +567,7 @@ libgstreamer-plugins-base はインストールされていますか。 &OK - OK(&O) + &OK Look &in: @@ -607,7 +615,7 @@ libgstreamer-plugins-base はインストールされていますか。 Read-only - 読み込み専用 + 読み取り専用 Write-only @@ -643,7 +651,7 @@ libgstreamer-plugins-base はインストールされていますか。 Open - オープン + 開く Save As @@ -651,7 +659,7 @@ libgstreamer-plugins-base はインストールされていますか。 &Open - オープン(&O) + 開く(&O) &Save @@ -1168,7 +1176,7 @@ to QComboBox Open - オープン + 開く False @@ -1216,6 +1224,11 @@ to %1: リソース不足です + %1: permission denied + QSystemSemaphore + %1: 許可されていません + + %1: unknown error %2 QSystemSemaphore %1: 未知のエラー %2 @@ -1290,11 +1303,11 @@ to QDeclarativeAbstractAnimation Cannot animate non-existent property "%1" - 存在しないプロパティ "%1" はアニメーション出来ません + 存在しないプロパティ "%1" はアニメーションできません Cannot animate read-only property "%1" - 読込専用のプロパティ "%1" はアニメーション出来ません + 読込専用のプロパティ "%1" はアニメーションできません Animation is an abstract class @@ -1320,7 +1333,7 @@ to Cannot anchor to an item that isn't a parent or sibling. - 親でも兄弟でもない要素にはアンカー出来ません。 + 親でも兄弟でもない要素にはアンカーできません。 Possible anchor loop detected on vertical anchor. @@ -1336,15 +1349,15 @@ to Cannot anchor to a null item. - 空の要素にはアンカー出来ません。 + 空の要素にはアンカーできません。 Cannot anchor a horizontal edge to a vertical edge. - 横方向のエッジから縦方向のエッジへはアンカー出来ません。 + 横方向のエッジから縦方向のエッジへはアンカーできません。 Cannot anchor item to self. - 自分自身へはアンカー出来ません。 + 自分自身へはアンカーできません。 Cannot specify top, bottom, and vcenter anchors. @@ -1356,7 +1369,7 @@ to Cannot anchor a vertical edge to a horizontal edge. - 縦方向のエッジから横方向のエッジへはアンカー出来ません。 + 縦方向のエッジから横方向のエッジへはアンカーできません。 @@ -1367,6 +1380,13 @@ to + QDeclarativeApplication + + Application is an abstract class + Application は抽象クラスです + + + QDeclarativeBehavior Cannot change the animation assigned to a Behavior. @@ -1494,12 +1514,20 @@ to 仕様が空であるコンポーネントは作成できません + "%1.%2" is not available in %3 %4.%5. + %3 %4.%5 で "%1.%2" は利用できません。 + + + "%1.%2" is not available due to component versioning. + コンポーネントのバージョンの問題により "%1.%2" は利用できません。 + + Incorrectly specified signal assignment 仕様と異なるシグナルが割り当てられています Cannot assign a value to a signal (expecting a script to be run) - 値をシグナルに割り当てることはできません(ただし、スクリプトは除きます) + 値はシグナルに割り当てできません(ただし、スクリプトは除きます) Empty signal assignment @@ -1551,7 +1579,7 @@ to Cannot assign a value directly to a grouped property - グループ化されたプロパティに直接値を割り当てることはできません + グループ化されたプロパティに直接値を割り当てできません Invalid property use @@ -1563,15 +1591,15 @@ to Single property assignment expected - プロパティに複数の値は割り当てられません + プロパティに複数の値は割り当てできません Unexpected object assignment - オブジェクトを割り当てることはできません + オブジェクトを割り当てできません Cannot assign object to list - オブジェクトをリストに割り当てることはできません + オブジェクトをリストに割り当てできません Can only assign one binding to lists @@ -1579,19 +1607,23 @@ to Cannot assign primitives to lists - プリミティブをリストに割り当てることはできません + プリミティブをリストに割り当てできません Cannot assign multiple values to a script property - 複数の値をスクリプトプロパティに割り当てることはできません + 複数の値をスクリプトプロパティに割り当てできません Invalid property assignment: script expected 無効なプロパティの値: スクリプトを指定してください + Cannot assign multiple values to a singular property + 複数の値を単数プロパティに割り当てできません + + Cannot assign object to property - オブジェクトをプロパティに割り当てることはできません + オブジェクトをプロパティに割り当てできません "%1" cannot operate on "%2" @@ -1647,7 +1679,7 @@ to Cannot override FINAL property - FINAL プロパティを上書きすることはできません + FINAL プロパティは上書きできません Invalid property type @@ -1675,19 +1707,27 @@ to No property alias location - プロパティのエイリアスのパスがありません + プロパティのエイリアスへのパスがありません Invalid alias location 無効なエイリアスのパス + Invalid alias reference. An alias reference must be specified as <id>, <id>.<property> or <id>.<value property>.<property> + 無効なエイリアスの参照です。エイリアスの参照先は <ID>, <ID>.<プロパティ> もしくは <ID>.<値プロパティ>.<プロパティ> のいずれかでなくてはいけません + + + Alias property exceeds alias bounds + エイリアスプロパティがエイリアスの境界を越えています + + Invalid alias reference. An alias reference must be specified as <id> or <id>.<property> - 無効なエイリアスの参照です。エイリアスの参照先は <ID> もしくは <ID>.<プロパティ> でなくてはいけません + 無効なエイリアスの参照です。エイリアスの参照先は <ID> もしくは <ID>.<プロパティ> でなくてはいけません Invalid alias reference. Unable to find id "%1" - 無効なエイリアスの参照です。 ID "%1" が見つかりません + 無効なエイリアスの参照です。ID "%1" が見つかりません @@ -1696,6 +1736,10 @@ to Invalid empty URL 空の URL は無効です + + createObject: value is not an object + createObject: 値がオブジェクトではありません + QDeclarativeCompositeTypeManager @@ -1776,6 +1820,10 @@ to QDeclarativeImportDatabase + cannot load module "%1": File name case mismatch for "%2" + モジュール "%1" がロードできません: ファイル名の大文字小文字が "%2" に合っていません + + module "%1" definition "%2" not readable "%1" モジュールの定義 "%2" が読めません @@ -1831,19 +1879,34 @@ to is not a type は型ではありません + + File name case mismatch for "%2" + ファイル名の大文字小文字が "%2" に合っていません + QDeclarativeKeyNavigationAttached KeyNavigation is only available via attached properties - KeyNavigation はアタッチド・プロパティ(Attached Property: 型名.プロパティ名)の形式でのみ利用できます + KeyNavigation はアタッチされたプロパティ(Attached Property: 型名.プロパティ名)の形式でのみ利用できます QDeclarativeKeysAttached Keys is only available via attached properties - Keys はアタッチド・プロパティ(Attached Property: 型名.プロパティ名)の形式でのみ利用できます + Keys はアタッチされたプロパティ(Attached Property: 型名.プロパティ名)の形式でのみ利用できます + + + + QDeclarativeLayoutMirroringAttached + + LayoutDirection attached property only works with Items + アタッチされたプロパティ LayoutDirection はアイテムでのみ利用できます + + + LayoutMirroring is only available via attached properties + LayoutMirroring はアタッチされたプロパティ(Attached Property: 型名.プロパティ名)の形式でのみ利用できます @@ -2146,7 +2209,7 @@ to Cannot assign object type %1 with no default method - 型 %1 のオブジェクトをデフォルトメソッドなしに割り当てることはできません + デフォルトメソッドの無い型 %1 のオブジェクトは割り当てできません Cannot connect mismatched signal/slot %1 %vs. %2 @@ -2220,7 +2283,7 @@ to QDialog What's This? - ヒント? + ヒント Done @@ -2267,7 +2330,7 @@ to Open - オープン + 開く &Cancel @@ -2323,7 +2386,7 @@ to &OK - OK(&O) + &OK @@ -2397,7 +2460,7 @@ to &OK - OK(&O) + &OK @@ -2420,7 +2483,7 @@ to Cannot open for output - コピー先のファイルをオープンできません + コピー先のファイルを開けません Failure to write block @@ -2451,7 +2514,7 @@ to &Open - オープン(&O) + 開く(&O) &Save @@ -2459,7 +2522,7 @@ to Open - オープン + 開く %1 already exists. @@ -2477,7 +2540,7 @@ Please verify the correct file name was given. My Computer - マイ コンピュータ + マイコンピュータ %1 @@ -2692,7 +2755,7 @@ Do you want to delete it anyway? My Computer - マイ コンピュータ + マイコンピュータ Computer @@ -2732,7 +2795,7 @@ Do you want to delete it anyway? Italic - イタリック + 斜体 Oblique @@ -3207,7 +3270,7 @@ Do you want to delete it anyway? QIBaseDriver Error opening database - データベースのオープンでエラーが発生しました + データベースのオープン時にエラーが発生しました Could not start transaction @@ -3234,7 +3297,7 @@ Do you want to delete it anyway? Unable to open BLOB - バイナリラージオブジェクトをオープンできません + バイナリラージオブジェクトを開けません Unable to read BLOB @@ -3390,11 +3453,11 @@ Do you want to delete it anyway? Cannot load library %1: %2 - ライブラリ '%1' を読み込むことができません: %2 + ライブラリ '%1' を読み込めません: %2 Cannot unload library %1: %2 - ライブラリ %1 を解放することができません: %2 + ライブラリ %1 を解放できません: %2 Cannot resolve symbol "%1" in %2: %3 @@ -3502,7 +3565,7 @@ Do you want to delete it anyway? QMYSQLDriver Unable to open database ' - データベースをオープンできません ' + データベースを開けません ' Unable to connect @@ -3659,7 +3722,7 @@ Do you want to delete it anyway? Open - オープン + 開く Execute @@ -3833,7 +3896,7 @@ Do you want to delete it anyway? QNetworkAccessCacheBackend Error opening %1 - オープンのエラー %1 + オープン時のエラー %1 @@ -3870,7 +3933,7 @@ Do you want to delete it anyway? Error opening %1: %2 - %1 をオープンする時にエラーが発生しました: %2 + %1 のオープン時にエラーが発生しました: %2 Write error writing to %1: %2 @@ -3878,7 +3941,7 @@ Do you want to delete it anyway? Cannot open %1: Path is a directory - %1 をオープンできません。指定されたパスはディレクトリです + %1 を開けません。指定されたパスはディレクトリです Read error reading from %1: %2 @@ -3893,7 +3956,7 @@ Do you want to delete it anyway? Cannot open %1: is a directory - %1 をオープンできません。指定されたパスはディレクトリです + %1 を開けません。指定されたパスはディレクトリです Logging in to %1 failed: authentication required @@ -4623,7 +4686,7 @@ Please choose a different file name. QPrintPreviewDialog Page Setup - ページの設定 + ページ設定 %1% @@ -4691,7 +4754,7 @@ Please choose a different file name. Page setup - ページの設定 + ページ設定 Close @@ -4847,11 +4910,11 @@ Please choose a different file name. QProcess Could not open input redirection for reading - 標準入力リダイレクトを読み込みのためにオープンすることができません + 標準入力リダイレクトを読み込みのために開けませんでした Could not open output redirection for writing - 標準出力リダイレクトを書き込みのためにオープンすることができません + 標準出力リダイレクトを書き込みのために開けませんでした Resource error (fork failure): %1 @@ -4893,7 +4956,7 @@ Please choose a different file name. QPushButton Open - オープン + 開く @@ -4954,7 +5017,7 @@ Please choose a different file name. QSQLite2Driver Error opening database - データベースのオープンでエラーが発生しました + データベースのオープン時にエラーが発生しました Unable to begin transaction @@ -4984,11 +5047,11 @@ Please choose a different file name. QSQLiteDriver Error opening database - データベースのオープンでエラーが発生しました + データベースのオープン時にエラーが発生しました Error closing database - データベースのクローズでエラーが発生しました + データベースのクローズ時にエラーが発生しました Unable to begin transaction @@ -5495,11 +5558,11 @@ Please choose a different file name. Pause - Pause + 一時停止 Print - Print + 印刷 SysReq @@ -6113,11 +6176,11 @@ Please choose a different file name. Insert - Insert + 挿入 Delete - Delete + 削除 Escape @@ -6129,7 +6192,7 @@ Please choose a different file name. Select - Select + 選択 Yes @@ -6430,7 +6493,7 @@ Please choose a different file name. Select - セレクト + 選択 Done @@ -6554,6 +6617,10 @@ Please choose a different file name. SSL ハンドシェーク時にエラーが発生しました: %1 + The peer certificate is blacklisted + 通信相手の証明書がブラックリストに載っています + + No error エラーはありません @@ -6760,7 +6827,7 @@ Please choose a different file name. Open - オープン + 開く @@ -6906,7 +6973,7 @@ Please choose a different file name. Choose File title for file button used in HTML forms - ファイルを選ぶ + ファイルを選択 No file selected @@ -7061,7 +7128,7 @@ Please choose a different file name. Italic Italic context menu item - イタリック + 斜体 Underline @@ -7141,7 +7208,7 @@ Please choose a different file name. Slider Media controller element - スライダ + スライダー Slider Thumb @@ -7586,7 +7653,7 @@ Please choose a different file name. QWhatsThisAction What's This? - ヒント? + ヒント diff --git a/translations/qtconfig_ja.ts b/translations/qtconfig_ja.ts index cf3ec13..8440389 100644 --- a/translations/qtconfig_ja.ts +++ b/translations/qtconfig_ja.ts @@ -4,6 +4,26 @@ MainWindow + <p><b><font size+=2>Appearance</font></b></p><hr><p>Use this tab to customize the appearance of your Qt applications.</p><p>You can select the default GUI Style from the drop down list and customize the colors.</p><p>Any GUI Style plugins in your plugin path will automatically be added to the list of built-in Qt styles. (See the Library Paths tab for information on adding new plugin paths.)</p><p>When you choose 3-D Effects and Window Background colors, the Qt Configuration program will automatically generate a palette for you. To customize colors further, press the Tune Palette button to open the advanced palette editor.<p>The Preview Window shows what the selected Style and colors look like. + + + + <p><b><font size+=2>Fonts</font></b></p><hr><p>Use this tab to select the default font for your Qt applications. The selected font is shown (initially as 'Sample Text') in the line edit below the Family, Style and Point Size drop down lists.</p><p>Qt has a powerful font substitution feature that allows you to specify a list of substitute fonts. Substitute fonts are used when a font cannot be loaded, or if the specified font doesn't have a particular character.<p>For example, if you select the font Lucida, which doesn't have Korean characters, but need to show some Korean text using the Mincho font family you can do so by adding Mincho to the list. Once Mincho is added, any Korean characters that are not found in the Lucida font will be taken from the Mincho font. Because the font substitutions are lists, you can also select multiple families, such as Song Ti (for use with Chinese text). + + + + <p><b><font size+=2>Interface</font></b></p><hr><p>Use this tab to customize the feel of your Qt applications.</p><p>If the Resolve Symlinks checkbox is checked Qt will follow symlinks when handling URLs. For example, in the file dialog, if this setting is turned on and /usr/tmp is a symlink to /var/tmp, entering the /usr/tmp directory will cause the file dialog to change to /var/tmp. With this setting turned off, symlinks are not resolved or followed.</p><p>The Global Strut setting is useful for people who require a minimum size for all widgets (e.g. when using a touch panel or for users who are visually impaired). Leaving the Global Strut width and height at 0 will disable the Global Strut feature</p><p>XIM (Extended Input Methods) are used for entering characters in languages that have large character sets, for example, Chinese and Japanese. + + + + <p><b><font size+=2>Printer</font></b></p><hr><p>Use this tab to configure the way Qt generates output for the printer.You can specify if Qt should try to embed fonts into its generated output.If you enable font embedding, the resulting postscript will be more portable and will more accurately reflect the visual output on the screen; however the resulting postscript file size will be bigger.<p>When using font embedding you can select additional directories where Qt should search for embeddable font files. By default, the X server font path is used. + + + + <p><b><font size+=2>Phonon</font></b></p><hr><p>Use this tab to configure the Phonon GStreamer multimedia backend. <p>It is reccommended to leave all settings on "Auto" to let Phonon determine your settings automatically. + + + Desktop Settings (Default) デスクトップの設定(デフォルト) @@ -364,7 +384,7 @@ Browse... - ブラウズ... + 参照... Press the <b>Browse</b> button or enter a directory and press Enter to add them to the list. -- cgit v0.12 From ab00a395bb00ccd130a01d49bf18c2bc597a1fe6 Mon Sep 17 00:00:00 2001 From: Xizhi Zhu Date: Wed, 8 Jun 2011 11:44:41 +0300 Subject: Update internal state before emitting configurationChanged() signals. PMO Bug 257336. --- src/plugins/bearer/icd/qicdengine.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/bearer/icd/qicdengine.cpp b/src/plugins/bearer/icd/qicdengine.cpp index c793e52..79be2ce 100644 --- a/src/plugins/bearer/icd/qicdengine.cpp +++ b/src/plugins/bearer/icd/qicdengine.cpp @@ -929,6 +929,7 @@ void QIcdEngine::connectionStateSignalsSlot(QDBusMessage msg) configLocker.unlock(); locker.unlock(); + emit iapStateChanged(iapid, icd_connection_state); emit configurationChanged(ptr); locker.relock(); -- cgit v0.12 From 7b287a3861b2b71a31dfea53b5c93a0cb7d99fcc Mon Sep 17 00:00:00 2001 From: Jocelyn Turcotte Date: Tue, 7 Jun 2011 20:14:13 +0200 Subject: Limit the cookies count per domain to 50. This makes it more difficult for a single server to fill the client's cookie jar. All major browsers currently have a similar limit. This patch also modifies the "find already existing cookie" loop to use indexes instead of iterators to match the newly added loop. Reviewed-by: Peter Hartmann --- src/network/access/qnetworkcookiejar.cpp | 27 ++++++++++---- .../qnetworkcookiejar/tst_qnetworkcookiejar.cpp | 41 ++++++++++++++++++++++ 2 files changed, 61 insertions(+), 7 deletions(-) diff --git a/src/network/access/qnetworkcookiejar.cpp b/src/network/access/qnetworkcookiejar.cpp index 291bdec..e49a8e1 100644 --- a/src/network/access/qnetworkcookiejar.cpp +++ b/src/network/access/qnetworkcookiejar.cpp @@ -220,20 +220,33 @@ bool QNetworkCookieJar::setCookiesFromUrl(const QList &cookieLis continue; // not accepted } - QList::Iterator it = d->allCookies.begin(), - end = d->allCookies.end(); - for ( ; it != end; ++it) + for (int i = 0; i < d->allCookies.size(); ++i) { // does this cookie already exist? - if (cookie.name() == it->name() && - cookie.domain() == it->domain() && - cookie.path() == it->path()) { + const QNetworkCookie ¤t = d->allCookies.at(i); + if (cookie.name() == current.name() && + cookie.domain() == current.domain() && + cookie.path() == current.path()) { // found a match - d->allCookies.erase(it); + d->allCookies.removeAt(i); break; } + } // did not find a match if (!isDeletion) { + int countForDomain = 0; + for (int i = d->allCookies.size() - 1; i >= 0; --i) { + // Start from the end and delete the oldest cookies to keep a maximum count of 50. + const QNetworkCookie ¤t = d->allCookies.at(i); + if (isParentDomain(cookie.domain(), current.domain()) + || isParentDomain(current.domain(), cookie.domain())) { + if (countForDomain >= 49) + d->allCookies.removeAt(i); + else + ++countForDomain; + } + } + d->allCookies += cookie; ++added; } diff --git a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp index d59a510..ef843f3 100644 --- a/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp +++ b/tests/auto/qnetworkcookiejar/tst_qnetworkcookiejar.cpp @@ -52,6 +52,7 @@ private slots: void getterSetter(); void setCookiesFromUrl_data(); void setCookiesFromUrl(); + void setCookiesFromUrl_50CookiesLimitPerDomain(); void cookiesForUrl_data(); void cookiesForUrl(); void effectiveTLDs_data(); @@ -251,6 +252,46 @@ void tst_QNetworkCookieJar::setCookiesFromUrl() QVERIFY2(result.isEmpty(), QTest::toString(result)); } +static bool findCookieName(const QList &cookieList, const QString &name) +{ + foreach(QNetworkCookie cookie, cookieList) + if (cookie.name() == name) + return true; + return false; +} + +void tst_QNetworkCookieJar::setCookiesFromUrl_50CookiesLimitPerDomain() +{ + QNetworkCookie cookie; + cookie.setValue("value"); + MyCookieJar jar; + QUrl url("http://a.b.c.com"); + + for (int i = 0; i < 20; ++i) { + // Add a list of 3 domain-matched cookies on each iteration for a total of 60 cookies. + QList cookieList; + cookie.setName(QString("CookieNo%1").arg(i*3+1).toAscii()); + cookie.setDomain("a.b.c.com"); + cookieList += cookie; + cookie.setName(QString("CookieNo%1").arg(i*3+2).toAscii()); + cookie.setDomain(".b.c.com"); + cookieList += cookie; + cookie.setName(QString("CookieNo%1").arg(i*3+3).toAscii()); + cookie.setDomain(".c.com"); + cookieList += cookie; + jar.setCookiesFromUrl(cookieList, url); + + int expectedNumCookies = std::min((i+1)*3, 50); + QCOMPARE(jar.allCookies().size(), expectedNumCookies); + } + + // Verify that the oldest cookies were the ones overwritten. + QVERIFY(!findCookieName(jar.allCookies(), "CookieNo1")); + QVERIFY(!findCookieName(jar.allCookies(), "CookieNo10")); + QVERIFY(findCookieName(jar.allCookies(), "CookieNo11")); + QVERIFY(findCookieName(jar.allCookies(), "CookieNo60")); +} + void tst_QNetworkCookieJar::cookiesForUrl_data() { QTest::addColumn >("allCookies"); -- cgit v0.12 From 4225a25efb46c9f5a3fbb8197286663b8cb21e27 Mon Sep 17 00:00:00 2001 From: Jan-Arve Saether Date: Thu, 9 Jun 2011 09:57:39 +0200 Subject: Fixes to how resize event and layout request are posted. Also fixed how the relayout is initiated. This is because we needed to react differently to *posted* layout requests than to sent layout requests. (sent ones should activate the layout, posted ones should also resize the widget). We therefore introduced the private slot _q_relayout() in order to be able to make the distinction between posted and sent layout requests. (Instead of posting we now invokeMethod with a queued connection. In order to make it behave as it was compressed we also have to refcount the number of calls to invokeMethod.) (Note that refCount is 16 bits only, so it should not overflow in sane cases. In the insane cases, the worst thing that will happen is that it'll relayout the layout one extra time). Make sure we resize QGraphicsWidget to be within its min,max sizes when we change one of its constraints. (e.g. we change minimumSize to something bigger than the current size). This did not work if the widget did not have a layout. Send a resize event whenever a QGraphicsWidget changes its size. This did not happen before, because in the cases where a Layout Request was sent, we did not send a resize event. This patch changes that, so that when we send a resize event, we do not send a Layout Request event. This means that a Layout Request event is now *only* sent in order to tell a widget to relayout its children (but the widgets size was not changed, that's why we cannot send a resize event in that case) Also includes a unit test, and a fix to make sure that we send a resize event when we resize due to the sizehint changing followed by a setPos command. Added autotests for this. (and changed some) Many thanks to John Tapsell and Stanislav Ionascu for help. (autotests were provided by them). My poor explanation did not convince Frederik 100%, but he is "convinced enough" :) Reviewed-by: Frederik Gladhorn --- src/gui/graphicsview/qgraphicslayout.cpp | 14 +- src/gui/graphicsview/qgraphicswidget.cpp | 16 +- src/gui/graphicsview/qgraphicswidget.h | 2 + src/gui/graphicsview/qgraphicswidget_p.cpp | 14 ++ src/gui/graphicsview/qgraphicswidget_p.h | 5 + tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp | 192 ++++++++++++++++++--- 6 files changed, 201 insertions(+), 42 deletions(-) diff --git a/src/gui/graphicsview/qgraphicslayout.cpp b/src/gui/graphicsview/qgraphicslayout.cpp index b37dfd4..f983955 100644 --- a/src/gui/graphicsview/qgraphicslayout.cpp +++ b/src/gui/graphicsview/qgraphicslayout.cpp @@ -269,18 +269,8 @@ void QGraphicsLayout::activate() return; Q_ASSERT(!parentItem->isLayout()); - if (QGraphicsLayout::instantInvalidatePropagation()) { - QGraphicsWidget *parentWidget = static_cast(parentItem); - if (!parentWidget->parentLayoutItem()) { - // we've reached the topmost widget, resize it - bool wasResized = parentWidget->testAttribute(Qt::WA_Resized); - parentWidget->resize(parentWidget->size()); - parentWidget->setAttribute(Qt::WA_Resized, wasResized); - } - - setGeometry(parentItem->contentsRect()); // relayout children - } else { - setGeometry(parentItem->contentsRect()); // relayout children + setGeometry(parentItem->contentsRect()); // relayout children + if (!QGraphicsLayout::instantInvalidatePropagation()) { parentLayoutItem()->updateGeometry(); } } diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 7048fcc..965b1b34 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -404,14 +404,7 @@ void QGraphicsWidget::setGeometry(const QRectF &rect) emit widthChanged(); if (oldSize.height() != newGeom.size().height()) emit heightChanged(); - QGraphicsLayout *lay = wd->layout; - if (QGraphicsLayout::instantInvalidatePropagation()) { - if (!lay || lay->isActivated()) { - QApplication::sendEvent(this, &re); - } - } else { - QApplication::sendEvent(this, &re); - } + QApplication::sendEvent(this, &re); } } @@ -1090,8 +1083,11 @@ void QGraphicsWidget::updateGeometry() * When the event is received, it will start flowing all the way down to the leaf * widgets in one go. This will make a relayout flicker-free. */ - if (QGraphicsLayout::instantInvalidatePropagation()) - QApplication::postEvent(static_cast(this), new QEvent(QEvent::LayoutRequest)); + if (QGraphicsLayout::instantInvalidatePropagation()) { + Q_D(QGraphicsWidget); + ++d->refCountInvokeRelayout; + QMetaObject::invokeMethod(this, "_q_relayout", Qt::QueuedConnection); + } } if (!QGraphicsLayout::instantInvalidatePropagation()) { bool wasResized = testAttribute(Qt::WA_Resized); diff --git a/src/gui/graphicsview/qgraphicswidget.h b/src/gui/graphicsview/qgraphicswidget.h index 063be2d..5085817 100644 --- a/src/gui/graphicsview/qgraphicswidget.h +++ b/src/gui/graphicsview/qgraphicswidget.h @@ -234,6 +234,8 @@ protected: private: Q_DISABLE_COPY(QGraphicsWidget) Q_DECLARE_PRIVATE_D(QGraphicsItem::d_ptr.data(), QGraphicsWidget) + Q_PRIVATE_SLOT(d_func(), void _q_relayout()) + friend class QGraphicsScene; friend class QGraphicsScenePrivate; friend class QGraphicsView; diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp index 059051e..dc0f7c0 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.cpp +++ b/src/gui/graphicsview/qgraphicswidget_p.cpp @@ -232,6 +232,18 @@ void QGraphicsWidgetPrivate::resolveLayoutDirection() } } +/* private slot */ +void QGraphicsWidgetPrivate::_q_relayout() +{ + --refCountInvokeRelayout; + if (refCountInvokeRelayout == 0) { + Q_Q(QGraphicsWidget); + bool wasResized = q->testAttribute(Qt::WA_Resized); + q->resize(q->size()); // this will restrict the size + q->setAttribute(Qt::WA_Resized, wasResized); + } +} + QPalette QGraphicsWidgetPrivate::naturalWidgetPalette() const { Q_Q(const QGraphicsWidget); @@ -897,4 +909,6 @@ void QGraphicsWidgetPrivate::setGeometryFromSetPos() QT_END_NAMESPACE +#include "moc_qgraphicswidget.cpp" + #endif //QT_NO_GRAPHICSVIEW diff --git a/src/gui/graphicsview/qgraphicswidget_p.h b/src/gui/graphicsview/qgraphicswidget_p.h index 398abc3..6ea2586 100644 --- a/src/gui/graphicsview/qgraphicswidget_p.h +++ b/src/gui/graphicsview/qgraphicswidget_p.h @@ -81,6 +81,7 @@ public: polished(0), inSetPos(0), autoFillBackground(0), + refCountInvokeRelayout(0), focusPolicy(Qt::NoFocus), focusNext(0), focusPrev(0), @@ -106,6 +107,7 @@ public: QGraphicsLayout *layout; void setLayoutDirection_helper(Qt::LayoutDirection direction); void resolveLayoutDirection(); + void _q_relayout(); // Style QPalette palette; @@ -179,11 +181,14 @@ public: return false; return (attributes & (1 << bit)) != 0; } + // 32 bits + quint32 refCountInvokeRelayout : 16; quint32 attributes : 10; quint32 inSetGeometry : 1; quint32 polished: 1; quint32 inSetPos : 1; quint32 autoFillBackground : 1; + quint32 padding : 2; // feel free to use // Focus Qt::FocusPolicy focusPolicy; diff --git a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp index 9411f97..cd91008 100644 --- a/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp +++ b/tests/auto/qgraphicslayout/tst_qgraphicslayout.cpp @@ -63,6 +63,12 @@ private slots: void automaticReparenting(); void verifyActivate(); void invalidate(); + void moveAndResize_data(); + void moveAndResize(); + void moveAndResizeWidgetInWidget_data(); + void moveAndResizeWidgetInWidget(); + void changingMinimumSize_data(); + void changingMinimumSize(); void invalidateAndMove_data(); void invalidateAndMove(); void constructors(); @@ -445,7 +451,7 @@ void tst_QGraphicsLayout::invalidate() QCoreApplication::sendPostedEvents(); QCOMPARE(a->eventCount(QEvent::LayoutRequest), 1); QCOMPARE(b->eventCount(QEvent::LayoutRequest), 0); - QCOMPARE(c->eventCount(QEvent::LayoutRequest), 1); + QCOMPARE(c->eventCount(QEvent::GraphicsSceneResize), 1); QCOMPARE(d->eventCount(QEvent::LayoutRequest), 0); QCOMPARE(a->functionCount[SetGeometry], 1); @@ -481,30 +487,18 @@ void tst_QGraphicsLayout::invalidate() QCOMPARE(c->eventCount(QEvent::LayoutRequest), 0); QCoreApplication::sendPostedEvents(); - QCOMPARE(a->eventCount(QEvent::LayoutRequest), 1); + QCOMPARE(a->eventCount(QEvent::GraphicsSceneResize), 1); QCOMPARE(b->eventCount(QEvent::LayoutRequest), 0); - QCOMPARE(c->eventCount(QEvent::LayoutRequest), 1); + QCOMPARE(c->eventCount(QEvent::GraphicsSceneResize), 1); QCOMPARE(d->eventCount(QEvent::LayoutRequest), 0); QCOMPARE(a->functionCount[SetGeometry], 1); - /* well, ideally one call to setGeometry(), but it will currently - * get two calls to setGeometry(): - * 1. The first LayoutRequest will call activate() - that will call - * setGeometry() on the layout. This geometry will be based on - * the widget geometry which is not correct at this moment. - * (it is still 150 wide) - * 2. Next, we check if the widget is top level, and then we call - * parentWidget->resize(parentWidget->size()); - * This will be adjusted to be minimum 200 pixels wide. - * The new size will then be propagated down to the layout - * - */ - QCOMPARE(alay->functionCount[SetGeometry], 2); - - QCOMPARE(b->functionCount[SetGeometry], 2); - QCOMPARE(c->functionCount[SetGeometry], 2); - QCOMPARE(d->functionCount[SetGeometry], 2); + QCOMPARE(alay->functionCount[SetGeometry], 1); + + QCOMPARE(b->functionCount[SetGeometry], 1); + QCOMPARE(c->functionCount[SetGeometry], 1); + QCOMPARE(d->functionCount[SetGeometry], 1); // f actually got wider, need to rearrange its siblings QCOMPARE(blay->functionCount[SetGeometry], 1); QCOMPARE(clay->functionCount[SetGeometry], 1); @@ -557,7 +551,165 @@ void tst_QGraphicsLayout::invalidate() QGraphicsLayout::setInstantInvalidatePropagation(false); } +void tst_QGraphicsLayout::changingMinimumSize_data() +{ + QTest::addColumn("instantInvalidatePropagation"); + QTest::newRow("Without instantInvalidatePropagation") << false; + QTest::newRow("With instantInvalidatePropagation") << true; +} +void tst_QGraphicsLayout::changingMinimumSize() +{ + QFETCH(bool, instantInvalidatePropagation); + QGraphicsLayout::setInstantInvalidatePropagation(instantInvalidatePropagation); + QGraphicsWidget *widget = new QGraphicsWidget; + qApp->processEvents(); + widget->setMinimumSize(300,300); + qApp->processEvents(); + QCOMPARE(widget->size(), QSizeF(300,300)); + QGraphicsLayout::setInstantInvalidatePropagation(false); +} + +struct WidgetToTestResizeEvents : public QGraphicsWidget +{ + virtual void resizeEvent ( QGraphicsSceneResizeEvent * event ) + { + QGraphicsWidget::resizeEvent(event); + resizeEventCalled = true; + } + + bool resizeEventCalled; +}; +void tst_QGraphicsLayout::moveAndResizeWidgetInWidget_data() +{ + QTest::addColumn("instantInvalidatePropagation"); + + QTest::newRow("Without instantInvalidatePropagation") << false; + QTest::newRow("With instantInvalidatePropagation") << true; +} +void tst_QGraphicsLayout::moveAndResizeWidgetInWidget() +{ + QFETCH(bool, instantInvalidatePropagation); + + QGraphicsLayout::setInstantInvalidatePropagation(instantInvalidatePropagation); + QGraphicsScene scene; + + QGraphicsWidget *widget = new QGraphicsWidget; + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(widget); + layout->setContentsMargins(0,0,0,0); + WidgetToTestResizeEvents *innerWidget = new WidgetToTestResizeEvents; + QGraphicsLinearLayout *innerLayout = new QGraphicsLinearLayout(innerWidget); + innerLayout->setContentsMargins(0,0,0,0); + QCOMPARE(widget->maximumSize(), QSizeF(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX)); + layout->addItem(innerWidget); + widget->setMinimumSize(1,1); + widget->setPreferredSize(1000,1000); + widget->setMaximumSize(2000,2000); + widget->resize(widget->preferredSize()); + innerWidget->setMinimumSize(1,1); + qApp->processEvents(); + innerWidget->resizeEventCalled = false; + + QCOMPARE(widget->size(), QSizeF(1000, 1000)); + QCOMPARE(layout->geometry().size(), QSizeF(1000, 1000)); + QCOMPARE(innerWidget->size(), QSizeF(1000, 1000)); + + innerLayout->invalidate(); + widget->setMaximumHeight(500); + widget->setX(1); + qApp->processEvents(); + QCOMPARE(widget->size(), QSizeF(1000, 500)); + QCOMPARE(innerWidget->size(), QSizeF(1000, 500)); + QVERIFY(innerWidget->resizeEventCalled); +} +void tst_QGraphicsLayout::moveAndResize_data() +{ + QTest::addColumn("instantInvalidatePropagation"); + QTest::addColumn("insideLayout"); + QTest::addColumn("insideLayoutInLayout"); + QTest::addColumn("insideWidget"); + QTest::newRow("Without instantInvalidatePropagation") << false << false << false << false; + QTest::newRow("With instantInvalidatePropagation") << true << false << false << false; + QTest::newRow("Without instantInvalidatePropagation, inside widget with no layout") << false << false << false << true; + QTest::newRow("With instantInvalidatePropagation, inside widget with no layout") << true << false << false << true; + QTest::newRow("Without instantInvalidatePropagation, inside widget with layout") << false << true << false << true; + QTest::newRow("With instantInvalidatePropagation, inside widget with layout") << true << true << false << true; + QTest::newRow("Without instantInvalidatePropagation, inside widget with layout in layout") << false << true << true << true; + QTest::newRow("With instantInvalidatePropagation, inside widget with layout in layout") << true << true << true << true; + +} +void tst_QGraphicsLayout::moveAndResize() +{ + QFETCH(bool, instantInvalidatePropagation); + QFETCH(bool, insideLayout); + QFETCH(bool, insideLayoutInLayout); + QFETCH(bool, insideWidget); + QGraphicsLayout::setInstantInvalidatePropagation(instantInvalidatePropagation); + QGraphicsScene scene; + + WidgetToTestResizeEvents *widget = new WidgetToTestResizeEvents; + + /* Setup its parent if we want them */ + QGraphicsWidget *parent = NULL; + if (insideWidget) + parent = new QGraphicsWidget; + if (insideLayout) { + QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(parent); + QGraphicsLinearLayout *innerLayout = NULL; + if (insideLayoutInLayout) { + innerLayout = new QGraphicsLinearLayout; + layout->addItem(innerLayout); + innerLayout->addItem(widget); + } else + layout->addItem(widget); + } else if (insideWidget) { + widget->setParentItem(parent); + } + + new QGraphicsLinearLayout(widget); + widget->setGeometry(0,0,100,100); + qApp->processEvents(); + widget->resizeEventCalled = false; + + /* Force it grow by changing the minimum size */ + widget->setMinimumSize(200,200); + qApp->processEvents(); + qApp->processEvents(); + qApp->processEvents(); + QCOMPARE(widget->size(), QSizeF(200,200)); + QVERIFY(widget->resizeEventCalled); + widget->resizeEventCalled = false; + + /* Call setPos followed by a resize. We should get a resize event */ + widget->setPos(10,10); + widget->resize(300,300); + qApp->processEvents(); + QVERIFY(widget->resizeEventCalled); + widget->resizeEventCalled = false; + + /* Check that just calling setGeometry gives us a resize event */ + widget->setGeometry(10,10, 400, 400); + qApp->processEvents(); + QVERIFY(widget->resizeEventCalled); + widget->resizeEventCalled = false; + + /* Now call setPos followed by increasing the size using setGeometry,*/ + widget->setPos(30,30); + widget->setGeometry(10,10, 500, 500); + qApp->processEvents(); + QVERIFY(widget->resizeEventCalled); + widget->resizeEventCalled = false; + + /* Now call setPos followed by increasing the minimum size, to force it to grow */ + widget->setMinimumSize(600,600); + widget->setPos(30,30); + qApp->processEvents(); + QCOMPARE(widget->size(), QSizeF(600,600)); + QVERIFY(widget->resizeEventCalled); + widget->resizeEventCalled = false; + + QGraphicsLayout::setInstantInvalidatePropagation(false); +} void tst_QGraphicsLayout::invalidateAndMove_data() { QTest::addColumn("instantInvalidatePropagation"); -- cgit v0.12 From b9664d5aecc05f63ef705962f4d92155fb0ce0bf Mon Sep 17 00:00:00 2001 From: Martin Pejcoch Date: Thu, 9 Jun 2011 17:26:22 +0200 Subject: Fixing OpenGL module build error on Solaris MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Even though the code was correct, the CC 5.9 compiler was producing an error. Task-number: QTBUG-19641 Reviewed by: Kim Motoyoshi Kalland Reviewed by: Samuel Rødal --- src/opengl/gl2paintengineex/qtriangulator.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulator.cpp b/src/opengl/gl2paintengineex/qtriangulator.cpp index 7c3be2b..5293eff 100644 --- a/src/opengl/gl2paintengineex/qtriangulator.cpp +++ b/src/opengl/gl2paintengineex/qtriangulator.cpp @@ -1309,6 +1309,9 @@ inline void QRingBuffer::enqueue(const T &x) //============================================================================// // QTriangulator // //============================================================================// + +typedef QRBTree::Node *QRBTreeIntNodePointer; + template class QTriangulator { @@ -1775,7 +1778,7 @@ bool QTriangulator::ComplexToSimple::edgeIsLeftOfEdge(int leftEdgeIndex, int } template -QRBTree::Node *QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edgeIndex) const +QRBTreeIntNodePointer QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edgeIndex) const { QRBTree::Node *current = m_edgeList.root; QRBTree::Node *result = 0; @@ -1791,7 +1794,7 @@ QRBTree::Node *QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edge } template -QRBTree::Node *QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edgeIndex, QRBTree::Node *after) const +QRBTreeIntNodePointer QTriangulator::ComplexToSimple::searchEdgeLeftOf(int edgeIndex, QRBTree::Node *after) const { if (!m_edgeList.root) return after; -- cgit v0.12