From 933e74473a23c0090eaaae9c6122a0e0d192df15 Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Tue, 22 Sep 2009 16:24:07 -0300 Subject: QGraphicsAnchorLayout: add autotests for QSizePolicy::ExpandFlag Add autotests that use the ExpandFlag via QSizePolicy::Expanding policy. Those tests cover the simple cases and behaviours with sequential and parallel anchor setups. Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Jesus Sanchez-Palencia --- .../tst_qgraphicsanchorlayout.cpp | 214 +++++++++++++++++++++ 1 file changed, 214 insertions(+) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 9f13aca..e898edb 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -69,6 +69,9 @@ private slots: void delete_anchor(); void conflicts(); void sizePolicy(); + void expandingSequence(); + void expandingSequenceFairDistribution(); + void expandingParallel(); }; class RectWidget : public QGraphicsWidget @@ -586,6 +589,20 @@ void tst_QGraphicsAnchorLayout::snake() QCOMPARE(b->geometry(), QRectF(90.0, 100.0, 10.0, 100.0)); QCOMPARE(c->geometry(), QRectF(90.0, 200.0, 100.0, 100.0)); QCOMPARE(p.size(), layoutMaximumSize); + + QVERIFY(layoutHasConflict(l) == false); + + // Test QSizePolicy::ExpandFlag, it shouldn't change the extreme + // points of the layout... + b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + + QSizeF newLayoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); + QSizeF newLayoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); + QSizeF newLayoutPreferredSize = l->effectiveSizeHint(Qt::PreferredSize); + + QCOMPARE(layoutMinimumSize, newLayoutMinimumSize); + QCOMPARE(layoutMaximumSize, newLayoutMaximumSize); + QCOMPARE(layoutPreferredSize, newLayoutPreferredSize); } void tst_QGraphicsAnchorLayout::snakeOppositeDirections() @@ -1308,5 +1325,202 @@ void tst_QGraphicsAnchorLayout::conflicts() delete p; } +void tst_QGraphicsAnchorLayout::expandingSequence() +{ + QSizeF min(10, 10); + QSizeF pref(50, 10); + QSizeF max(100, 10); + + QGraphicsWidget *a = createItem(min, pref, max, "a"); + QGraphicsWidget *b = createItem(min, pref, max, "b"); + + b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; + l->setContentsMargins(0, 0, 0, 0); + + // horizontal + setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); + setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0); + setAnchor(l, b, Qt::AnchorRight, l, Qt::AnchorRight, 0); + + // vertical + l->addAnchors(l, a, Qt::Vertical); + l->addAnchors(l, b, Qt::Vertical); + + QCOMPARE(l->count(), 2); + + QGraphicsWidget p; + p.setLayout(l); + + QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); + QCOMPARE(layoutMinimumSize.width(), qreal(20)); + + QSizeF layoutExpandedSize(pref.width() + max.width(), layoutMinimumSize.height()); + p.resize(layoutExpandedSize); + + QEXPECT_FAIL("", "Support for QSizePolicy::ExpandFlag not yet available", Abort); + QCOMPARE(a->geometry().size(), pref); + QCOMPARE(b->geometry().size(), max); + + QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); + QCOMPARE(layoutMaximumSize.width(), qreal(200)); +} + +void tst_QGraphicsAnchorLayout::expandingSequenceFairDistribution() +{ + QSizeF min(10, 10); + QSizeF pref(50, 10); + QSizeF max(100, 10); + + QGraphicsWidget *a = createItem(min, pref, max, "a"); + QGraphicsWidget *b = createItem(min, pref, max, "b"); + QGraphicsWidget *c = createItem(min, pref, max, "c"); + QGraphicsWidget *d = createItem(min, pref, max, "d"); + + b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + d->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; + l->setContentsMargins(0, 0, 0, 0); + + // horizontal + setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); + setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft, 0); + setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0); + setAnchor(l, c, Qt::AnchorRight, d, Qt::AnchorLeft, 0); + setAnchor(l, d, Qt::AnchorRight, l, Qt::AnchorRight, 0); + + // vertical + l->addAnchors(l, a, Qt::Vertical); + l->addAnchors(l, b, Qt::Vertical); + l->addAnchors(l, c, Qt::Vertical); + l->addAnchors(l, d, Qt::Vertical); + + QCOMPARE(l->count(), 4); + + QGraphicsWidget p; + p.setLayout(l); + + QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); + QCOMPARE(layoutMinimumSize.width(), qreal(40)); + + QSizeF layoutPartialExpandedSize((2 * pref.width()) + (2 * (pref.width() + 10)), + layoutMinimumSize.height()); + p.resize(layoutPartialExpandedSize); + + QEXPECT_FAIL("", "Support for QSizePolicy::ExpandFlag not yet available", Abort); + QCOMPARE(a->geometry().size(), pref); + QCOMPARE(b->geometry().size(), pref + QSizeF(10, 0)); + QCOMPARE(c->geometry().size(), pref); + QCOMPARE(d->geometry().size(), pref + QSizeF(10, 0)); + + QSizeF layoutExpandedSize((2 * pref.width()) + (2 * max.width()), + layoutMinimumSize.height()); + p.resize(layoutExpandedSize); + + QCOMPARE(a->geometry().size(), pref); + QCOMPARE(b->geometry().size(), max); + QCOMPARE(c->geometry().size(), pref); + QCOMPARE(d->geometry().size(), max); + + QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); + QCOMPARE(layoutMaximumSize.width(), qreal(400)); + + // Now we change D to have more "room for growth" from its preferred size + // to its maximum size. We expect a proportional fair distribution. Note that + // this seems to not conform with what QGraphicsLinearLayout does. + d->setMaximumSize(QSizeF(150, 10)); + + QSizeF newLayoutExpandedSize((2 * pref.width()) + (max.width() + 150), + layoutMinimumSize.height()); + p.resize(newLayoutExpandedSize); + + QCOMPARE(a->geometry().size(), pref); + QCOMPARE(b->geometry().size(), max); + QCOMPARE(c->geometry().size(), pref); + QCOMPARE(d->geometry().size(), QSizeF(150, 10)); + + QSizeF newLayoutPartialExpandedSize((4 * pref.width()) + 75, + layoutMinimumSize.height()); + + QCOMPARE(a->geometry().size(), pref); + QCOMPARE(b->geometry().size(), pref + QSizeF(25, 0)); + QCOMPARE(c->geometry().size(), pref); + QCOMPARE(d->geometry().size(), pref + QSizeF(50, 0)); +} + +void tst_QGraphicsAnchorLayout::expandingParallel() +{ + QSizeF min(10, 10); + QSizeF pref(50, 10); + QSizeF max(100, 50); + + QGraphicsWidget *a = createItem(min, pref, max, "a"); + QGraphicsWidget *b = createItem(min, pref, max, "b"); + QGraphicsWidget *c = createItem(min, pref, max, "c"); + + b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); + + QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; + l->setContentsMargins(0, 0, 0, 0); + + // horizontal + setAnchor(l, l, Qt::AnchorLeft, a, Qt::AnchorLeft, 0); + setAnchor(l, l, Qt::AnchorLeft, b, Qt::AnchorLeft, 0); + + setAnchor(l, a, Qt::AnchorRight, c, Qt::AnchorLeft, 0); + setAnchor(l, b, Qt::AnchorRight, c, Qt::AnchorLeft, 0); + + setAnchor(l, c, Qt::AnchorRight, l, Qt::AnchorRight, 0); + + // vertical + l->addAnchors(l, c, Qt::Vertical); + setAnchor(l, l, Qt::AnchorTop, a, Qt::AnchorTop, 0); + setAnchor(l, a, Qt::AnchorBottom, c, Qt::AnchorVerticalCenter, 0); + setAnchor(l, b, Qt::AnchorTop, c, Qt::AnchorVerticalCenter, 0); + setAnchor(l, b, Qt::AnchorBottom, l, Qt::AnchorBottom, 0); + + QCOMPARE(l->count(), 3); + + QGraphicsWidget p; + p.setLayout(l); + + QSizeF layoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); + QCOMPARE(layoutMinimumSize.width(), qreal(20)); + + QSizeF layoutExpandedSize(pref.width() + max.width(), layoutMinimumSize.height()); + p.resize(layoutExpandedSize); + + QEXPECT_FAIL("", "Support for QSizePolicy::ExpandFlag not yet available", Abort); + QCOMPARE(a->geometry().size(), max); + QCOMPARE(b->geometry().size(), max); + QCOMPARE(c->geometry().size(), pref); + + QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); + QCOMPARE(layoutMaximumSize.width(), qreal(200)); + + // + // Change the parallel connection to a paralell connection of b with a center... + // + QGraphicsAnchor *anchor = l->anchor(b, Qt::AnchorRight, c, Qt::AnchorLeft); + delete anchor; + setAnchor(l, b, Qt::AnchorRight, a, Qt::AnchorHorizontalCenter, 0); + a->setMaximumSize(max + QSizeF(100, 0)); + + QSizeF newLayoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); + QCOMPARE(newLayoutMinimumSize.width(), qreal(30)); + + QSizeF newLayoutExpandedSize(pref.width() + max.width(), layoutMinimumSize.height()); + p.resize(newLayoutExpandedSize); + + QCOMPARE(a->geometry().size(), max); + QCOMPARE(b->geometry().size(), max); + QCOMPARE(c->geometry().size(), pref); + + QSizeF newLayoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); + QCOMPARE(newLayoutMaximumSize.width(), qreal(300)); +} + QTEST_MAIN(tst_QGraphicsAnchorLayout) #include "tst_qgraphicsanchorlayout.moc" -- cgit v0.12 From bfc1a75616e1c96a018349084fae844d7efbc177 Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Tue, 22 Sep 2009 14:20:10 -0300 Subject: QGraphicsAnchorLayout: Add data structures for Expanding size policy Adding required members for the upcoming support of the QSizePolicy::Expand flag. In this state, running with simplification will probably not work. Signed-off-by: Eduardo M. Fleury Reviewed-by: Artur Duque de Souza --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 44 +++++++++++++++++++----- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 20 ++++++++--- 2 files changed, 51 insertions(+), 13 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index f75118b..fc3bc8a 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -94,7 +94,9 @@ qreal QGraphicsAnchorPrivate::spacing() const void AnchorData::refreshSizeHints(qreal effectiveSpacing) { - if (!isLayoutAnchor && from->m_item == to->m_item) { + isExpanding = 0; + + if (!isLayoutAnchor && (from->m_item == to->m_item)) { QGraphicsLayoutItem *item = from->m_item; const QGraphicsAnchorLayoutPrivate::Orientation orient = QGraphicsAnchorLayoutPrivate::edgeOrientation(from->m_edge); @@ -138,6 +140,9 @@ void AnchorData::refreshSizeHints(qreal effectiveSpacing) if (policy & QSizePolicy::IgnoreFlag) prefSize = minSize; + if (policy & QSizePolicy::ExpandFlag) + isExpanding = 1; + bool hasCenter = (from->m_edge == centerEdge || to->m_edge == centerEdge); if (hasCenter) { @@ -155,6 +160,7 @@ void AnchorData::refreshSizeHints(qreal effectiveSpacing) // recalculate and override the values we set here. sizeAtMinimum = prefSize; sizeAtPreferred = prefSize; + sizeAtExpanding = prefSize; sizeAtMaximum = prefSize; } else if (!hasSize) { @@ -165,6 +171,7 @@ void AnchorData::refreshSizeHints(qreal effectiveSpacing) sizeAtMinimum = prefSize; sizeAtPreferred = prefSize; + sizeAtExpanding = prefSize; sizeAtMaximum = prefSize; } } @@ -357,6 +364,12 @@ QGraphicsAnchorLayoutPrivate::QGraphicsAnchorLayoutPrivate() : calculateGraphCacheDirty(1) { for (int i = 0; i < NOrientations; ++i) { + for (int j = 0; j < 3; ++j) { + sizeHints[i][j] = -1; + } + sizeAtExpanding[i] = -1; + interpolationProgress[i] = -1; + spacings[i] = -1; graphSimplified[i] = false; graphHasConflicts[i] = false; @@ -1649,6 +1662,10 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( sizeHints[orientation][Qt::PreferredSize] = pref; sizeHints[orientation][Qt::MaximumSize] = max; + // XXX implement Expanding simplex + for (int i = 0; i < trunkVariables.count(); ++i) + trunkVariables.at(i)->sizeAtExpanding = trunkVariables.at(i)->sizeAtPreferred; + sizeAtExpanding[orientation] = pref; } } else { #if 0 @@ -1664,6 +1681,7 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( AnchorData *ad = trunkPath.positives.toList()[0]; ad->sizeAtMinimum = ad->minSize; ad->sizeAtPreferred = ad->prefSize; + ad->sizeAtExpanding = ad->prefSize; ad->sizeAtMaximum = ad->maxSize; // Propagate @@ -1672,6 +1690,7 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( sizeHints[orientation][Qt::MinimumSize] = ad->sizeAtMinimum; sizeHints[orientation][Qt::PreferredSize] = ad->sizeAtPreferred; sizeHints[orientation][Qt::MaximumSize] = ad->sizeAtMaximum; + sizeAtExpanding[orientation] = ad->sizeAtPreferred; } // Delete the constraints, we won't use them anymore. @@ -1701,6 +1720,7 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( AnchorData *ad = partVariables[j]; Q_ASSERT(ad); ad->sizeAtMinimum = ad->sizeAtPreferred; + ad->sizeAtExpanding = ad->sizeAtPreferred; ad->sizeAtMaximum = ad->sizeAtPreferred; ad->updateChildrenSizes(); } @@ -2058,9 +2078,13 @@ void QGraphicsAnchorLayoutPrivate::setupEdgesInterpolation( interpolationInterval[orientation] = MinToPreferred; lower = sizeHints[orientation][Qt::MinimumSize]; upper = sizeHints[orientation][Qt::PreferredSize]; - } else { - interpolationInterval[orientation] = PreferredToMax; + } else if (current < sizeAtExpanding[orientation]) { + interpolationInterval[orientation] = PreferredToExpanding; lower = sizeHints[orientation][Qt::PreferredSize]; + upper = sizeAtExpanding[orientation]; + } else { + interpolationInterval[orientation] = ExpandingToMax; + lower = sizeAtExpanding[orientation]; upper = sizeHints[orientation][Qt::MaximumSize]; } @@ -2075,11 +2099,12 @@ void QGraphicsAnchorLayoutPrivate::setupEdgesInterpolation( \internal Calculate the current Edge size based on the current Layout size and the - size the edge is supposed to have when: + size the edge is supposed to have when the layout is at its: - - the layout is at its minimum size. - - the layout is at its preferred size. - - the layout is at its maximum size. + - minimum size, + - preferred size, + - size when all expanding anchors are expanded, + - maximum size. These three key values are calculated in advance using linear programming (more expensive) or the simplification algorithm, then @@ -2099,8 +2124,11 @@ void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base, if (interpolationInterval[orientation] == MinToPreferred) { lower = edge->sizeAtMinimum; upper = edge->sizeAtPreferred; - } else { + } else if (interpolationInterval[orientation] == PreferredToExpanding) { lower = edge->sizeAtPreferred; + upper = edge->sizeAtExpanding; + } else { + lower = edge->sizeAtExpanding; upper = edge->sizeAtMaximum; } diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index c86bfa3..4c6c2aa 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -153,7 +153,8 @@ struct AnchorData : public QSimplexVariable { : QSimplexVariable(), from(0), to(0), minSize(minimumSize), prefSize(preferredSize), maxSize(maximumSize), sizeAtMinimum(preferredSize), - sizeAtPreferred(preferredSize), sizeAtMaximum(preferredSize), + sizeAtPreferred(preferredSize), sizeAtExpanding(preferredSize), + sizeAtMaximum(preferredSize), graphicsAnchor(0), skipInPreferred(0), type(Normal), hasSize(true), isLayoutAnchor(false) {} @@ -161,7 +162,8 @@ struct AnchorData : public QSimplexVariable { AnchorData(qreal size) : QSimplexVariable(), from(0), to(0), minSize(size), prefSize(size), maxSize(size), - sizeAtMinimum(size), sizeAtPreferred(size), sizeAtMaximum(size), + sizeAtMinimum(size), sizeAtPreferred(size), sizeAtExpanding(size), + sizeAtMaximum(size), graphicsAnchor(0), skipInPreferred(0), type(Normal), hasSize(true), isLayoutAnchor(false) {} @@ -169,7 +171,8 @@ struct AnchorData : public QSimplexVariable { AnchorData() : QSimplexVariable(), from(0), to(0), minSize(0), prefSize(0), maxSize(0), - sizeAtMinimum(0), sizeAtPreferred(0), sizeAtMaximum(0), + sizeAtMinimum(0), sizeAtPreferred(0), sizeAtExpanding(0), + sizeAtMaximum(0), graphicsAnchor(0), skipInPreferred(0), type(Normal), hasSize(false), isLayoutAnchor(false) {} @@ -192,6 +195,7 @@ struct AnchorData : public QSimplexVariable { maxSize = size; sizeAtMinimum = size; sizeAtPreferred = size; + sizeAtExpanding = size; sizeAtMaximum = size; hasSize = true; } @@ -218,6 +222,7 @@ struct AnchorData : public QSimplexVariable { // calculated by the Simplex solver based on the current layout setup. qreal sizeAtMinimum; qreal sizeAtPreferred; + qreal sizeAtExpanding; qreal sizeAtMaximum; QGraphicsAnchor *graphicsAnchor; @@ -225,12 +230,15 @@ struct AnchorData : public QSimplexVariable { uint type : 2; // either Normal, Sequential or Parallel uint hasSize : 1; // if false, get size from style. uint isLayoutAnchor : 1; // if this anchor is connected to a layout 'edge' + uint isExpanding : 1; // if true, expands before other anchors + protected: AnchorData(Type type, qreal size = 0) : QSimplexVariable(), from(0), to(0), minSize(size), prefSize(size), maxSize(size), sizeAtMinimum(size), - sizeAtPreferred(size), sizeAtMaximum(size), + sizeAtPreferred(size), sizeAtExpanding(size), + sizeAtMaximum(size), graphicsAnchor(0), skipInPreferred(0), type(type), hasSize(true), isLayoutAnchor(false) {} @@ -355,7 +363,8 @@ public: // Interval represents which interpolation interval are we operating in. enum Interval { MinToPreferred = 0, - PreferredToMax + PreferredToExpanding, + ExpandingToMax }; // Several structures internal to the layout are duplicated to handle @@ -496,6 +505,7 @@ public: qreal spacings[NOrientations]; // Size hints from simplex engine qreal sizeHints[2][3]; + qreal sizeAtExpanding[2]; // Items QVector items; -- cgit v0.12 From 1728f846d9fb53a699782005d6478c0f23f9b82e Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Wed, 23 Sep 2009 16:02:35 -0300 Subject: QGraphicsAnchorLayout: Enabling Simplex support for Expanding size policy To support the expanding size policy we had to change the way the setup process work. Previously we used to calculate three key-frames using the simplex solver: - sizeAtMinimum: the value an anchor should be in when the layout is at its minimum size. Calculated using simplex solver to minimize the layout size. - sizeAtPreferred: the value an anchor should be in when the layout is at its preferred size. Calculated using simplex solver to minimize the deviation from the items preferred sizes. - sizeAtMaximum: the value an anchor should be in when the layout is at its maximum size. Calculated using simplex solver to maximize the layout size. That worked fine but didn't diferentiate standard items from the "expanding" ones. In other words, all items would grow from their sizeAtPreferred to their sizeAtMaximum at the same rate. To support the idea of "expanding" items, ie. items that should grow faster than the others, we added a fourth state, between preferred and maximum. Now we have the following interpolation order: sizeAtMinimum -> sizeAtPreferred -> sizeAtExpanding -> sizeAtMaximum. The definition of the "expanding" state is that all "expanding" items should have grown all the way to their "sizeAtMaximum" values whereas non expanding items should have kept their preferred sizes. The only exception is that non-expanding items are allowed to grow if that is necessary to allow the "expanding" items to reach their sizeAtMaximum. So, the visual result is that if the layout is resized from its preferred size to its maximum size, the expanding items will grow first and then, in a second phase, the other items will grow. This commit adds QGALPrivate::solveExpanding() and calls it from calculateGraphs(). Signed-off-by: Eduardo M. Fleury Reviewed-by: Artur Duque de Souza --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 98 +++++++++++++++++++++--- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 1 + 2 files changed, 88 insertions(+), 11 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index fc3bc8a..93ccf83 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -1635,11 +1635,18 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( qreal min, max; feasible = solveMinMax(trunkConstraints, trunkPath, &min, &max); - // Solve for preferred. The objective function is calculated from the constraints - // and variables internally. - feasible &= solvePreferred(trunkConstraints); - if (feasible) { + // Solve for preferred. The objective function is calculated from the constraints + // and variables internally. + solvePreferred(trunkConstraints); + + // remove sizeHintConstraints from trunkConstraints + trunkConstraints = parts[0]; + + // Solve for expanding. The objective function and the constraints from items + // are calculated internally. + solveExpanding(trunkConstraints); + // Propagate the new sizes down the simplified graph, ie. tell the // group anchors to set their children anchors sizes. @@ -1649,23 +1656,23 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( for (int i = 0; i < trunkVariables.count(); ++i) trunkVariables.at(i)->updateChildrenSizes(); - // Calculate and set the preferred size for the layout from the edge sizes that - // were calculated above. + // Calculate and set the preferred and expanding sizes for the layout, + // from the edge sizes that were calculated above. qreal pref(0.0); + qreal expanding(0.0); foreach (const AnchorData *ad, trunkPath.positives) { pref += ad->sizeAtPreferred; + expanding += ad->sizeAtExpanding; } foreach (const AnchorData *ad, trunkPath.negatives) { pref -= ad->sizeAtPreferred; + expanding -= ad->sizeAtExpanding; } + sizeHints[orientation][Qt::MinimumSize] = min; sizeHints[orientation][Qt::PreferredSize] = pref; sizeHints[orientation][Qt::MaximumSize] = max; - - // XXX implement Expanding simplex - for (int i = 0; i < trunkVariables.count(); ++i) - trunkVariables.at(i)->sizeAtExpanding = trunkVariables.at(i)->sizeAtPreferred; - sizeAtExpanding[orientation] = pref; + sizeAtExpanding[orientation] = expanding; } } else { #if 0 @@ -2315,6 +2322,75 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(QList co return feasible; } +void QGraphicsAnchorLayoutPrivate::solveExpanding(QList constraints) +{ + QList variables = getVariables(constraints); + QList itemConstraints; + QSimplexConstraint *objective = new QSimplexConstraint; + + // Use all items that belong to trunk to: + // - add solveExpanding-specific item constraints + // - create the objective function + for (int i = 0; i < variables.size(); ++i) { + AnchorData *ad = variables[i]; + if (ad->isExpanding) { + // Add constraint to lock expanding anchor in its sizeAtMaximum + QSimplexConstraint *itemC = new QSimplexConstraint; + itemC->ratio = QSimplexConstraint::Equal; + itemC->variables.insert(ad, 1.0); + itemC->constant = ad->sizeAtMaximum; + itemConstraints << itemC; + } else { + // Add constraints to lock anchor between their sizeAtPreferred and sizeAtMaximum + QSimplexConstraint *itemC = new QSimplexConstraint; + itemC->ratio = QSimplexConstraint::MoreOrEqual; + itemC->variables.insert(ad, 1.0); + itemC->constant = qMin(ad->sizeAtPreferred, ad->sizeAtMaximum); + itemConstraints << itemC; + + itemC = new QSimplexConstraint; + itemC->ratio = QSimplexConstraint::LessOrEqual; + itemC->variables.insert(ad, 1.0); + itemC->constant = qMax(ad->sizeAtPreferred, ad->sizeAtMaximum); + itemConstraints << itemC; + + // Add anchor to objective function + if (ad->sizeAtPreferred < ad->sizeAtMaximum) { + // Try to shrink this variable towards its sizeAtPreferred value + objective->variables.insert(ad, 1.0); + } else { + // Try to grow this variable towards its sizeAtPreferred value + objective->variables.insert(ad, -1.0); + } + } + } + + // Solve + if (objective->variables.size() == variables.size()) { + // If no anchors are expanding, we don't need to run the simplex + // Set all variables to their preferred size + for (int i = 0; i < variables.size(); ++i) { + variables[i]->sizeAtExpanding = variables[i]->sizeAtPreferred; + } + } else { + // Run simplex + QSimplex simplex; + bool feasible = simplex.setConstraints(constraints + itemConstraints); + Q_ASSERT(feasible); + + simplex.setObjective(objective); + simplex.solveMin(); + + // Collect results + for (int i = 0; i < variables.size(); ++i) { + variables[i]->sizeAtExpanding = variables[i]->result; + } + } + + delete objective; + qDeleteAll(itemConstraints); +} + /*! \internal Returns true if there are no arrangement that satisfies all constraints. diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 4c6c2aa..47df786 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -495,6 +495,7 @@ public: bool solveMinMax(QList constraints, GraphPath path, qreal *min, qreal *max); bool solvePreferred(QList constraints); + void solveExpanding(QList constraints); bool hasConflicts() const; #ifdef QT_DEBUG -- cgit v0.12 From e210bea72ef65f99babb4c6f5bd442184c671d3b Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Thu, 24 Sep 2009 11:16:16 -0300 Subject: QGraphicsAnchorLayout Tests: Enable expanding tests Removing QEXPECT_FAIL and making minor corrections on expected values. Signed-off-by: Eduardo M. Fleury Reviewed-by: Artur Duque de Souza --- .../qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index e898edb..4ad48c7 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -1359,7 +1359,6 @@ void tst_QGraphicsAnchorLayout::expandingSequence() QSizeF layoutExpandedSize(pref.width() + max.width(), layoutMinimumSize.height()); p.resize(layoutExpandedSize); - QEXPECT_FAIL("", "Support for QSizePolicy::ExpandFlag not yet available", Abort); QCOMPARE(a->geometry().size(), pref); QCOMPARE(b->geometry().size(), max); @@ -1409,7 +1408,6 @@ void tst_QGraphicsAnchorLayout::expandingSequenceFairDistribution() layoutMinimumSize.height()); p.resize(layoutPartialExpandedSize); - QEXPECT_FAIL("", "Support for QSizePolicy::ExpandFlag not yet available", Abort); QCOMPARE(a->geometry().size(), pref); QCOMPARE(b->geometry().size(), pref + QSizeF(10, 0)); QCOMPARE(c->geometry().size(), pref); @@ -1443,6 +1441,7 @@ void tst_QGraphicsAnchorLayout::expandingSequenceFairDistribution() QSizeF newLayoutPartialExpandedSize((4 * pref.width()) + 75, layoutMinimumSize.height()); + p.resize(newLayoutPartialExpandedSize); QCOMPARE(a->geometry().size(), pref); QCOMPARE(b->geometry().size(), pref + QSizeF(25, 0)); @@ -1454,11 +1453,12 @@ void tst_QGraphicsAnchorLayout::expandingParallel() { QSizeF min(10, 10); QSizeF pref(50, 10); - QSizeF max(100, 50); + QSizeF max(100, 10); + QSizeF max2(100, 50); QGraphicsWidget *a = createItem(min, pref, max, "a"); QGraphicsWidget *b = createItem(min, pref, max, "b"); - QGraphicsWidget *c = createItem(min, pref, max, "c"); + QGraphicsWidget *c = createItem(min, pref, max2, "c"); b->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); @@ -1492,10 +1492,9 @@ void tst_QGraphicsAnchorLayout::expandingParallel() QSizeF layoutExpandedSize(pref.width() + max.width(), layoutMinimumSize.height()); p.resize(layoutExpandedSize); - QEXPECT_FAIL("", "Support for QSizePolicy::ExpandFlag not yet available", Abort); QCOMPARE(a->geometry().size(), max); QCOMPARE(b->geometry().size(), max); - QCOMPARE(c->geometry().size(), pref); + QCOMPARE(c->geometry().size(), QSizeF(pref.width(), 20)); QSizeF layoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); QCOMPARE(layoutMaximumSize.width(), qreal(200)); @@ -1511,12 +1510,12 @@ void tst_QGraphicsAnchorLayout::expandingParallel() QSizeF newLayoutMinimumSize = l->effectiveSizeHint(Qt::MinimumSize); QCOMPARE(newLayoutMinimumSize.width(), qreal(30)); - QSizeF newLayoutExpandedSize(pref.width() + max.width(), layoutMinimumSize.height()); + QSizeF newLayoutExpandedSize = layoutExpandedSize + QSizeF(100, 0); p.resize(newLayoutExpandedSize); - QCOMPARE(a->geometry().size(), max); + QCOMPARE(a->geometry().size(), max + QSizeF(100, 0)); QCOMPARE(b->geometry().size(), max); - QCOMPARE(c->geometry().size(), pref); + QCOMPARE(c->geometry().size(), QSizeF(pref.width(), 20)); QSizeF newLayoutMaximumSize = l->effectiveSizeHint(Qt::MaximumSize); QCOMPARE(newLayoutMaximumSize.width(), qreal(300)); -- cgit v0.12 From 5dd77be3acfb53b44d7d6b0015af0c33124ab84a Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Thu, 24 Sep 2009 17:09:16 -0300 Subject: QGraphicsAnchorLayout: cleaning up AnchorData Use just one constructor for AnchorData and tweak the struct when necessary. Also use the function refreshSizeHints() for Normal anchors to get the item information instead of passing to the constructor. This has the advantage that we don't need to replicate the code for checking and updating the size hint and size policies. Note that the code before only considered the size policies after the first refreshSizeHints() -- which we know will be called after the simplification, so the assumption seems to be correct, but we don't depend on that anymore.. Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Eduardo M. Fleury --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 89 ++++++++++++------------ src/gui/graphicsview/qgraphicsanchorlayout_p.h | 53 ++++---------- 2 files changed, 59 insertions(+), 83 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 93ccf83..dc8d211 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -94,8 +94,6 @@ qreal QGraphicsAnchorPrivate::spacing() const void AnchorData::refreshSizeHints(qreal effectiveSpacing) { - isExpanding = 0; - if (!isLayoutAnchor && (from->m_item == to->m_item)) { QGraphicsLayoutItem *item = from->m_item; @@ -140,9 +138,6 @@ void AnchorData::refreshSizeHints(qreal effectiveSpacing) if (policy & QSizePolicy::IgnoreFlag) prefSize = minSize; - if (policy & QSizePolicy::ExpandFlag) - isExpanding = 1; - bool hasCenter = (from->m_edge == centerEdge || to->m_edge == centerEdge); if (hasCenter) { @@ -151,6 +146,14 @@ void AnchorData::refreshSizeHints(qreal effectiveSpacing) maxSize /= 2; } + if (policy & QSizePolicy::ExpandFlag) { + isExpanding = 1; + expSize = maxSize; + } else { + isExpanding = 0; + expSize = prefSize; + } + // Set the anchor effective sizes to preferred. // // Note: The idea here is that all items should remain at their @@ -167,8 +170,11 @@ void AnchorData::refreshSizeHints(qreal effectiveSpacing) // Anchor has no size defined, use given default information minSize = effectiveSpacing; prefSize = effectiveSpacing; + expSize = effectiveSpacing; maxSize = effectiveSpacing; + isExpanding = 0; + sizeAtMinimum = prefSize; sizeAtPreferred = prefSize; sizeAtExpanding = prefSize; @@ -830,9 +836,10 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges() QGraphicsLayoutItem *layout = q; // Horizontal - AnchorData *data = new AnchorData(0, 0, QWIDGETSIZE_MAX); + AnchorData *data = new AnchorData; addAnchor_helper(layout, Qt::AnchorLeft, layout, - Qt::AnchorRight, data); + Qt::AnchorRight, data); + data->maxSize = QWIDGETSIZE_MAX; data->skipInPreferred = 1; // Set the Layout Left edge as the root of the horizontal graph. @@ -840,9 +847,10 @@ void QGraphicsAnchorLayoutPrivate::createLayoutEdges() graph[Horizontal].setRootVertex(v); // Vertical - data = new AnchorData(0, 0, QWIDGETSIZE_MAX); + data = new AnchorData; addAnchor_helper(layout, Qt::AnchorTop, layout, - Qt::AnchorBottom, data); + Qt::AnchorBottom, data); + data->maxSize = QWIDGETSIZE_MAX; data->skipInPreferred = 1; // Set the Layout Top edge as the root of the vertical graph. @@ -869,19 +877,15 @@ void QGraphicsAnchorLayoutPrivate::createItemEdges(QGraphicsLayoutItem *item) items.append(item); - QSizeF minSize = item->effectiveSizeHint(Qt::MinimumSize); - QSizeF prefSize = item->effectiveSizeHint(Qt::PreferredSize); - QSizeF maxSize = item->effectiveSizeHint(Qt::MaximumSize); - - // Horizontal - AnchorData *data = new AnchorData(minSize.width(), prefSize.width(), maxSize.width()); - addAnchor_helper(item, Qt::AnchorLeft, item, - Qt::AnchorRight, data); + // Create horizontal and vertical internal anchors for the item and + // refresh its size hint / policy values. + AnchorData *data = new AnchorData; + addAnchor_helper(item, Qt::AnchorLeft, item, Qt::AnchorRight, data); + data->refreshSizeHints(0); // 0 = effectiveSpacing, will not be used - // Vertical - data = new AnchorData(minSize.height(), prefSize.height(), maxSize.height()); - addAnchor_helper(item, Qt::AnchorTop, item, - Qt::AnchorBottom, data); + data = new AnchorData; + addAnchor_helper(item, Qt::AnchorTop, item, Qt::AnchorBottom, data); + data->refreshSizeHints(0); // 0 = effectiveSpacing, will not be used } /*! @@ -934,20 +938,17 @@ void QGraphicsAnchorLayoutPrivate::createCenterAnchors( Q_ASSERT(first && last); // Create new anchors - AnchorData *oldData = graph[orientation].edgeData(first, last); - - qreal minimumSize = oldData->minSize / 2; - qreal preferredSize = oldData->prefSize / 2; - qreal maximumSize = oldData->maxSize / 2; - QSimplexConstraint *c = new QSimplexConstraint; - AnchorData *data = new AnchorData(minimumSize, preferredSize, maximumSize); + + AnchorData *data = new AnchorData; c->variables.insert(data, 1.0); addAnchor_helper(item, firstEdge, item, centerEdge, data); + data->refreshSizeHints(0); - data = new AnchorData(minimumSize, preferredSize, maximumSize); + data = new AnchorData; c->variables.insert(data, -1.0); addAnchor_helper(item, centerEdge, item, lastEdge, data); + data->refreshSizeHints(0); itemCenterConstraints[orientation].append(c); @@ -1008,14 +1009,9 @@ void QGraphicsAnchorLayoutPrivate::removeCenterAnchors( if (substitute) { // Create the new anchor that should substitute the left-center-right anchors. - AnchorData *oldData = g.edgeData(first, center); - - qreal minimumSize = oldData->minSize * 2; - qreal preferredSize = oldData->prefSize * 2; - qreal maximumSize = oldData->maxSize * 2; - - AnchorData *data = new AnchorData(minimumSize, preferredSize, maximumSize); + AnchorData *data = new AnchorData; addAnchor_helper(item, firstEdge, item, lastEdge, data); + data->refreshSizeHints(0); // Remove old anchors removeAnchor_helper(first, center); @@ -1133,7 +1129,7 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi // Use heuristics to find out what the user meant with this anchor. correctEdgeDirection(firstItem, firstEdge, secondItem, secondEdge); - AnchorData *data; + AnchorData *data = new AnchorData; if (!spacing) { // If firstItem or secondItem is the layout itself, the spacing will default to 0. // Otherwise, the following matrix is used (questionmark means that the spacing @@ -1143,22 +1139,25 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi // Left 0 0 ? // HCenter 0 0 0 // Right ? 0 0 - if (firstItem != q - && secondItem != q - && pickEdge(firstEdge, Horizontal) != Qt::AnchorHorizontalCenter - && oppositeEdge(firstEdge) == secondEdge) { - data = new AnchorData; // ask the style later + if (firstItem == q + || secondItem == q + || pickEdge(firstEdge, Horizontal) == Qt::AnchorHorizontalCenter + || oppositeEdge(firstEdge) != secondEdge) { + data->setFixedSize(0); } else { - data = new AnchorData(0); // spacing should be 0 + data->unsetSize(); } addAnchor_helper(firstItem, firstEdge, secondItem, secondEdge, data); + } else if (*spacing >= 0) { - data = new AnchorData(*spacing); + data->setFixedSize(*spacing); addAnchor_helper(firstItem, firstEdge, secondItem, secondEdge, data); + } else { - data = new AnchorData(-*spacing); + data->setFixedSize(-*spacing); addAnchor_helper(secondItem, secondEdge, firstItem, firstEdge, data); } + return acquireGraphicsAnchor(data); } diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 47df786..047be39 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -149,33 +149,15 @@ struct AnchorData : public QSimplexVariable { Sequential, Parallel }; - AnchorData(qreal minimumSize, qreal preferredSize, qreal maximumSize) - : QSimplexVariable(), from(0), to(0), - minSize(minimumSize), prefSize(preferredSize), - maxSize(maximumSize), sizeAtMinimum(preferredSize), - sizeAtPreferred(preferredSize), sizeAtExpanding(preferredSize), - sizeAtMaximum(preferredSize), - graphicsAnchor(0), - skipInPreferred(0), type(Normal), hasSize(true), - isLayoutAnchor(false) {} - - AnchorData(qreal size) - : QSimplexVariable(), from(0), to(0), - minSize(size), prefSize(size), maxSize(size), - sizeAtMinimum(size), sizeAtPreferred(size), sizeAtExpanding(size), - sizeAtMaximum(size), - graphicsAnchor(0), - skipInPreferred(0), type(Normal), hasSize(true), - isLayoutAnchor(false) {} AnchorData() : QSimplexVariable(), from(0), to(0), - minSize(0), prefSize(0), maxSize(0), - sizeAtMinimum(0), sizeAtPreferred(0), sizeAtExpanding(0), - sizeAtMaximum(0), - graphicsAnchor(0), - skipInPreferred(0), type(Normal), hasSize(false), - isLayoutAnchor(false) {} + minSize(0), prefSize(0), expSize(0), maxSize(0), + sizeAtMinimum(0), sizeAtPreferred(0), + sizeAtExpanding(0), sizeAtMaximum(0), + graphicsAnchor(0), skipInPreferred(0), + type(Normal), hasSize(true), isLayoutAnchor(false), + isExpanding(false) {} virtual void updateChildrenSizes() {} virtual void refreshSizeHints(qreal effectiveSpacing); @@ -192,6 +174,7 @@ struct AnchorData : public QSimplexVariable { { minSize = size; prefSize = size; + expSize = size; maxSize = size; sizeAtMinimum = size; sizeAtPreferred = size; @@ -215,6 +198,7 @@ struct AnchorData : public QSimplexVariable { // size. qreal minSize; qreal prefSize; + qreal expSize; qreal maxSize; // These attributes define which sizes should that anchor be in when the @@ -231,17 +215,6 @@ struct AnchorData : public QSimplexVariable { uint hasSize : 1; // if false, get size from style. uint isLayoutAnchor : 1; // if this anchor is connected to a layout 'edge' uint isExpanding : 1; // if true, expands before other anchors - -protected: - AnchorData(Type type, qreal size = 0) - : QSimplexVariable(), from(0), to(0), - minSize(size), prefSize(size), - maxSize(size), sizeAtMinimum(size), - sizeAtPreferred(size), sizeAtExpanding(size), - sizeAtMaximum(size), - graphicsAnchor(0), - skipInPreferred(0), type(type), hasSize(true), - isLayoutAnchor(false) {} }; #ifdef QT_DEBUG @@ -253,8 +226,10 @@ inline QString AnchorData::toString() const struct SequentialAnchorData : public AnchorData { - SequentialAnchorData() : AnchorData(AnchorData::Sequential) + SequentialAnchorData() : AnchorData() { + type = AnchorData::Sequential; + hasSize = true; #ifdef QT_DEBUG name = QLatin1String("SequentialAnchorData"); #endif @@ -278,9 +253,11 @@ struct SequentialAnchorData : public AnchorData struct ParallelAnchorData : public AnchorData { ParallelAnchorData(AnchorData *first, AnchorData *second) - : AnchorData(AnchorData::Parallel), - firstEdge(first), secondEdge(second) + : AnchorData(), firstEdge(first), secondEdge(second) { + type = AnchorData::Parallel; + hasSize = true; + // ### Those asserts force that both child anchors have the same direction, // but can't we simplify a pair of anchors in opposite directions? Q_ASSERT(first->from == second->from); -- cgit v0.12 From bcd08ab82b5df13f7687a504f868cb8b6ff8b75e Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Fri, 25 Sep 2009 16:13:18 -0300 Subject: QGraphicsAnchorLayout: avoid code duplication when initializing complex anchors Now we can use refreshSizeHints_helper() to initialize complex anchors (parallel and sequential). This avoids duplication of code in the function simplifySequentialChunk(). This commit also 'disable' ExpandFlag temporarily, stabilizing the tests for the simplification. The next commit should re-enable it implementing the necessary code for simplification as well. Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Eduardo M. Fleury --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 102 +++++++++++------------ src/gui/graphicsview/qgraphicsanchorlayout_p.h | 4 + 2 files changed, 54 insertions(+), 52 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index dc8d211..dd46722 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -146,13 +146,15 @@ void AnchorData::refreshSizeHints(qreal effectiveSpacing) maxSize /= 2; } - if (policy & QSizePolicy::ExpandFlag) { - isExpanding = 1; - expSize = maxSize; - } else { - isExpanding = 0; - expSize = prefSize; - } + // ### + expSize = prefSize; + // if (policy & QSizePolicy::ExpandFlag) { + // isExpanding = 1; + // expSize = maxSize; + // } else { + // isExpanding = 0; + // expSize = prefSize; + // } // Set the anchor effective sizes to preferred. // @@ -187,6 +189,7 @@ void ParallelAnchorData::updateChildrenSizes() firstEdge->sizeAtMinimum = secondEdge->sizeAtMinimum = sizeAtMinimum; firstEdge->sizeAtPreferred = secondEdge->sizeAtPreferred = sizeAtPreferred; firstEdge->sizeAtMaximum = secondEdge->sizeAtMaximum = sizeAtMaximum; + firstEdge->sizeAtExpanding = secondEdge->sizeAtExpanding = sizeAtPreferred; firstEdge->updateChildrenSizes(); secondEdge->updateChildrenSizes(); @@ -194,9 +197,16 @@ void ParallelAnchorData::updateChildrenSizes() void ParallelAnchorData::refreshSizeHints(qreal effectiveSpacing) { - // First refresh children information - firstEdge->refreshSizeHints(effectiveSpacing); - secondEdge->refreshSizeHints(effectiveSpacing); + refreshSizeHints_helper(effectiveSpacing); +} + +void ParallelAnchorData::refreshSizeHints_helper(qreal effectiveSpacing, + bool refreshChildren) +{ + if (refreshChildren) { + firstEdge->refreshSizeHints(effectiveSpacing); + secondEdge->refreshSizeHints(effectiveSpacing); + } // ### should we warn if the parallel connection is invalid? // e.g. 1-2-3 with 10-20-30, the minimum of the latter is @@ -208,9 +218,13 @@ void ParallelAnchorData::refreshSizeHints(qreal effectiveSpacing) prefSize = qMax(firstEdge->prefSize, secondEdge->prefSize); prefSize = qMin(prefSize, maxSize); + // ### + expSize = prefSize; + // See comment in AnchorData::refreshSizeHints() about sizeAt* values sizeAtMinimum = prefSize; sizeAtPreferred = prefSize; + sizeAtExpanding = prefSize; sizeAtMaximum = prefSize; } @@ -277,30 +291,46 @@ void SequentialAnchorData::updateChildrenSizes() bandSize = maxFactor > 0 ? e->maxSize - e->prefSize : e->prefSize - e->minSize; e->sizeAtMaximum = e->prefSize + bandSize * maxFactor; + // ### + e->sizeAtExpanding = e->sizeAtPreferred; + e->updateChildrenSizes(); } } void SequentialAnchorData::refreshSizeHints(qreal effectiveSpacing) { + refreshSizeHints_helper(effectiveSpacing); +} + +void SequentialAnchorData::refreshSizeHints_helper(qreal effectiveSpacing, + bool refreshChildren) +{ minSize = 0; prefSize = 0; + expSize = 0; maxSize = 0; for (int i = 0; i < m_edges.count(); ++i) { AnchorData *edge = m_edges.at(i); - // First refresh children information - edge->refreshSizeHints(effectiveSpacing); + // If it's the case refresh children information first + if (refreshChildren) + edge->refreshSizeHints(effectiveSpacing); minSize += edge->minSize; prefSize += edge->prefSize; + expSize += edge->expSize; maxSize += edge->maxSize; } + // ### + expSize = prefSize; + // See comment in AnchorData::refreshSizeHints() about sizeAt* values sizeAtMinimum = prefSize; sizeAtPreferred = prefSize; + sizeAtExpanding = prefSize; sizeAtMaximum = prefSize; } @@ -441,39 +471,21 @@ static bool simplifySequentialChunk(Graph *graph, qDebug("simplifying [%s] to [%s - %s]", qPrintable(strPath), qPrintable(before->toString()), qPrintable(after->toString())); #endif - qreal min = 0; - qreal pref = 0; - qreal max = 0; - SequentialAnchorData *sequence = new SequentialAnchorData; AnchorVertex *prev = before; AnchorData *data; for (i = 0; i <= vertices.count(); ++i) { AnchorVertex *next = (i < vertices.count()) ? vertices.at(i) : after; data = graph->takeEdge(prev, next); - min += data->minSize; - pref += data->prefSize; - max = checkAdd(max, data->maxSize); sequence->m_edges.append(data); prev = next; } - - // insert new - sequence->minSize = min; - sequence->prefSize = pref; - sequence->maxSize = max; - - // Unless these values are overhidden by the simplex solver later-on, - // anchors will keep their own preferred size. - sequence->sizeAtMinimum = pref; - sequence->sizeAtPreferred = pref; - sequence->sizeAtMaximum = pref; - sequence->setVertices(vertices); - sequence->from = before; sequence->to = after; + sequence->refreshSizeHints_helper(0, false); + // data here is the last edge in the sequence // ### this seems to be here for supporting reverse order sequences, // but doesnt seem to be used right now @@ -488,25 +500,11 @@ static bool simplifySequentialChunk(Graph *graph, AnchorData *newAnchor = sequence; if (AnchorData *oldAnchor = graph->takeEdge(before, after)) { - newAnchor = new ParallelAnchorData(oldAnchor, sequence); - - newAnchor->isLayoutAnchor = (oldAnchor->isLayoutAnchor + ParallelAnchorData *parallel = new ParallelAnchorData(oldAnchor, sequence); + parallel->isLayoutAnchor = (oldAnchor->isLayoutAnchor || sequence->isLayoutAnchor); - - min = qMax(oldAnchor->minSize, sequence->minSize); - max = qMin(oldAnchor->maxSize, sequence->maxSize); - - pref = qMax(oldAnchor->prefSize, sequence->prefSize); - pref = qMin(pref, max); - - newAnchor->minSize = min; - newAnchor->prefSize = pref; - newAnchor->maxSize = max; - - // Same as above, by default, keep preferred size. - newAnchor->sizeAtMinimum = pref; - newAnchor->sizeAtPreferred = pref; - newAnchor->sizeAtMaximum = pref; + parallel->refreshSizeHints_helper(0, false); + newAnchor = parallel; } graph->createEdge(before, after, newAnchor); @@ -1687,7 +1685,7 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( AnchorData *ad = trunkPath.positives.toList()[0]; ad->sizeAtMinimum = ad->minSize; ad->sizeAtPreferred = ad->prefSize; - ad->sizeAtExpanding = ad->prefSize; + ad->sizeAtExpanding = ad->expSize; ad->sizeAtMaximum = ad->maxSize; // Propagate @@ -1696,7 +1694,7 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs( sizeHints[orientation][Qt::MinimumSize] = ad->sizeAtMinimum; sizeHints[orientation][Qt::PreferredSize] = ad->sizeAtPreferred; sizeHints[orientation][Qt::MaximumSize] = ad->sizeAtMaximum; - sizeAtExpanding[orientation] = ad->sizeAtPreferred; + sizeAtExpanding[orientation] = ad->sizeAtExpanding; } // Delete the constraints, we won't use them anymore. diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 047be39..8f67b2c 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -238,6 +238,8 @@ struct SequentialAnchorData : public AnchorData virtual void updateChildrenSizes(); virtual void refreshSizeHints(qreal effectiveSpacing); + void refreshSizeHints_helper(qreal effectiveSpacing, bool refreshChildren = true); + void setVertices(const QVector &vertices) { m_children = vertices; @@ -272,6 +274,8 @@ struct ParallelAnchorData : public AnchorData virtual void updateChildrenSizes(); virtual void refreshSizeHints(qreal effectiveSpacing); + void refreshSizeHints_helper(qreal effectiveSpacing, bool refreshChildren = true); + AnchorData* firstEdge; AnchorData* secondEdge; }; -- cgit v0.12 From ad69bb73754534f61658a83e85dadb75e603c90a Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Fri, 25 Sep 2009 19:02:21 -0300 Subject: QGraphicsAnchorLayout: Update solveExpanding to handle simplified graphs The previous implementation of solveExpanding would assume that anchors were either completely expanding (would grow to their sizeAtMaximum) or non-expanding (would try to remain at their sizeAtPreferred). What happens however is that with simplification enabled, we may have anchors that are "partially" expanding. An example is a sequential anchor that groups together two leaf anchors where only one of them is expanding. In this case, the expected size of that group anchor would be the sum of the max size of the expanding child plus the preferred size of the non-expanding child. To handle the above case we added the "expSize" variable. It holds the expected value at Expanding for each anchor. Based on this, and the already calculated values of sizeAtMaximum and sizeAtPreferred, the solver calculates the actual sizeAtExpanding for them. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 84 ++++++++++++++++++++---- 1 file changed, 72 insertions(+), 12 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index dd46722..cf1429c 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -2319,40 +2319,97 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(QList co return feasible; } +/*! Calculate the "expanding" keyframe + + This new keyframe sits between the already existing sizeAtPreferred and + sizeAtMaximum keyframes. Its goal is to modify the interpolation between + the latter as to respect the "expanding" size policy of some anchors. + + Previously all items would be subject to a linear interpolation between + sizeAtPreferred and sizeAtMaximum values. This will change now, the + expanding anchors will change their size before the others. To calculate + this keyframe we use the following logic: + + 1) Ask each anchor for their desired expanding size (ad->expSize), this + value depends on the anchor expanding property in the following way: + + - Expanding anchors want to grow towards their maximum size + - Non-expanding anchors want to remain at their preferred size. + - Composite anchors want to grow towards somewhere between their + preferred sizes. (*) + + 2) Clamp their desired values to the value they assume in the neighbour + keyframes (sizeAtPreferred and sizeAtExpanding) + + 3) Run simplex with a setup that ensures the following: + + a. Anchors will change their value from their sizeAtPreferred towards + their sizeAtMaximum as much as required to ensure that ALL anchors + reach their respective "desired" expanding sizes. + + b. No anchors will change their value beyond what is NEEDED to satisfy + the requirement above. + + The final result is that, at the "expanding" keyframe expanding anchors + will grow and take with them all anchors that are parallel to them. + However, non-expanding anchors will remain at their preferred size unless + they are forced to grow by a parallel expanding anchor. + + Note: For anchors where the sizeAtPreferred is bigger than sizeAtPreferred, + the visual effect when the layout grows from its preferred size is + the following: Expanding anchors will keep their size while non + expanding ones will shrink. Only after non-expanding anchors have + shrinked all the way, the expanding anchors will start to shrink too. +*/ void QGraphicsAnchorLayoutPrivate::solveExpanding(QList constraints) { QList variables = getVariables(constraints); QList itemConstraints; QSimplexConstraint *objective = new QSimplexConstraint; + bool hasExpanding = false; - // Use all items that belong to trunk to: - // - add solveExpanding-specific item constraints - // - create the objective function + // Construct the simplex constraints and objective for (int i = 0; i < variables.size(); ++i) { + // For each anchor AnchorData *ad = variables[i]; - if (ad->isExpanding) { - // Add constraint to lock expanding anchor in its sizeAtMaximum + + // Clamp the desired expanding size + qreal upperBoundary = qMax(ad->sizeAtPreferred, ad->sizeAtMaximum); + qreal lowerBoundary = qMin(ad->sizeAtPreferred, ad->sizeAtMaximum); + qreal boundedExpSize = qBound(lowerBoundary, ad->expSize, upperBoundary); + + // Expanding anchors are those that want to move from their preferred size + if (boundedExpSize != ad->sizeAtPreferred) + hasExpanding = true; + + // Lock anchor between boundedExpSize and sizeAtMaximum (ensure 3.a) + if (boundedExpSize == ad->sizeAtMaximum) { + // The interval has only one possible value, we can use an "Equal" + // constraint and don't need to add this variable to the objective. QSimplexConstraint *itemC = new QSimplexConstraint; itemC->ratio = QSimplexConstraint::Equal; itemC->variables.insert(ad, 1.0); - itemC->constant = ad->sizeAtMaximum; + itemC->constant = boundedExpSize; itemConstraints << itemC; } else { - // Add constraints to lock anchor between their sizeAtPreferred and sizeAtMaximum + // Add MoreOrEqual and LessOrEqual constraints. QSimplexConstraint *itemC = new QSimplexConstraint; itemC->ratio = QSimplexConstraint::MoreOrEqual; itemC->variables.insert(ad, 1.0); - itemC->constant = qMin(ad->sizeAtPreferred, ad->sizeAtMaximum); + itemC->constant = qMin(boundedExpSize, ad->sizeAtMaximum); itemConstraints << itemC; itemC = new QSimplexConstraint; itemC->ratio = QSimplexConstraint::LessOrEqual; itemC->variables.insert(ad, 1.0); - itemC->constant = qMax(ad->sizeAtPreferred, ad->sizeAtMaximum); + itemC->constant = qMax(boundedExpSize, ad->sizeAtMaximum); itemConstraints << itemC; - // Add anchor to objective function - if (ad->sizeAtPreferred < ad->sizeAtMaximum) { + // Create objective to avoid the anchos from moving away from + // the preferred size more than the needed amount. (ensure 3.b) + // The objective function is the distance between sizeAtPreferred + // and sizeAtExpanding, it will be minimized. + if (ad->sizeAtExpanding < ad->sizeAtMaximum) { // Try to shrink this variable towards its sizeAtPreferred value objective->variables.insert(ad, 1.0); } else { @@ -2363,7 +2420,7 @@ void QGraphicsAnchorLayoutPrivate::solveExpanding(QList co } // Solve - if (objective->variables.size() == variables.size()) { + if (hasExpanding == false) { // If no anchors are expanding, we don't need to run the simplex // Set all variables to their preferred size for (int i = 0; i < variables.size(); ++i) { @@ -2372,9 +2429,12 @@ void QGraphicsAnchorLayoutPrivate::solveExpanding(QList co } else { // Run simplex QSimplex simplex; + + // Satisfy expanding (3.a) bool feasible = simplex.setConstraints(constraints + itemConstraints); Q_ASSERT(feasible); + // Reduce damage (3.b) simplex.setObjective(objective); simplex.solveMin(); -- cgit v0.12 From ba66cc0bde91e1143ac0a34f249f98e4573a5737 Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Mon, 28 Sep 2009 11:49:42 -0300 Subject: QSimplex: Remove overly conservative assertion This assertion started failing after the addition of expanding state. After some investigation we felt that the assertion itself was too strong and would fail in some valid cases. The new assertion is formally right as it tests whether the simplex solver was able to satisfy the simplex constraints, _exactly_ what it is expected to do. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qsimplex_p.cpp | 24 ++++++------------------ src/gui/graphicsview/qsimplex_p.h | 26 +++++++++++++++++++++++++- 2 files changed, 31 insertions(+), 19 deletions(-) diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp index 00fc204..95003d2 100644 --- a/src/gui/graphicsview/qsimplex_p.cpp +++ b/src/gui/graphicsview/qsimplex_p.cpp @@ -285,24 +285,6 @@ bool QSimplex::setConstraints(const QList newConstraints) // anymore. clearColumns(firstArtificial, columns - 2); - #ifdef QT_DEBUG - // Ensure that at the end of the simplex each row should either: - // - Have a positive value on the column associated to its variable, or - // - Have zero values in all columns. - // - // This avoids a regression where restrictions would be lost - // due to randomness in the pivotRowForColumn method. - for (int i = 1; i < rows; ++i) { - int variableIndex = valueAt(i, 0); - if (valueAt(i, variableIndex) > 0) - continue; - - for (int j = 1; j < columns; ++j) { - Q_ASSERT(valueAt(i, j) == 0); - } - } - #endif - return true; } @@ -537,6 +519,12 @@ qreal QSimplex::solver(solverFactor factor) solveMaxHelper(); collectResults(); + #ifdef QT_DEBUG + for (int i = 0; i < constraints.size(); ++i) { + Q_ASSERT(constraints[i]->isSatisfied()); + } + #endif + return factor * valueAt(0, columns - 1); } diff --git a/src/gui/graphicsview/qsimplex_p.h b/src/gui/graphicsview/qsimplex_p.h index 54b080d..b517cb9 100644 --- a/src/gui/graphicsview/qsimplex_p.h +++ b/src/gui/graphicsview/qsimplex_p.h @@ -94,8 +94,32 @@ struct QSimplexConstraint QPair helper; QSimplexVariable * artificial; -}; + #ifdef QT_DEBUG + bool isSatisfied() { + qreal leftHandSide(0); + + QHash::const_iterator iter; + for (iter = variables.constBegin(); iter != variables.constEnd(); ++iter) { + leftHandSide += iter.value() * iter.key()->result; + } + + Q_ASSERT(constant > 0 || qFuzzyCompare(1, 1 + constant)); + + if (qFuzzyCompare(1000 + leftHandSide, 1000 + constant)) + return true; + + switch (ratio) { + case LessOrEqual: + return leftHandSide < constant; + case MoreOrEqual: + return leftHandSide > constant; + default: + return false; + } + } + #endif +}; class QSimplex { -- cgit v0.12 From 0536b996759ef367e784310f472089eec583213f Mon Sep 17 00:00:00 2001 From: Caio Marcelo de Oliveira Filho Date: Fri, 25 Sep 2009 19:35:25 -0300 Subject: QGraphicsAnchorLayout: Add support for expanding SizePolicy with simplification Updating "refreshSizeHints" and "updateChildrenSizes" methods for standard, parallel and sequential anchors, in order to support the expanding SizePolicy flag. This adds the logic required to calculate equivalent expected/nominal expanding size (AnchorData::expSize) as well as the logic to propagate the effective size when in the expanding state (AnchorData::sizeAtExpected). Signed-off-by: Caio Marcelo de Oliveira Filho Reviewed-by: Eduardo M. Fleury --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 59 ++++++++++++++---------- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 4 +- 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index cf1429c..20ff03b 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -146,15 +146,11 @@ void AnchorData::refreshSizeHints(qreal effectiveSpacing) maxSize /= 2; } - // ### - expSize = prefSize; - // if (policy & QSizePolicy::ExpandFlag) { - // isExpanding = 1; - // expSize = maxSize; - // } else { - // isExpanding = 0; - // expSize = prefSize; - // } + if (policy & QSizePolicy::ExpandFlag) { + expSize = maxSize; + } else { + expSize = prefSize; + } // Set the anchor effective sizes to preferred. // @@ -175,8 +171,6 @@ void AnchorData::refreshSizeHints(qreal effectiveSpacing) expSize = effectiveSpacing; maxSize = effectiveSpacing; - isExpanding = 0; - sizeAtMinimum = prefSize; sizeAtPreferred = prefSize; sizeAtExpanding = prefSize; @@ -188,8 +182,8 @@ void ParallelAnchorData::updateChildrenSizes() { firstEdge->sizeAtMinimum = secondEdge->sizeAtMinimum = sizeAtMinimum; firstEdge->sizeAtPreferred = secondEdge->sizeAtPreferred = sizeAtPreferred; + firstEdge->sizeAtExpanding = secondEdge->sizeAtExpanding = sizeAtExpanding; firstEdge->sizeAtMaximum = secondEdge->sizeAtMaximum = sizeAtMaximum; - firstEdge->sizeAtExpanding = secondEdge->sizeAtExpanding = sizeAtPreferred; firstEdge->updateChildrenSizes(); secondEdge->updateChildrenSizes(); @@ -215,11 +209,11 @@ void ParallelAnchorData::refreshSizeHints_helper(qreal effectiveSpacing, minSize = qMax(firstEdge->minSize, secondEdge->minSize); maxSize = qMin(firstEdge->maxSize, secondEdge->maxSize); - prefSize = qMax(firstEdge->prefSize, secondEdge->prefSize); - prefSize = qMin(prefSize, maxSize); + expSize = qMax(firstEdge->expSize, secondEdge->expSize); + expSize = qMin(expSize, maxSize); - // ### - expSize = prefSize; + prefSize = qMax(firstEdge->prefSize, secondEdge->prefSize); + prefSize = qMin(prefSize, expSize); // See comment in AnchorData::refreshSizeHints() about sizeAt* values sizeAtMinimum = prefSize; @@ -260,6 +254,21 @@ static qreal getFactor(qreal value, qreal min, qreal pref, qreal max) } } +static qreal getExpandingFactor(const qreal &expSize, const qreal &sizeAtPreferred, + const qreal &sizeAtExpanding, const qreal &sizeAtMaximum) +{ + const qreal lower = qMin(sizeAtPreferred, sizeAtMaximum); + const qreal upper = qMax(sizeAtPreferred, sizeAtMaximum); + const qreal boundedExpSize = qBound(lower, expSize, upper); + + const qreal bandSize = sizeAtMaximum - boundedExpSize; + if (bandSize == 0) { + return 0; + } else { + return (sizeAtExpanding - boundedExpSize) / bandSize; + } +} + void SequentialAnchorData::updateChildrenSizes() { // ### REMOVE ME @@ -269,15 +278,18 @@ void SequentialAnchorData::updateChildrenSizes() Q_ASSERT(sizeAtMinimum < maxSize || qFuzzyCompare(sizeAtMinimum, maxSize)); Q_ASSERT(sizeAtPreferred > minSize || qFuzzyCompare(sizeAtPreferred, minSize)); Q_ASSERT(sizeAtPreferred < maxSize || qFuzzyCompare(sizeAtPreferred, maxSize)); + Q_ASSERT(sizeAtExpanding > minSize || qFuzzyCompare(sizeAtExpanding, minSize)); + Q_ASSERT(sizeAtExpanding < maxSize || qFuzzyCompare(sizeAtExpanding, maxSize)); Q_ASSERT(sizeAtMaximum > minSize || qFuzzyCompare(sizeAtMaximum, minSize)); Q_ASSERT(sizeAtMaximum < maxSize || qFuzzyCompare(sizeAtMaximum, maxSize)); // Band here refers if the value is in the Minimum To Preferred // band (the lower band) or the Preferred To Maximum (the upper band). - qreal minFactor = getFactor(sizeAtMinimum, minSize, prefSize, maxSize); - qreal prefFactor = getFactor(sizeAtPreferred, minSize, prefSize, maxSize); - qreal maxFactor = getFactor(sizeAtMaximum, minSize, prefSize, maxSize); + const qreal minFactor = getFactor(sizeAtMinimum, minSize, prefSize, maxSize); + const qreal prefFactor = getFactor(sizeAtPreferred, minSize, prefSize, maxSize); + const qreal maxFactor = getFactor(sizeAtMaximum, minSize, prefSize, maxSize); + const qreal expFactor = getExpandingFactor(expSize, sizeAtPreferred, sizeAtExpanding, sizeAtMaximum); for (int i = 0; i < m_edges.count(); ++i) { AnchorData *e = m_edges.at(i); @@ -291,8 +303,10 @@ void SequentialAnchorData::updateChildrenSizes() bandSize = maxFactor > 0 ? e->maxSize - e->prefSize : e->prefSize - e->minSize; e->sizeAtMaximum = e->prefSize + bandSize * maxFactor; - // ### - e->sizeAtExpanding = e->sizeAtPreferred; + const qreal lower = qMin(e->sizeAtPreferred, e->sizeAtMaximum); + const qreal upper = qMax(e->sizeAtPreferred, e->sizeAtMaximum); + const qreal edgeBoundedExpSize = qBound(lower, e->expSize, upper); + e->sizeAtExpanding = edgeBoundedExpSize + expFactor * (e->sizeAtMaximum - edgeBoundedExpSize); e->updateChildrenSizes(); } @@ -324,9 +338,6 @@ void SequentialAnchorData::refreshSizeHints_helper(qreal effectiveSpacing, maxSize += edge->maxSize; } - // ### - expSize = prefSize; - // See comment in AnchorData::refreshSizeHints() about sizeAt* values sizeAtMinimum = prefSize; sizeAtPreferred = prefSize; diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 8f67b2c..aac4f96 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -156,8 +156,7 @@ struct AnchorData : public QSimplexVariable { sizeAtMinimum(0), sizeAtPreferred(0), sizeAtExpanding(0), sizeAtMaximum(0), graphicsAnchor(0), skipInPreferred(0), - type(Normal), hasSize(true), isLayoutAnchor(false), - isExpanding(false) {} + type(Normal), hasSize(true), isLayoutAnchor(false) {} virtual void updateChildrenSizes() {} virtual void refreshSizeHints(qreal effectiveSpacing); @@ -214,7 +213,6 @@ struct AnchorData : public QSimplexVariable { uint type : 2; // either Normal, Sequential or Parallel uint hasSize : 1; // if false, get size from style. uint isLayoutAnchor : 1; // if this anchor is connected to a layout 'edge' - uint isExpanding : 1; // if true, expands before other anchors }; #ifdef QT_DEBUG -- cgit v0.12 From 89ea5d0cc0b00a1d4e8f3e700b86f168cf4437ed Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Wed, 30 Sep 2009 12:25:34 -0300 Subject: QGraphicsAnchorLayout: Fix creation of internal layout anchors Since the AnchorData cleanup commit (c974aca8) all anchor initialization is being done by refreshSizeHints. However that method was not able to properly initialize the internal layout anchors. This commit refactors that method both to add the functionality and improve readability. Signed-off-by: Eduardo M. Fleury Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 145 ++++++++++++--------- .../tst_qgraphicsanchorlayout.cpp | 2 +- 2 files changed, 84 insertions(+), 63 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 20ff03b..8139b2b 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -92,90 +92,111 @@ qreal QGraphicsAnchorPrivate::spacing() const } +static void sizeHintsFromItem(QGraphicsLayoutItem *item, + const QGraphicsAnchorLayoutPrivate::Orientation orient, + qreal *minSize, qreal *prefSize, + qreal *expSize, qreal *maxSize) +{ + QSizePolicy::Policy policy; + qreal minSizeHint; + qreal prefSizeHint; + qreal maxSizeHint; + + if (orient == QGraphicsAnchorLayoutPrivate::Horizontal) { + policy = item->sizePolicy().horizontalPolicy(); + minSizeHint = item->effectiveSizeHint(Qt::MinimumSize).width(); + prefSizeHint = item->effectiveSizeHint(Qt::PreferredSize).width(); + maxSizeHint = item->effectiveSizeHint(Qt::MaximumSize).width(); + } else { + policy = item->sizePolicy().verticalPolicy(); + minSizeHint = item->effectiveSizeHint(Qt::MinimumSize).height(); + prefSizeHint = item->effectiveSizeHint(Qt::PreferredSize).height(); + maxSizeHint = item->effectiveSizeHint(Qt::MaximumSize).height(); + } + + // minSize, prefSize and maxSize are initialized + // with item's preferred Size: this is QSizePolicy::Fixed. + // + // Then we check each flag to find the resultant QSizePolicy, + // according to the following table: + // + // constant value + // QSizePolicy::Fixed 0 + // QSizePolicy::Minimum GrowFlag + // QSizePolicy::Maximum ShrinkFlag + // QSizePolicy::Preferred GrowFlag | ShrinkFlag + // QSizePolicy::Ignored GrowFlag | ShrinkFlag | IgnoreFlag + + if (policy & QSizePolicy::ShrinkFlag) + *minSize = minSizeHint; + else + *minSize = prefSizeHint; + + if (policy & QSizePolicy::GrowFlag) + *maxSize = maxSizeHint; + else + *maxSize = prefSizeHint; + + // Note that these two initializations are affected by the previous flags + if (policy & QSizePolicy::IgnoreFlag) + *prefSize = *maxSize; + else + *prefSize = prefSizeHint; + + if (policy & QSizePolicy::ExpandFlag) + *expSize = *maxSize; + else + *expSize = *prefSize; +} + void AnchorData::refreshSizeHints(qreal effectiveSpacing) { - if (!isLayoutAnchor && (from->m_item == to->m_item)) { - QGraphicsLayoutItem *item = from->m_item; + const bool isInternalAnchor = from->m_item == to->m_item; - const QGraphicsAnchorLayoutPrivate::Orientation orient = QGraphicsAnchorLayoutPrivate::edgeOrientation(from->m_edge); - const Qt::AnchorPoint centerEdge = QGraphicsAnchorLayoutPrivate::pickEdge(Qt::AnchorHorizontalCenter, orient); + if (isInternalAnchor) { + const QGraphicsAnchorLayoutPrivate::Orientation orient = + QGraphicsAnchorLayoutPrivate::edgeOrientation(from->m_edge); - QSizePolicy::Policy policy; - qreal minSizeHint, prefSizeHint, maxSizeHint; - if (orient == QGraphicsAnchorLayoutPrivate::Horizontal) { - policy = item->sizePolicy().horizontalPolicy(); - minSizeHint = item->effectiveSizeHint(Qt::MinimumSize).width(); - prefSizeHint = item->effectiveSizeHint(Qt::PreferredSize).width(); - maxSizeHint = item->effectiveSizeHint(Qt::MaximumSize).width(); + if (isLayoutAnchor) { + minSize = 0; + prefSize = 0; + expSize = 0; + maxSize = QWIDGETSIZE_MAX; } else { - policy = item->sizePolicy().verticalPolicy(); - minSizeHint = item->effectiveSizeHint(Qt::MinimumSize).height(); - prefSizeHint = item->effectiveSizeHint(Qt::PreferredSize).height(); - maxSizeHint = item->effectiveSizeHint(Qt::MaximumSize).height(); + QGraphicsLayoutItem *item = from->m_item; + sizeHintsFromItem(item, orient, &minSize, &prefSize, &expSize, &maxSize); } - // minSize, prefSize and maxSize are initialized - // with item's preferred Size: this is QSizePolicy::Fixed. - // - // Then we check each flag to find the resultant QSizePolicy, - // according to the following table: - // - // constant value - // QSizePolicy::Fixed 0 - // QSizePolicy::Minimum GrowFlag - // QSizePolicy::Maximum ShrinkFlag - // QSizePolicy::Preferred GrowFlag | ShrinkFlag - // QSizePolicy::Ignored GrowFlag | ShrinkFlag | IgnoreFlag - prefSize = prefSizeHint; - minSize = prefSize; - maxSize = prefSize; - - if (policy & QSizePolicy::GrowFlag) - maxSize = maxSizeHint; - - if (policy & QSizePolicy::ShrinkFlag) - minSize = minSizeHint; - - if (policy & QSizePolicy::IgnoreFlag) - prefSize = minSize; + const Qt::AnchorPoint centerEdge = + QGraphicsAnchorLayoutPrivate::pickEdge(Qt::AnchorHorizontalCenter, orient); bool hasCenter = (from->m_edge == centerEdge || to->m_edge == centerEdge); if (hasCenter) { minSize /= 2; prefSize /= 2; + expSize /= 2; maxSize /= 2; } - if (policy & QSizePolicy::ExpandFlag) { - expSize = maxSize; - } else { - expSize = prefSize; - } - - // Set the anchor effective sizes to preferred. - // - // Note: The idea here is that all items should remain at their - // preferred size unless where that's impossible. In cases where - // the item is subject to restrictions (anchored to the layout - // edges, for instance), the simplex solver will be run to - // recalculate and override the values we set here. - sizeAtMinimum = prefSize; - sizeAtPreferred = prefSize; - sizeAtExpanding = prefSize; - sizeAtMaximum = prefSize; - } else if (!hasSize) { // Anchor has no size defined, use given default information minSize = effectiveSpacing; prefSize = effectiveSpacing; expSize = effectiveSpacing; maxSize = effectiveSpacing; - - sizeAtMinimum = prefSize; - sizeAtPreferred = prefSize; - sizeAtExpanding = prefSize; - sizeAtMaximum = prefSize; } + + // Set the anchor effective sizes to preferred. + // + // Note: The idea here is that all items should remain at their + // preferred size unless where that's impossible. In cases where + // the item is subject to restrictions (anchored to the layout + // edges, for instance), the simplex solver will be run to + // recalculate and override the values we set here. + sizeAtMinimum = prefSize; + sizeAtPreferred = prefSize; + sizeAtExpanding = prefSize; + sizeAtMaximum = prefSize; } void ParallelAnchorData::updateChildrenSizes() diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 4ad48c7..91e5bb3 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -1271,7 +1271,7 @@ void tst_QGraphicsAnchorLayout::sizePolicy() w1->adjustSize(); QCOMPARE(l->effectiveSizeHint(Qt::MinimumSize), QSizeF(0, 0)); - QCOMPARE(l->effectiveSizeHint(Qt::PreferredSize), QSizeF(0, 0)); + QCOMPARE(l->effectiveSizeHint(Qt::PreferredSize), QSizeF(100, 100)); QCOMPARE(l->effectiveSizeHint(Qt::MaximumSize), QSizeF(100, 100)); delete p; -- cgit v0.12 From 0d1e86fdfb7958a1affb93c7760c22fca9a0fcb2 Mon Sep 17 00:00:00 2001 From: Jesus Sanchez-Palencia Date: Fri, 25 Sep 2009 18:53:15 -0300 Subject: QGraphicsAnchorLayout: Adding a Float Conflict test case Now we don't support floating items and so we should consider that the layout has a conflict when handling this situation. Signed-off-by: Jesus Sanchez-Palencia Reviewed-by: Caio Marcelo de Oliveira Filho --- .../tst_qgraphicsanchorlayout.cpp | 69 ++++++++++++++++++++++ .../tst_qgraphicsanchorlayout1.cpp | 4 +- 2 files changed, 72 insertions(+), 1 deletion(-) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index 91e5bb3..b076631 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -72,6 +72,7 @@ private slots: void expandingSequence(); void expandingSequenceFairDistribution(); void expandingParallel(); + void floatConflict(); }; class RectWidget : public QGraphicsWidget @@ -158,7 +159,17 @@ void tst_QGraphicsAnchorLayout::simple() QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setContentsMargins(0, 0, 0, 0); + + // Horizontal + l->addAnchor(w1, Qt::AnchorLeft, l, Qt::AnchorLeft); l->addAnchor(w1, Qt::AnchorRight, w2, Qt::AnchorLeft); + l->addAnchor(w2, Qt::AnchorRight, l, Qt::AnchorRight); + + // Vertical + l->addAnchor(w1, Qt::AnchorTop, l, Qt::AnchorTop); + l->addAnchor(w2, Qt::AnchorTop, l, Qt::AnchorTop); + l->addAnchor(w1, Qt::AnchorBottom, l, Qt::AnchorBottom); + l->addAnchor(w2, Qt::AnchorBottom, l, Qt::AnchorBottom); QGraphicsWidget p; p.setLayout(l); @@ -1152,12 +1163,22 @@ void tst_QGraphicsAnchorLayout::delete_anchor() QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout; l->setSpacing(0); l->setContentsMargins(0, 0, 0, 0); + + // Horizontal l->addAnchor(l, Qt::AnchorLeft, w1, Qt::AnchorLeft); l->addAnchor(w1, Qt::AnchorRight, w2, Qt::AnchorLeft); l->addAnchor(w2, Qt::AnchorRight, l, Qt::AnchorRight); l->addAnchor(w1, Qt::AnchorRight, w3, Qt::AnchorLeft); l->addAnchor(w3, Qt::AnchorRight, l, Qt::AnchorRight); + // Vertical + l->addAnchor(w1, Qt::AnchorTop, l, Qt::AnchorTop); + l->addAnchor(w1, Qt::AnchorBottom, l, Qt::AnchorBottom); + l->addAnchor(w2, Qt::AnchorTop, l, Qt::AnchorTop); + l->addAnchor(w2, Qt::AnchorBottom, l, Qt::AnchorBottom); + l->addAnchor(w3, Qt::AnchorTop, l, Qt::AnchorTop); + l->addAnchor(w3, Qt::AnchorBottom, l, Qt::AnchorBottom); + QGraphicsAnchor *anchor = l->anchor(w3, Qt::AnchorRight, l, Qt::AnchorRight); anchor->setSpacing(10); @@ -1521,5 +1542,53 @@ void tst_QGraphicsAnchorLayout::expandingParallel() QCOMPARE(newLayoutMaximumSize.width(), qreal(300)); } +void tst_QGraphicsAnchorLayout::floatConflict() +{ + QGraphicsWidget *a = createItem(QSizeF(80,10), QSizeF(90,10), QSizeF(100,10), "a"); + QGraphicsWidget *b = createItem(QSizeF(80,10), QSizeF(90,10), QSizeF(100,10), "b"); + + QGraphicsAnchorLayout *l; + QGraphicsWidget *p = new QGraphicsWidget(0, Qt::Window); + + l = new QGraphicsAnchorLayout; + l->setContentsMargins(0, 0, 0, 0); + + p->setLayout(l); + + // horizontal + // with this anchor we have two floating items + setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft); + + // Just checking if the layout is handling well the removal of floating items + delete l->anchor(a, Qt::AnchorRight, b, Qt::AnchorLeft); + QCOMPARE(l->count(), 0); + QCOMPARE(layoutHasConflict(l), false); + + // setting back the same anchor + setAnchor(l, a, Qt::AnchorRight, b, Qt::AnchorLeft); + + // We don't support floating items but they should be counted as if they are in the layout + QCOMPARE(l->count(), 2); + // Although, we have an invalid situation + QCOMPARE(layoutHasConflict(l), true); + + // Semi-floats are supported + setAnchor(l, a, Qt::AnchorLeft, l, Qt::AnchorLeft); + QCOMPARE(l->count(), 2); + + // Vertically the layout has floating items. Therefore, we have a conflict + QCOMPARE(layoutHasConflict(l), true); + + // No more floating items + setAnchor(l, b, Qt::AnchorRight, l, Qt::AnchorRight); + setAnchor(l, a, Qt::AnchorTop, l, Qt::AnchorTop); + setAnchor(l, a, Qt::AnchorBottom, l, Qt::AnchorBottom); + setAnchor(l, b, Qt::AnchorTop, l, Qt::AnchorTop); + setAnchor(l, b, Qt::AnchorBottom, l, Qt::AnchorBottom); + QCOMPARE(layoutHasConflict(l), false); + + delete p; +} + QTEST_MAIN(tst_QGraphicsAnchorLayout) #include "tst_qgraphicsanchorlayout.moc" diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index a521b78..caf078e 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -530,16 +530,18 @@ void tst_QGraphicsAnchorLayout1::testIsValid() TestWidget *widget1 = new TestWidget(); TestWidget *widget2 = new TestWidget(); + // Vertically the layout has floating items. Therefore, we have a conflict layout->setAnchor(layout, Qt::AnchorLeft, widget1, Qt::AnchorLeft, 0.1); layout->setAnchor(layout, Qt::AnchorRight, widget1, Qt::AnchorRight, -0.1); + // Horizontally the layout has floating items. Therefore, we have a conflict layout->setAnchor(layout, Qt::AnchorTop, widget2, Qt::AnchorTop, 0.1); layout->setAnchor(layout, Qt::AnchorBottom, widget2, Qt::AnchorBottom, -0.1); widget->setLayout(layout); widget->setGeometry(QRectF(0,0,100,100)); - QCOMPARE(layout->isValid(), true); + QCOMPARE(layout->isValid(), false); delete widget; } } -- cgit v0.12 From 18da388497b5f3cbc77298a70bc83f037f06c013 Mon Sep 17 00:00:00 2001 From: Jesus Sanchez-Palencia Date: Tue, 29 Sep 2009 14:02:27 -0300 Subject: QGraphicsAnchorLayoutPrivate: Handling floating items as an invalid layout situation We make use of the anchor visited on findPaths() to keep track of how many items are visited when walking on the graph. We can use this information of how many items are reachable (non-float) in order to check if we have floating items (not reachable from any graph vertex). If so, we have a situation not supported by now. Signed-off-by: Jesus Sanchez-Palencia Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 51 +++++++++++++++++++++++- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 3 ++ 2 files changed, 53 insertions(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 8139b2b..e760642 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -1841,6 +1841,11 @@ void QGraphicsAnchorLayoutPrivate::findPaths(Orientation orientation) queue.enqueue(qMakePair(pair.second, v)); } } + + // We will walk through every reachable items (non-float) and mark them + // by keeping their references on m_nonFloatItems. With this we can easily + // identify non-float and float items. + identifyNonFloatItems(visited, orientation); } /*! @@ -1999,6 +2004,46 @@ QGraphicsAnchorLayoutPrivate::getGraphParts(Orientation orientation) } /*! + \internal + + Use all visited Anchors on findPaths() so we can identify non-float Items. +*/ +void QGraphicsAnchorLayoutPrivate::identifyNonFloatItems(QSet visited, Orientation orientation) +{ + m_nonFloatItems[orientation].clear(); + + foreach (const AnchorData *ad, visited) + identifyNonFloatItems_helper(ad, orientation); +} + +/*! + \internal + + Given an anchor, if it is an internal anchor and Normal we must mark it's item as non-float. + If the anchor is Sequential or Parallel, we must iterate on its children recursively until we reach + internal anchors (items). +*/ +void QGraphicsAnchorLayoutPrivate::identifyNonFloatItems_helper(const AnchorData *ad, Orientation orientation) +{ + Q_Q(QGraphicsAnchorLayout); + + switch(ad->type) { + case AnchorData::Normal: + if (ad->from->m_item == ad->to->m_item && ad->to->m_item != q) + m_nonFloatItems[orientation].insert(ad->to->m_item); + break; + case AnchorData::Sequential: + foreach (const AnchorData *d, static_cast(ad)->m_edges) + identifyNonFloatItems_helper(d, orientation); + break; + case AnchorData::Parallel: + identifyNonFloatItems_helper(static_cast(ad)->firstEdge, orientation); + identifyNonFloatItems_helper(static_cast(ad)->secondEdge, orientation); + break; + } +} + +/*! \internal Use the current vertices distance to calculate and set the geometry of @@ -2491,7 +2536,11 @@ bool QGraphicsAnchorLayoutPrivate::hasConflicts() const { QGraphicsAnchorLayoutPrivate *that = const_cast(this); that->calculateGraphs(); - return graphHasConflicts[0] || graphHasConflicts[1]; + + bool floatConflict = (m_nonFloatItems[0].size() < items.size()) + || (m_nonFloatItems[1].size() < items.size()); + + return graphHasConflicts[0] || graphHasConflicts[1] || floatConflict; } #ifdef QT_DEBUG diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index aac4f96..1a74d85 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -445,6 +445,8 @@ public: void constraintsFromPaths(Orientation orientation); QList constraintsFromSizeHints(const QList &anchors); QList > getGraphParts(Orientation orientation); + void identifyNonFloatItems(QSet visited, Orientation orientation); + void identifyNonFloatItems_helper(const AnchorData *ad, Orientation orientation); inline AnchorVertex *internalVertex(const QPair &itemEdge) const { @@ -511,6 +513,7 @@ public: // ### bool graphSimplified[2]; bool graphHasConflicts[2]; + QSet m_nonFloatItems[2]; uint calculateGraphCacheDirty : 1; }; -- cgit v0.12 From 6367a702b13a440557d4e0a405ae6d34ef0b778f Mon Sep 17 00:00:00 2001 From: Jesus Sanchez-Palencia Date: Tue, 29 Sep 2009 15:22:26 -0300 Subject: QGraphicsAnchorLayoutPrivate: Fixing initial geometry values for new layout items Now every item starts with its geometry on ((0,0), preferredSize()). By doing this we guarantee that every item will have a known initial value, which can be specially useful on float cases for instance. Signed-off-by: Jesus Sanchez-Palencia Reviewed-by: Caio Marcelo de Oliveira Filho --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 37 ++++++++++++++++-------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index e760642..87f5aa0 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -2068,22 +2068,35 @@ void QGraphicsAnchorLayoutPrivate::setItemsGeometries(const QRectF &geom) right = geom.right() - right; foreach (QGraphicsLayoutItem *item, items) { - firstH = internalVertex(item, Qt::AnchorLeft); - secondH = internalVertex(item, Qt::AnchorRight); - firstV = internalVertex(item, Qt::AnchorTop); - secondV = internalVertex(item, Qt::AnchorBottom); - QRectF newGeom; - newGeom.setTop(top + firstV->distance); - newGeom.setBottom(top + secondV->distance); + QSizeF itemPreferredSize = item->effectiveSizeHint(Qt::PreferredSize); + if (m_nonFloatItems[Horizontal].contains(item)) { + firstH = internalVertex(item, Qt::AnchorLeft); + secondH = internalVertex(item, Qt::AnchorRight); + + if (visualDir == Qt::LeftToRight) { + newGeom.setLeft(left + firstH->distance); + newGeom.setRight(left + secondH->distance); + } else { + newGeom.setLeft(right - secondH->distance); + newGeom.setRight(right - firstH->distance); + } + } else { + newGeom.setLeft(0); + newGeom.setRight(itemPreferredSize.width()); + } + + if (m_nonFloatItems[Vertical].contains(item)) { + firstV = internalVertex(item, Qt::AnchorTop); + secondV = internalVertex(item, Qt::AnchorBottom); - if (visualDir == Qt::LeftToRight) { - newGeom.setLeft(left + firstH->distance); - newGeom.setRight(left + secondH->distance); + newGeom.setTop(top + firstV->distance); + newGeom.setBottom(top + secondV->distance); } else { - newGeom.setLeft(right - secondH->distance); - newGeom.setRight(right - firstH->distance); + newGeom.setTop(0); + newGeom.setBottom(itemPreferredSize.height()); } + item->setGeometry(newGeom); } } -- cgit v0.12 From 709cc9140407280aa5c871d4650c123002dfdd19 Mon Sep 17 00:00:00 2001 From: "Eduardo M. Fleury" Date: Thu, 1 Oct 2009 15:04:20 -0300 Subject: QGraphicsAnchorLayout: Enable "float" Orbit test Now supported after float patches. Signed-off-by: Eduardo M. Fleury Reviewed-by: Jesus Sanchez-Palencia --- tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp | 3 --- 1 file changed, 3 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp index caf078e..148b2c8 100644 --- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp +++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp @@ -1415,9 +1415,6 @@ void tst_QGraphicsAnchorLayout1::testMixedSpacing_data() QTest::newRow("One widget, unsolvable") << QSizeF(10, 10) << theData << theResult; } - // ### BUG. We are not handling "floating" elements properly. Ie. elements that - // have no anchors in a given orientation. - if (0) // Two widgets, one has fixed size { BasicLayoutTestDataList theData; -- cgit v0.12 From ffeb69003a9c676064cdf7ec099a02c2fbcf2ad3 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 Oct 2009 20:46:39 +0200 Subject: API review: change function name to setUseSystemConfiguration. Requested-By: Volker Hilsheimer --- src/network/kernel/qnetworkproxy.cpp | 4 ++-- src/network/kernel/qnetworkproxy.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp index 7f40134..2d5c74f 100644 --- a/src/network/kernel/qnetworkproxy.cpp +++ b/src/network/kernel/qnetworkproxy.cpp @@ -1166,12 +1166,12 @@ QNetworkProxyFactory::~QNetworkProxyFactory() sets an application-wide proxy factory. For this reason, this method is mutually exclusive with setApplicationProxyFactory: calling setApplicationProxyFactory overrides the use of the system-wide proxy, - and calling setUseSystemConfigurationEnabled overrides any + and calling setUseSystemConfiguration overrides any application proxy or proxy factory that was previously set. \since 4.6 */ -void QNetworkProxyFactory::setUseSystemConfigurationEnabled(bool enable) +void QNetworkProxyFactory::setUseSystemConfiguration(bool enable) { if (enable) { setApplicationProxyFactory(new QSystemConfigurationProxyFactory); diff --git a/src/network/kernel/qnetworkproxy.h b/src/network/kernel/qnetworkproxy.h index 6357c64..68bd6fd 100644 --- a/src/network/kernel/qnetworkproxy.h +++ b/src/network/kernel/qnetworkproxy.h @@ -171,7 +171,7 @@ public: virtual QList queryProxy(const QNetworkProxyQuery &query = QNetworkProxyQuery()) = 0; - static void setUseSystemConfigurationEnabled(bool enable); + static void setUseSystemConfiguration(bool enable); static void setApplicationProxyFactory(QNetworkProxyFactory *factory); static QList proxyForQuery(const QNetworkProxyQuery &query); static QList systemProxyForQuery(const QNetworkProxyQuery &query = QNetworkProxyQuery()); -- cgit v0.12 From 2d2b4e8a77a30449d8b4ebc88979b3aff45a8222 Mon Sep 17 00:00:00 2001 From: Iain Date: Tue, 6 Oct 2009 21:34:10 +0200 Subject: Update EABI DEF files for Symbian OS Reviewed-by: TrustMe --- src/s60installs/eabi/QtCoreu.def | 60 ++++++++++++--------- src/s60installs/eabi/QtGuiu.def | 105 +++++++++++++++++++++++++++++++++--- src/s60installs/eabi/QtNetworku.def | 4 +- src/s60installs/eabi/QtScriptu.def | 26 ++++++--- src/s60installs/eabi/QtSqlu.def | 2 +- 5 files changed, 157 insertions(+), 40 deletions(-) diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def index d795a62..dda89fd 100644 --- a/src/s60installs/eabi/QtCoreu.def +++ b/src/s60installs/eabi/QtCoreu.def @@ -3206,11 +3206,11 @@ EXPORTS _ZN12QEasingCurveD1Ev @ 3205 NONAME _ZN12QEasingCurveD2Ev @ 3206 NONAME _ZN12QEasingCurveaSERKS_ @ 3207 NONAME - _ZN12QSignalEventC1EP7QObjectiRK5QListI8QVariantE @ 3208 NONAME - _ZN12QSignalEventC2EP7QObjectiRK5QListI8QVariantE @ 3209 NONAME - _ZN12QSignalEventD0Ev @ 3210 NONAME - _ZN12QSignalEventD1Ev @ 3211 NONAME - _ZN12QSignalEventD2Ev @ 3212 NONAME + _ZN12QSignalEventC1EP7QObjectiRK5QListI8QVariantE @ 3208 NONAME ABSENT + _ZN12QSignalEventC2EP7QObjectiRK5QListI8QVariantE @ 3209 NONAME ABSENT + _ZN12QSignalEventD0Ev @ 3210 NONAME ABSENT + _ZN12QSignalEventD1Ev @ 3211 NONAME ABSENT + _ZN12QSignalEventD2Ev @ 3212 NONAME ABSENT _ZN13QHistoryState11qt_metacallEN11QMetaObject4CallEiPPv @ 3213 NONAME _ZN13QHistoryState11qt_metacastEPKc @ 3214 NONAME _ZN13QHistoryState14setHistoryTypeENS_11HistoryTypeE @ 3215 NONAME @@ -3234,7 +3234,7 @@ EXPORTS _ZN13QStateMachine12endMicrostepEP6QEvent @ 3233 NONAME _ZN13QStateMachine14beginMicrostepEP6QEvent @ 3234 NONAME _ZN13QStateMachine16staticMetaObjectE @ 3235 NONAME DATA 16 - _ZN13QStateMachine17postInternalEventEP6QEvent @ 3236 NONAME + _ZN13QStateMachine17postInternalEventEP6QEvent @ 3236 NONAME ABSENT _ZN13QStateMachine19addDefaultAnimationEP18QAbstractAnimation @ 3237 NONAME _ZN13QStateMachine20endSelectTransitionsEP6QEvent @ 3238 NONAME _ZN13QStateMachine20setAnimationsEnabledEb @ 3239 NONAME @@ -3249,7 +3249,7 @@ EXPORTS _ZN13QStateMachine7startedEv @ 3248 NONAME _ZN13QStateMachine7stoppedEv @ 3249 NONAME _ZN13QStateMachine8addStateEP14QAbstractState @ 3250 NONAME - _ZN13QStateMachine9postEventEP6QEventi @ 3251 NONAME + _ZN13QStateMachine9postEventEP6QEventi @ 3251 NONAME ABSENT _ZN13QStateMachineC1EP7QObject @ 3252 NONAME _ZN13QStateMachineC1ER20QStateMachinePrivateP7QObject @ 3253 NONAME _ZN13QStateMachineC2EP7QObject @ 3254 NONAME @@ -3265,11 +3265,11 @@ EXPORTS _ZN13QStatePrivateD1Ev @ 3264 NONAME _ZN13QStatePrivateD2Ev @ 3265 NONAME _ZN13QUnifiedTimer8instanceEv @ 3266 NONAME - _ZN13QWrappedEventC1EP7QObjectP6QEvent @ 3267 NONAME - _ZN13QWrappedEventC2EP7QObjectP6QEvent @ 3268 NONAME - _ZN13QWrappedEventD0Ev @ 3269 NONAME - _ZN13QWrappedEventD1Ev @ 3270 NONAME - _ZN13QWrappedEventD2Ev @ 3271 NONAME + _ZN13QWrappedEventC1EP7QObjectP6QEvent @ 3267 NONAME ABSENT + _ZN13QWrappedEventC2EP7QObjectP6QEvent @ 3268 NONAME ABSENT + _ZN13QWrappedEventD0Ev @ 3269 NONAME ABSENT + _ZN13QWrappedEventD1Ev @ 3270 NONAME ABSENT + _ZN13QWrappedEventD2Ev @ 3271 NONAME ABSENT _ZN14QAbstractState11qt_metacallEN11QMetaObject4CallEiPPv @ 3272 NONAME _ZN14QAbstractState11qt_metacastEPKc @ 3273 NONAME _ZN14QAbstractState16staticMetaObjectE @ 3274 NONAME DATA 16 @@ -3299,7 +3299,7 @@ EXPORTS _ZN15QPauseAnimation11qt_metacastEPKc @ 3298 NONAME _ZN15QPauseAnimation11setDurationEi @ 3299 NONAME _ZN15QPauseAnimation16staticMetaObjectE @ 3300 NONAME DATA 16 - _ZN15QPauseAnimation17updateCurrentTimeEi @ 3301 NONAME ABSENT + _ZN15QPauseAnimation17updateCurrentTimeEi @ 3301 NONAME _ZN15QPauseAnimation5eventEP6QEvent @ 3302 NONAME _ZN15QPauseAnimationC1EP7QObject @ 3303 NONAME _ZN15QPauseAnimationC1EiP7QObject @ 3304 NONAME @@ -3361,7 +3361,7 @@ EXPORTS _ZN17QVariantAnimation13setStartValueERK8QVariant @ 3360 NONAME _ZN17QVariantAnimation14setEasingCurveERK12QEasingCurve @ 3361 NONAME _ZN17QVariantAnimation16staticMetaObjectE @ 3362 NONAME DATA 16 - _ZN17QVariantAnimation17updateCurrentTimeEi @ 3363 NONAME ABSENT + _ZN17QVariantAnimation17updateCurrentTimeEi @ 3363 NONAME _ZN17QVariantAnimation20registerInterpolatorEPF8QVariantPKvS2_fEi @ 3364 NONAME _ZN17QVariantAnimation5eventEP6QEvent @ 3365 NONAME _ZN17QVariantAnimationC2EP7QObject @ 3366 NONAME @@ -3430,7 +3430,7 @@ EXPORTS _ZN20QStateMachinePrivate14isDescendantOfEPK14QAbstractStateS2_ @ 3429 NONAME _ZN20QStateMachinePrivate15applyPropertiesERK5QListIP19QAbstractTransitionERKS0_IP14QAbstractStateESA_ @ 3430 NONAME _ZN20QStateMachinePrivate15properAncestorsEPK14QAbstractStatePK6QState @ 3431 NONAME - _ZN20QStateMachinePrivate15scheduleProcessEv @ 3432 NONAME + _ZN20QStateMachinePrivate15scheduleProcessEv @ 3432 NONAME ABSENT _ZN20QStateMachinePrivate16addStatesToEnterEP14QAbstractStateP6QStateR4QSetIS1_ES6_ @ 3433 NONAME _ZN20QStateMachinePrivate16removeStartStateEv @ 3434 NONAME _ZN20QStateMachinePrivate17stateExitLessThanEP14QAbstractStateS1_ @ 3435 NONAME @@ -3470,7 +3470,7 @@ EXPORTS _ZN23QParallelAnimationGroup11updateStateEN18QAbstractAnimation5StateES1_ @ 3469 NONAME _ZN23QParallelAnimationGroup15updateDirectionEN18QAbstractAnimation9DirectionE @ 3470 NONAME _ZN23QParallelAnimationGroup16staticMetaObjectE @ 3471 NONAME DATA 16 - _ZN23QParallelAnimationGroup17updateCurrentTimeEi @ 3472 NONAME ABSENT + _ZN23QParallelAnimationGroup17updateCurrentTimeEi @ 3472 NONAME _ZN23QParallelAnimationGroup5eventEP6QEvent @ 3473 NONAME _ZN23QParallelAnimationGroupC1EP7QObject @ 3474 NONAME _ZN23QParallelAnimationGroupC1ER30QParallelAnimationGroupPrivateP7QObject @ 3475 NONAME @@ -3498,7 +3498,7 @@ EXPORTS _ZN25QSequentialAnimationGroup13insertPauseAtEii @ 3497 NONAME _ZN25QSequentialAnimationGroup15updateDirectionEN18QAbstractAnimation9DirectionE @ 3498 NONAME _ZN25QSequentialAnimationGroup16staticMetaObjectE @ 3499 NONAME DATA 16 - _ZN25QSequentialAnimationGroup17updateCurrentTimeEi @ 3500 NONAME ABSENT + _ZN25QSequentialAnimationGroup17updateCurrentTimeEi @ 3500 NONAME _ZN25QSequentialAnimationGroup23currentAnimationChangedEP18QAbstractAnimation @ 3501 NONAME _ZN25QSequentialAnimationGroup5eventEP6QEvent @ 3502 NONAME _ZN25QSequentialAnimationGroup8addPauseEi @ 3503 NONAME @@ -3648,11 +3648,11 @@ EXPORTS _ZNK8QVariant7toFloatEPb @ 3647 NONAME _ZNK9QTimeLine11easingCurveEv @ 3648 NONAME _ZTI11QFinalState @ 3649 NONAME - _ZTI12QSignalEvent @ 3650 NONAME + _ZTI12QSignalEvent @ 3650 NONAME ABSENT _ZTI13QHistoryState @ 3651 NONAME _ZTI13QStateMachine @ 3652 NONAME _ZTI13QStatePrivate @ 3653 NONAME - _ZTI13QWrappedEvent @ 3654 NONAME + _ZTI13QWrappedEvent @ 3654 NONAME ABSENT _ZTI14QAbstractState @ 3655 NONAME _ZTI15QAnimationGroup @ 3656 NONAME _ZTI15QPauseAnimation @ 3657 NONAME @@ -3671,11 +3671,11 @@ EXPORTS _ZTI26QAbstractTransitionPrivate @ 3670 NONAME _ZTI6QState @ 3671 NONAME _ZTV11QFinalState @ 3672 NONAME - _ZTV12QSignalEvent @ 3673 NONAME + _ZTV12QSignalEvent @ 3673 NONAME ABSENT _ZTV13QHistoryState @ 3674 NONAME _ZTV13QStateMachine @ 3675 NONAME _ZTV13QStatePrivate @ 3676 NONAME - _ZTV13QWrappedEvent @ 3677 NONAME + _ZTV13QWrappedEvent @ 3677 NONAME ABSENT _ZTV14QAbstractState @ 3678 NONAME _ZTV15QAnimationGroup @ 3679 NONAME _ZTV15QPauseAnimation @ 3680 NONAME @@ -3820,8 +3820,18 @@ EXPORTS _ZTV37QNonContiguousByteDeviceByteArrayImpl @ 3819 NONAME ABSENT ; ## _ZTV38QNonContiguousByteDeviceRingBufferImpl @ 3820 NONAME ABSENT ; ## _Zls6QDebugRK8QMargins @ 3821 NONAME - _ZN15QPauseAnimation17updateCurrentTimeEv @ 3822 NONAME - _ZN17QVariantAnimation17updateCurrentTimeEv @ 3823 NONAME - _ZN23QParallelAnimationGroup17updateCurrentTimeEv @ 3824 NONAME - _ZN25QSequentialAnimationGroup17updateCurrentTimeEv @ 3825 NONAME + _ZN15QPauseAnimation17updateCurrentTimeEv @ 3822 NONAME ABSENT + _ZN17QVariantAnimation17updateCurrentTimeEv @ 3823 NONAME ABSENT + _ZN23QParallelAnimationGroup17updateCurrentTimeEv @ 3824 NONAME ABSENT + _ZN25QSequentialAnimationGroup17updateCurrentTimeEv @ 3825 NONAME ABSENT + _ZN11QDataStream25setFloatingPointPrecisionENS_22FloatingPointPrecisionE @ 3826 NONAME + _ZN13QStateMachine16postDelayedEventEP6QEventi @ 3827 NONAME + _ZN13QStateMachine18cancelDelayedEventEi @ 3828 NONAME + _ZN13QStateMachine9postEventEP6QEventNS_13EventPriorityE @ 3829 NONAME + _ZN20QStateMachinePrivate13processEventsENS_19EventProcessingModeE @ 3830 NONAME + _ZN20QStateMachinePrivate19handleFilteredEventEP7QObjectP6QEvent @ 3831 NONAME + _ZN20QStateMachinePrivate22cancelAllDelayedEventsEv @ 3832 NONAME + _ZN4QUrl13fromUserInputERK7QString @ 3833 NONAME + _ZNK11QDataStream22floatingPointPrecisionEv @ 3834 NONAME + qt_sine_table @ 3835 NONAME DATA 1024 diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index aad8b68..581d3bc 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -11631,7 +11631,7 @@ EXPORTS qt_pixmap_cleanup_hook @ 11630 NONAME DATA 4 qt_pixmap_cleanup_hook_64 @ 11631 NONAME DATA 4 qt_tab_all_widgets @ 11632 NONAME DATA 1 - _Z17qDrawBorderPixmapP8QPainterRK5QRectRK8QMarginsRK7QPixmapS3_S6_RK10QTileRules @ 11633 NONAME + _Z17qDrawBorderPixmapP8QPainterRK5QRectRK8QMarginsRK7QPixmapS3_S6_RK10QTileRules @ 11633 NONAME ABSENT _Z17qHasPixmapTextureRK6QBrush @ 11634 NONAME _Z22qt_setQtEnableTestFontb @ 11635 NONAME _Z25qt_translateRawTouchEventP7QWidgetN11QTouchEvent10DeviceTypeERK5QListINS1_10TouchPointEE @ 11636 NONAME @@ -11824,7 +11824,7 @@ EXPORTS _ZN14QPaintEngineExC2Ev @ 11823 NONAME _ZN14QWidgetPrivate10allWidgetsE @ 11824 NONAME DATA 4 _ZN14QWidgetPrivate13setWSGeometryEbRK5QRect @ 11825 NONAME - _ZN14QWidgetPrivate33handleSymbianDeferredFocusChangedEv @ 11826 NONAME + _ZN14QWidgetPrivate33handleSymbianDeferredFocusChangedEv @ 11826 NONAME ABSENT _ZN15QDockAreaLayout13separatorMoveERK5QListIiERK6QPointS6_ @ 11827 NONAME _ZN15QDockAreaLayout4infoERK5QListIiE @ 11828 NONAME _ZN15QDockAreaLayout4itemERK5QListIiE @ 11829 NONAME @@ -12984,9 +12984,9 @@ EXPORTS _ZN16QS60MainDocumentD0Ev @ 12983 NONAME _ZN16QS60MainDocumentD1Ev @ 12984 NONAME _ZN16QS60MainDocumentD2Ev @ 12985 NONAME - _ZN17QPixmapBlurFilter11setBlurHintENS_8BlurHintE @ 12986 NONAME - _ZN19QGraphicsBlurEffect11setBlurHintENS_8BlurHintE @ 12987 NONAME - _ZN19QGraphicsBlurEffect15blurHintChangedENS_8BlurHintE @ 12988 NONAME + _ZN17QPixmapBlurFilter11setBlurHintENS_8BlurHintE @ 12986 NONAME ABSENT + _ZN19QGraphicsBlurEffect11setBlurHintENS_8BlurHintE @ 12987 NONAME ABSENT + _ZN19QGraphicsBlurEffect15blurHintChangedENS_8BlurHintE @ 12988 NONAME ABSENT _ZN19QS60MainApplication15CreateDocumentLEv @ 12989 NONAME _ZN19QS60MainApplicationC1Ev @ 12990 NONAME _ZN19QS60MainApplicationC2Ev @ 12991 NONAME @@ -13001,7 +13001,7 @@ EXPORTS _ZNK19QGraphicsBlurEffect8blurHintEv @ 13000 NONAME _ZNK19QS60MainApplication16ResourceFileNameEv @ 13001 NONAME _ZNK19QS60MainApplication9AppDllUidEv @ 13002 NONAME - _ZNK21QGraphicsAnchorLayout12hasConflictsEv @ 13003 NONAME + _ZNK21QGraphicsAnchorLayout12hasConflictsEv @ 13003 NONAME ABSENT _ZNK7QPixmap17toSymbianRSgImageEv @ 13004 NONAME _ZTI15QSoftKeyManager @ 13005 NONAME _ZTV15QSoftKeyManager @ 13006 NONAME @@ -13009,4 +13009,97 @@ EXPORTS _ZThn24_N13QS60MainAppUi15DynInitMenuBarLEiP11CEikMenuBar @ 13008 NONAME _ZThn24_N13QS60MainAppUi16DynInitMenuPaneLEiP12CEikMenuPane @ 13009 NONAME _ZThn88_N13QS60MainAppUi26HandleStatusPaneSizeChangeEv @ 13010 NONAME + _Z12qDrawPixmapsP8QPainterPKN12QDrawPixmaps4DataEiRK7QPixmap6QFlagsINS1_11DrawingHintEE @ 13011 NONAME + _Z17qDrawBorderPixmapP8QPainterRK5QRectRK8QMarginsRK7QPixmapS3_S6_RK10QTileRules6QFlagsIN17QDrawBorderPixmap11DrawingHintEE @ 13012 NONAME + _ZN10QImageData6createEPhiiiN6QImage6FormatEb @ 13013 NONAME + _ZN10QImageData6createERK5QSizeN6QImage6FormatEi @ 13014 NONAME + _ZN10QImageDataC1Ev @ 13015 NONAME + _ZN10QImageDataC2Ev @ 13016 NONAME + _ZN10QImageDataD1Ev @ 13017 NONAME + _ZN10QImageDataD2Ev @ 13018 NONAME + _ZN13QGraphicsItem11stackBeforeEPKS_ @ 13019 NONAME + _ZN13QGraphicsItem16setPanelModalityENS_13PanelModalityE @ 13020 NONAME + _ZN14QPaintEngineEx11drawPixmapsEPKN12QDrawPixmaps4DataEiRK7QPixmap6QFlagsINS0_11DrawingHintEE @ 13021 NONAME + _ZN14QWidgetPrivate21activateSymbianWindowEv @ 13022 NONAME + _ZN17QAbstractItemView20setDefaultDropActionEN2Qt10DropActionE @ 13023 NONAME + _ZN17QPixmapBlurFilter11setBlurHintEN2Qt10RenderHintE @ 13024 NONAME + _ZN19QApplicationPrivate16load_testabilityE @ 13025 NONAME DATA 1 + _ZN19QGraphicsBlurEffect11setBlurHintEN2Qt10RenderHintE @ 13026 NONAME + _ZN19QGraphicsBlurEffect15blurHintChangedEN2Qt10RenderHintE @ 13027 NONAME + _ZN20QGraphicsBloomEffect11qt_metacallEN11QMetaObject4CallEiPPv @ 13028 NONAME + _ZN20QGraphicsBloomEffect11qt_metacastEPKc @ 13029 NONAME + _ZN20QGraphicsBloomEffect11setBlurHintEN2Qt10RenderHintE @ 13030 NONAME + _ZN20QGraphicsBloomEffect11setStrengthEf @ 13031 NONAME + _ZN20QGraphicsBloomEffect13setBlurRadiusEi @ 13032 NONAME + _ZN20QGraphicsBloomEffect13setBrightnessEi @ 13033 NONAME + _ZN20QGraphicsBloomEffect15blurHintChangedEN2Qt10RenderHintE @ 13034 NONAME + _ZN20QGraphicsBloomEffect15strengthChangedEf @ 13035 NONAME + _ZN20QGraphicsBloomEffect16staticMetaObjectE @ 13036 NONAME DATA 16 + _ZN20QGraphicsBloomEffect17blurRadiusChangedEi @ 13037 NONAME + _ZN20QGraphicsBloomEffect17brightnessChangedEi @ 13038 NONAME + _ZN20QGraphicsBloomEffect19getStaticMetaObjectEv @ 13039 NONAME + _ZN20QGraphicsBloomEffect4drawEP8QPainterP21QGraphicsEffectSource @ 13040 NONAME + _ZN20QGraphicsBloomEffectC1EP7QObject @ 13041 NONAME + _ZN20QGraphicsBloomEffectC2EP7QObject @ 13042 NONAME + _ZN20QGraphicsBloomEffectD0Ev @ 13043 NONAME + _ZN20QGraphicsBloomEffectD1Ev @ 13044 NONAME + _ZN20QGraphicsBloomEffectD2Ev @ 13045 NONAME + _ZN20QGraphicsItemPrivate28ensureSequentialSiblingIndexEv @ 13046 NONAME + _ZN28QGraphicsAnchorLayoutPrivate11solveMinMaxE5QListIP18QSimplexConstraintE9GraphPathPfS5_ @ 13047 NONAME + _ZN28QGraphicsAnchorLayoutPrivate12oppositeEdgeEN2Qt11AnchorPointE @ 13048 NONAME + _ZN28QGraphicsAnchorLayoutPrivate12removeAnchorEP12AnchorVertexS1_ @ 13049 NONAME + _ZN28QGraphicsAnchorLayoutPrivate12removeVertexEP19QGraphicsLayoutItemN2Qt11AnchorPointE @ 13050 NONAME + _ZN28QGraphicsAnchorLayoutPrivate13getGraphPartsENS_11OrientationE @ 13051 NONAME + _ZN28QGraphicsAnchorLayoutPrivate13removeAnchorsEP19QGraphicsLayoutItem @ 13052 NONAME + _ZN28QGraphicsAnchorLayoutPrivate13setAnchorSizeEP10AnchorDataPKf @ 13053 NONAME + _ZN28QGraphicsAnchorLayoutPrivate13simplifyGraphENS_11OrientationE @ 13054 NONAME + _ZN28QGraphicsAnchorLayoutPrivate14solvePreferredE5QListIP18QSimplexConstraintE @ 13055 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15calculateGraphsENS_11OrientationE @ 13056 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15calculateGraphsEv @ 13057 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15createItemEdgesEP19QGraphicsLayoutItem @ 13058 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15edgeOrientationEN2Qt11AnchorPointE @ 13059 NONAME + _ZN28QGraphicsAnchorLayoutPrivate15interpolateEdgeEP12AnchorVertexP10AnchorDataNS_11OrientationE @ 13060 NONAME + _ZN28QGraphicsAnchorLayoutPrivate16addAnchor_helperEP19QGraphicsLayoutItemN2Qt11AnchorPointES1_S3_P10AnchorData @ 13061 NONAME + _ZN28QGraphicsAnchorLayoutPrivate17addInternalVertexEP19QGraphicsLayoutItemN2Qt11AnchorPointE @ 13062 NONAME + _ZN28QGraphicsAnchorLayoutPrivate17createLayoutEdgesEv @ 13063 NONAME + _ZN28QGraphicsAnchorLayoutPrivate17deleteLayoutEdgesEv @ 13064 NONAME + _ZN28QGraphicsAnchorLayoutPrivate18setItemsGeometriesERK6QRectF @ 13065 NONAME + _ZN28QGraphicsAnchorLayoutPrivate19createCenterAnchorsEP19QGraphicsLayoutItemN2Qt11AnchorPointE @ 13066 NONAME + _ZN28QGraphicsAnchorLayoutPrivate19removeAnchor_helperEP12AnchorVertexS1_ @ 13067 NONAME + _ZN28QGraphicsAnchorLayoutPrivate19removeCenterAnchorsEP19QGraphicsLayoutItemN2Qt11AnchorPointEb @ 13068 NONAME + _ZN28QGraphicsAnchorLayoutPrivate20constraintsFromPathsENS_11OrientationE @ 13069 NONAME + _ZN28QGraphicsAnchorLayoutPrivate20correctEdgeDirectionERP19QGraphicsLayoutItemRN2Qt11AnchorPointES2_S5_ @ 13070 NONAME + _ZN28QGraphicsAnchorLayoutPrivate20removeInternalVertexEP19QGraphicsLayoutItemN2Qt11AnchorPointE @ 13071 NONAME + _ZN28QGraphicsAnchorLayoutPrivate22restoreSimplifiedGraphENS_11OrientationE @ 13072 NONAME + _ZN28QGraphicsAnchorLayoutPrivate22simplifyGraphIterationENS_11OrientationE @ 13073 NONAME + _ZN28QGraphicsAnchorLayoutPrivate23removeCenterConstraintsEP19QGraphicsLayoutItemNS_11OrientationE @ 13074 NONAME + _ZN28QGraphicsAnchorLayoutPrivate23setupEdgesInterpolationENS_11OrientationE @ 13075 NONAME + _ZN28QGraphicsAnchorLayoutPrivate24calculateVertexPositionsENS_11OrientationE @ 13076 NONAME + _ZN28QGraphicsAnchorLayoutPrivate24constraintsFromSizeHintsERK5QListIP10AnchorDataE @ 13077 NONAME + _ZN28QGraphicsAnchorLayoutPrivate24interpolateParallelEdgesEP12AnchorVertexP18ParallelAnchorDataNS_11OrientationE @ 13078 NONAME + _ZN28QGraphicsAnchorLayoutPrivate26interpolateSequentialEdgesEP12AnchorVertexP20SequentialAnchorDataNS_11OrientationE @ 13079 NONAME + _ZN28QGraphicsAnchorLayoutPrivate27setAnchorSizeHintsFromItemsENS_11OrientationE @ 13080 NONAME + _ZN28QGraphicsAnchorLayoutPrivate9addAnchorEP19QGraphicsLayoutItemN2Qt11AnchorPointES1_S3_Pf @ 13081 NONAME + _ZN28QGraphicsAnchorLayoutPrivate9findPathsENS_11OrientationE @ 13082 NONAME + _ZN28QGraphicsAnchorLayoutPrivate9getAnchorEP19QGraphicsLayoutItemN2Qt11AnchorPointES1_S3_ @ 13083 NONAME + _ZN28QGraphicsAnchorLayoutPrivateC1Ev @ 13084 NONAME + _ZN28QGraphicsAnchorLayoutPrivateC2Ev @ 13085 NONAME + _ZNK10QImageData19checkForAlphaPixelsEv @ 13086 NONAME + _ZNK10QImageData9doImageIOEPK6QImageP12QImageWriteri @ 13087 NONAME + _ZNK13QGraphicsItem13panelModalityEv @ 13088 NONAME + _ZNK13QGraphicsItem21isBlockedByModalPanelEPPS_ @ 13089 NONAME + _ZNK17QAbstractItemView17defaultDropActionEv @ 13090 NONAME + _ZNK20QGraphicsBloomEffect10blurRadiusEv @ 13091 NONAME + _ZNK20QGraphicsBloomEffect10brightnessEv @ 13092 NONAME + _ZNK20QGraphicsBloomEffect10metaObjectEv @ 13093 NONAME + _ZNK20QGraphicsBloomEffect15boundingRectForERK6QRectF @ 13094 NONAME + _ZNK20QGraphicsBloomEffect8blurHintEv @ 13095 NONAME + _ZNK20QGraphicsBloomEffect8strengthEv @ 13096 NONAME + _ZNK28QGraphicsAnchorLayoutPrivate10anchorSizeEPK10AnchorDataPfS3_S3_ @ 13097 NONAME + _ZNK28QGraphicsAnchorLayoutPrivate12hasConflictsEv @ 13098 NONAME + _ZNK28QGraphicsAnchorLayoutPrivate16effectiveSpacingENS_11OrientationE @ 13099 NONAME + _ZTI20QGraphicsBloomEffect @ 13100 NONAME + _ZTI28QGraphicsAnchorLayoutPrivate @ 13101 NONAME + _ZTV20QGraphicsBloomEffect @ 13102 NONAME + _ZTV28QGraphicsAnchorLayoutPrivate @ 13103 NONAME diff --git a/src/s60installs/eabi/QtNetworku.def b/src/s60installs/eabi/QtNetworku.def index 5188872..ab4562c 100644 --- a/src/s60installs/eabi/QtNetworku.def +++ b/src/s60installs/eabi/QtNetworku.def @@ -1353,7 +1353,7 @@ EXPORTS _ZN10QSslSocket22connectToHostEncryptedERK7QStringtS2_6QFlagsIN9QIODevice12OpenModeFlagEE @ 1352 NONAME _ZN13QNetworkReply15ignoreSslErrorsERK5QListI9QSslErrorE @ 1353 NONAME _ZN15QAbstractSocket12socketOptionENS_12SocketOptionE @ 1354 NONAME - _ZN15QAbstractSocket15setSocketOptionENS_12SocketOptionE8QVariant @ 1355 NONAME + _ZN15QAbstractSocket15setSocketOptionENS_12SocketOptionERK8QVariant @ 1355 NONAME _ZN17QHttpNetworkReply15ignoreSslErrorsERK5QListI9QSslErrorE @ 1356 NONAME _ZN17QHttpNetworkReply16dataSendProgressExx @ 1357 NONAME _ZN17QHttpNetworkReply7readAnyEv @ 1358 NONAME @@ -1379,7 +1379,7 @@ EXPORTS _ZN19QHttpNetworkRequest20setPipeliningAllowedEb @ 1378 NONAME _ZN19QNativeSocketEngine19getStaticMetaObjectEv @ 1379 NONAME _ZN19QSocks5SocketEngine19getStaticMetaObjectEv @ 1380 NONAME - _ZN20QNetworkProxyFactory32setUseSystemConfigurationEnabledEb @ 1381 NONAME + _ZN20QNetworkProxyFactory25setUseSystemConfigurationEb @ 1381 NONAME _ZN21QAbstractNetworkCache19getStaticMetaObjectEv @ 1382 NONAME _ZN21QAbstractSocketEngine19getStaticMetaObjectEv @ 1383 NONAME _ZN21QNetworkAccessManager19getStaticMetaObjectEv @ 1384 NONAME diff --git a/src/s60installs/eabi/QtScriptu.def b/src/s60installs/eabi/QtScriptu.def index 40d3577..cca0a2a 100644 --- a/src/s60installs/eabi/QtScriptu.def +++ b/src/s60installs/eabi/QtScriptu.def @@ -1,6 +1,6 @@ EXPORTS _Z14qScriptConnectP7QObjectPKcRK12QScriptValueS5_ @ 1 NONAME - _Z14qt_scriptToXmlRK7QStringi @ 2 NONAME + _Z14qt_scriptToXmlRK7QStringi @ 2 NONAME ABSENT _Z17qScriptDisconnectP7QObjectPKcRK12QScriptValueS5_ @ 3 NONAME _ZN11QScriptableC1Ev @ 4 NONAME _ZN11QScriptableC2Ev @ 5 NONAME @@ -189,11 +189,11 @@ EXPORTS _ZN24QScriptSyntaxCheckResultD1Ev @ 188 NONAME _ZN24QScriptSyntaxCheckResultD2Ev @ 189 NONAME _ZN24QScriptSyntaxCheckResultaSERKS_ @ 190 NONAME - _ZN25QScriptEngineAgentPrivateC1Ev @ 191 NONAME - _ZN25QScriptEngineAgentPrivateC2Ev @ 192 NONAME - _ZN25QScriptEngineAgentPrivateD0Ev @ 193 NONAME - _ZN25QScriptEngineAgentPrivateD1Ev @ 194 NONAME - _ZN25QScriptEngineAgentPrivateD2Ev @ 195 NONAME + _ZN25QScriptEngineAgentPrivateC1Ev @ 191 NONAME ABSENT + _ZN25QScriptEngineAgentPrivateC2Ev @ 192 NONAME ABSENT + _ZN25QScriptEngineAgentPrivateD0Ev @ 193 NONAME ABSENT + _ZN25QScriptEngineAgentPrivateD1Ev @ 194 NONAME ABSENT + _ZN25QScriptEngineAgentPrivateD2Ev @ 195 NONAME ABSENT _ZN28QScriptClassPropertyIteratorC2ERK12QScriptValue @ 196 NONAME _ZN28QScriptClassPropertyIteratorC2ERK12QScriptValueR35QScriptClassPropertyIteratorPrivate @ 197 NONAME _ZN28QScriptClassPropertyIteratorD0Ev @ 198 NONAME @@ -586,4 +586,18 @@ EXPORTS _ZThn8_N22QScriptExtensionPluginD1Ev @ 585 NONAME _ZlsR11QDataStreamRK18QScriptContextInfo @ 586 NONAME _ZrsR11QDataStreamR18QScriptContextInfo @ 587 NONAME + _Z22qt_script_isJITEnabledv @ 588 NONAME + _ZN12QScriptValueC1EP19QScriptValuePrivate @ 589 NONAME + _ZN12QScriptValueC2EP19QScriptValuePrivate @ 590 NONAME + _ZN13QScriptEngine19getStaticMetaObjectEv @ 591 NONAME + _ZN22QScriptExtensionPlugin19getStaticMetaObjectEv @ 592 NONAME + _ZN25QScriptEngineAgentPrivate11atStatementERKN5QTJSC17DebuggerCallFrameEiii @ 593 NONAME + _ZN25QScriptEngineAgentPrivate11returnEventERKN5QTJSC17DebuggerCallFrameEii @ 594 NONAME + _ZN25QScriptEngineAgentPrivate12evaluateStopERKN5QTJSC7JSValueEi @ 595 NONAME + _ZN25QScriptEngineAgentPrivate12functionExitERKN5QTJSC7JSValueEi @ 596 NONAME + _ZN25QScriptEngineAgentPrivate14exceptionCatchERKN5QTJSC17DebuggerCallFrameEi @ 597 NONAME + _ZN25QScriptEngineAgentPrivate14exceptionThrowERKN5QTJSC17DebuggerCallFrameEib @ 598 NONAME + _ZN25QScriptEngineAgentPrivate18didReachBreakpointERKN5QTJSC17DebuggerCallFrameEiii @ 599 NONAME + _ZN25QScriptEngineAgentPrivate6attachEv @ 600 NONAME + _ZN25QScriptEngineAgentPrivate6detachEv @ 601 NONAME diff --git a/src/s60installs/eabi/QtSqlu.def b/src/s60installs/eabi/QtSqlu.def index 99f0d00..4d4791a 100644 --- a/src/s60installs/eabi/QtSqlu.def +++ b/src/s60installs/eabi/QtSqlu.def @@ -236,7 +236,7 @@ EXPORTS _ZN9QSqlFieldC1ERKS_ @ 235 NONAME _ZN9QSqlFieldC1Ev @ 236 NONAME ABSENT _ZN9QSqlFieldC2ERK7QString @ 237 NONAME ABSENT - _ZN9QSqlFieldC2ERK7QStringN8QVariant4TypeE @ 238 NONAME ABSENT + _ZN9QSqlFieldC2ERK7QStringN8QVariant4TypeE @ 238 NONAME _ZN9QSqlFieldC2ERKS_ @ 239 NONAME _ZN9QSqlFieldC2Ev @ 240 NONAME ABSENT _ZN9QSqlFieldD1Ev @ 241 NONAME -- cgit v0.12 From 3865912d4a6c31a4981e1831e2af8d59f3eb4ac0 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Wed, 7 Oct 2009 08:40:14 +1000 Subject: Fixed thread lockup in win32 backend for QAudioOutput. -Was not closing the WaveOut on cleanup, fixed. -Was emitting signal in critical section, fixed. Reviewed-by:Bill King --- src/multimedia/audio/qaudiooutput_win32_p.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index ef4bf0e..2c4a1c2 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -189,7 +189,6 @@ void QAudioOutputPrivate::stop() { if(deviceState == QAudio::StopState) return; - deviceState = QAudio::StopState; close(); if(!pullMode && audioSource) { delete audioSource; @@ -465,13 +464,15 @@ bool QAudioOutputPrivate::deviceReady() } else if(l == 0) { bytesAvailable = bytesFree(); + int check = 0; EnterCriticalSection(&waveOutCriticalSection); - if(waveFreeBlockCount == buffer_size/period_size) { + check = waveFreeBlockCount; + LeaveCriticalSection(&waveOutCriticalSection); + if(check == buffer_size/period_size) { errorState = QAudio::UnderrunError; deviceState = QAudio::IdleState; emit stateChanged(deviceState); } - LeaveCriticalSection(&waveOutCriticalSection); } else if(l < 0) { bytesAvailable = bytesFree(); -- cgit v0.12 From 8b7e766aa42739df8998ec9c1e94087b965ac87b Mon Sep 17 00:00:00 2001 From: Jason McDonald Date: Wed, 7 Oct 2009 15:18:50 +1000 Subject: Fix build error introduced in change ffeb6900. Change ffeb6900 renamed a function but didn't rename all the calls. Reviewed-by: Trust Me --- examples/webkit/fancybrowser/mainwindow.cpp | 2 +- examples/webkit/googlechat/main.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/webkit/fancybrowser/mainwindow.cpp b/examples/webkit/fancybrowser/mainwindow.cpp index 2adfa20..a3293b8 100644 --- a/examples/webkit/fancybrowser/mainwindow.cpp +++ b/examples/webkit/fancybrowser/mainwindow.cpp @@ -56,7 +56,7 @@ MainWindow::MainWindow() file.close(); //! [1] - QNetworkProxyFactory::setUseSystemConfigurationEnabled(true); + QNetworkProxyFactory::setUseSystemConfiguration(true); //! [2] view = new QWebView(this); diff --git a/examples/webkit/googlechat/main.cpp b/examples/webkit/googlechat/main.cpp index fd08114..6b5e11f 100644 --- a/examples/webkit/googlechat/main.cpp +++ b/examples/webkit/googlechat/main.cpp @@ -47,7 +47,7 @@ int main(int argc, char * argv[]) { QApplication app(argc, argv); - QNetworkProxyFactory::setUseSystemConfigurationEnabled(true); + QNetworkProxyFactory::setUseSystemConfiguration(true); GoogleChat *chat = new GoogleChat; chat->show(); -- cgit v0.12 From 087b624c616bc1b3dbe850a74d0737fffc08bec2 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 7 Oct 2009 09:55:11 +0200 Subject: implement qHash function for QScriptString Reviewed-by: Olivier Goffart --- src/script/api/qscriptstring.cpp | 8 ++++++++ src/script/api/qscriptstring.h | 2 ++ src/script/api/qscriptstring_p.h | 7 +++++++ tests/auto/qscriptstring/tst_qscriptstring.cpp | 17 +++++++++++++++++ 4 files changed, 34 insertions(+) diff --git a/src/script/api/qscriptstring.cpp b/src/script/api/qscriptstring.cpp index 65bd818..c2362da 100644 --- a/src/script/api/qscriptstring.cpp +++ b/src/script/api/qscriptstring.cpp @@ -195,4 +195,12 @@ QScriptString::operator QString() const return toString(); } +uint qHash(const QScriptString &key) +{ + QScriptStringPrivate *d = QScriptStringPrivate::get(key); + if (!d) + return 0; + return qHash(d->identifier.ustring().rep()); +} + QT_END_NAMESPACE diff --git a/src/script/api/qscriptstring.h b/src/script/api/qscriptstring.h index e0a808e..40d156c 100644 --- a/src/script/api/qscriptstring.h +++ b/src/script/api/qscriptstring.h @@ -76,6 +76,8 @@ private: Q_DECLARE_PRIVATE(QScriptString) }; +Q_SCRIPT_EXPORT uint qHash(const QScriptString &key); + QT_END_NAMESPACE QT_END_HEADER diff --git a/src/script/api/qscriptstring_p.h b/src/script/api/qscriptstring_p.h index 25ce702..d3bb47d 100644 --- a/src/script/api/qscriptstring_p.h +++ b/src/script/api/qscriptstring_p.h @@ -73,6 +73,8 @@ public: inline ~QScriptStringPrivate(); static inline void init(QScriptString &q, QScriptStringPrivate *d); + static inline QScriptStringPrivate *get(const QScriptString &q); + inline void detachFromEngine(); QBasicAtomicInt ref; @@ -101,6 +103,11 @@ inline void QScriptStringPrivate::init(QScriptString &q, QScriptStringPrivate *d q.d_ptr = d; } +inline QScriptStringPrivate *QScriptStringPrivate::get(const QScriptString &q) +{ + return const_cast(q.d_func()); +} + inline void QScriptStringPrivate::detachFromEngine() { engine = 0; diff --git a/tests/auto/qscriptstring/tst_qscriptstring.cpp b/tests/auto/qscriptstring/tst_qscriptstring.cpp index 0968b61..e1a4bc1 100644 --- a/tests/auto/qscriptstring/tst_qscriptstring.cpp +++ b/tests/auto/qscriptstring/tst_qscriptstring.cpp @@ -58,6 +58,7 @@ public: private slots: void test(); + void hash(); }; tst_QScriptString::tst_QScriptString() @@ -138,5 +139,21 @@ void tst_QScriptString::test() } } +void tst_QScriptString::hash() +{ + QScriptEngine engine; + QHash stringToInt; + QScriptString foo = engine.toStringHandle("foo"); + QScriptString bar = engine.toStringHandle("bar"); + QVERIFY(!stringToInt.contains(foo)); + for (int i = 0; i < 1000000; ++i) + stringToInt.insert(foo, 123); + QCOMPARE(stringToInt.value(foo), 123); + QVERIFY(!stringToInt.contains(bar)); + stringToInt.insert(bar, 456); + QCOMPARE(stringToInt.value(bar), 456); + QCOMPARE(stringToInt.value(foo), 123); +} + QTEST_MAIN(tst_QScriptString) #include "tst_qscriptstring.moc" -- cgit v0.12 From c14455b78904f25e724cd928652c49f9583c6aa0 Mon Sep 17 00:00:00 2001 From: ninerider Date: Wed, 7 Oct 2009 10:50:36 +0200 Subject: Whe STL is not enabled, most of the test threads failed to start. A second worker function that was not defined in the descendant classes was used in these cases. The missing worker functions have been supplied and some tests skipped that depend on iterator ranges. Reviewed-by: Joerg --- .../tst_qtconcurrentiteratekernel.cpp | 27 +++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp b/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp index a5748ae..3b1e18f 100644 --- a/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp +++ b/tests/auto/qtconcurrentiteratekernel/tst_qtconcurrentiteratekernel.cpp @@ -66,6 +66,7 @@ struct TestIterator }; #include +#ifndef QT_NO_STL namespace std { template <> struct iterator_traits @@ -79,6 +80,7 @@ int distance(TestIterator &a, TestIterator &b) } } +#endif #include @@ -112,7 +114,7 @@ class PrintFor : public IterateKernel { public: PrintFor(TestIterator begin, TestIterator end) : IterateKernel(begin, end) {iterations = 0; } - inline bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) + bool runIterations(TestIterator/*beginIterator*/, int begin, int end, void *) { iterations.fetchAndAddRelaxed(end - begin); #ifdef PRINT @@ -120,6 +122,11 @@ public: #endif return false; } + bool runIteration(TestIterator it, int index , void *result) + { + return runIterations(it, index, index + 1, result); + } + }; class SleepPrintFor : public IterateKernel @@ -135,6 +142,10 @@ public: #endif return false; } + bool runIteration(TestIterator it, int index , void *result) + { + return runIterations(it, index, index + 1, result); + } }; @@ -165,6 +176,10 @@ public: counter.fetchAndAddRelaxed(end - begin); return false; } + bool runIteration(TestIterator it, int index , void *result) + { + return runIterations(it, index, index + 1, result); + } }; void tst_iteratekernel::stresstest() @@ -215,6 +230,10 @@ public: return false; } + bool runIteration(TestIterator it, int index , void *result) + { + return runIterations(it, index, index + 1, result); + } bool shouldThrottleThread() { @@ -254,6 +273,9 @@ public: void tst_iteratekernel::blockSize() { +#ifdef QT_NO_STL + QSKIP("Missing stl iterators prevent correct block size calculation", SkipAll); +#endif const int expectedMinimumBlockSize = 1024 / QThread::idealThreadCount(); BlockSizeRecorder(0, 10000).startBlocking(); if (peakBlockSize < expectedMinimumBlockSize) @@ -276,6 +298,9 @@ public: void tst_iteratekernel::multipleResults() { +#ifdef QT_NO_STL + QSKIP("Missing stl iterators prevent correct summation", SkipAll); +#endif QFuture f = startThreadEngine(new MultipleResultsFor(0, 10)).startAsynchronously(); QCOMPARE(f.results().count() , 10); QCOMPARE(f.resultAt(0), 0); -- cgit v0.12 From d6d0b2ef5223b4a40e8907104eb1d9e827507a42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Wed, 7 Oct 2009 10:51:26 +0200 Subject: Cosmetic fixes to the previous patches. There is only one change in the actual code here, and it simply removes an unnecessary initialization of hasSize in the ctors of the composite anchors. --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 68 +++++++++++++----------- src/gui/graphicsview/qgraphicsanchorlayout_p.h | 2 - src/gui/graphicsview/qsimplex_p.cpp | 4 +- src/gui/graphicsview/qsimplex_p.h | 4 +- 4 files changed, 40 insertions(+), 38 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 87f5aa0..34071cc 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -2409,47 +2409,51 @@ bool QGraphicsAnchorLayoutPrivate::solvePreferred(QList co return feasible; } -/*! Calculate the "expanding" keyframe +/*! + \internal + Calculate the "expanding" keyframe - This new keyframe sits between the already existing sizeAtPreferred and - sizeAtMaximum keyframes. Its goal is to modify the interpolation between - the latter as to respect the "expanding" size policy of some anchors. + This new keyframe sits between the already existing sizeAtPreferred and + sizeAtMaximum keyframes. Its goal is to modify the interpolation between + the latter as to respect the "expanding" size policy of some anchors. - Previously all items would be subject to a linear interpolation between - sizeAtPreferred and sizeAtMaximum values. This will change now, the - expanding anchors will change their size before the others. To calculate - this keyframe we use the following logic: + Previously all items would be subject to a linear interpolation between + sizeAtPreferred and sizeAtMaximum values. This will change now, the + expanding anchors will change their size before the others. To calculate + this keyframe we use the following logic: - 1) Ask each anchor for their desired expanding size (ad->expSize), this - value depends on the anchor expanding property in the following way: + 1) Ask each anchor for their desired expanding size (ad->expSize), this + value depends on the anchor expanding property in the following way: - - Expanding anchors want to grow towards their maximum size - - Non-expanding anchors want to remain at their preferred size. - - Composite anchors want to grow towards somewhere between their - preferred sizes. (*) + - Expanding normal anchors want to grow towards their maximum size + - Non-expanding normal anchors want to remain at their preferred size. + - Sequential anchors wants to grow towards a size that is calculated by: + summarizing it's child anchors, where it will use preferred size for non-expanding anchors + and maximum size for expanding anchors. + - Parallel anchors want to grow towards the smallest maximum size of all the expanding anchors. - 2) Clamp their desired values to the value they assume in the neighbour - keyframes (sizeAtPreferred and sizeAtExpanding) + 2) Clamp their desired values to the value they assume in the neighbour + keyframes (sizeAtPreferred and sizeAtExpanding) - 3) Run simplex with a setup that ensures the following: + 3) Run simplex with a setup that ensures the following: - a. Anchors will change their value from their sizeAtPreferred towards - their sizeAtMaximum as much as required to ensure that ALL anchors - reach their respective "desired" expanding sizes. + a. Anchors will change their value from their sizeAtPreferred towards + their sizeAtMaximum as much as required to ensure that ALL anchors + reach their respective "desired" expanding sizes. - b. No anchors will change their value beyond what is NEEDED to satisfy - the requirement above. + b. No anchors will change their value beyond what is NEEDED to satisfy + the requirement above. - The final result is that, at the "expanding" keyframe expanding anchors - will grow and take with them all anchors that are parallel to them. - However, non-expanding anchors will remain at their preferred size unless - they are forced to grow by a parallel expanding anchor. + The final result is that, at the "expanding" keyframe expanding anchors + will grow and take with them all anchors that are parallel to them. + However, non-expanding anchors will remain at their preferred size unless + they are forced to grow by a parallel expanding anchor. - Note: For anchors where the sizeAtPreferred is bigger than sizeAtPreferred, - the visual effect when the layout grows from its preferred size is - the following: Expanding anchors will keep their size while non - expanding ones will shrink. Only after non-expanding anchors have - shrinked all the way, the expanding anchors will start to shrink too. + Note: For anchors where the sizeAtPreferred is bigger than sizeAtMaximum, + the visual effect when the layout grows from its preferred size is + the following: Expanding anchors will keep their size while non + expanding ones will shrink. Only after non-expanding anchors have + shrinked all the way, the expanding anchors will start to shrink too. */ void QGraphicsAnchorLayoutPrivate::solveExpanding(QList constraints) { @@ -2495,7 +2499,7 @@ void QGraphicsAnchorLayoutPrivate::solveExpanding(QList co itemC->constant = qMax(boundedExpSize, ad->sizeAtMaximum); itemConstraints << itemC; - // Create objective to avoid the anchos from moving away from + // Create objective to avoid the anchors from moving away from // the preferred size more than the needed amount. (ensure 3.b) // The objective function is the distance between sizeAtPreferred // and sizeAtExpanding, it will be minimized. diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h index 1a74d85..24b25de 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h @@ -227,7 +227,6 @@ struct SequentialAnchorData : public AnchorData SequentialAnchorData() : AnchorData() { type = AnchorData::Sequential; - hasSize = true; #ifdef QT_DEBUG name = QLatin1String("SequentialAnchorData"); #endif @@ -256,7 +255,6 @@ struct ParallelAnchorData : public AnchorData : AnchorData(), firstEdge(first), secondEdge(second) { type = AnchorData::Parallel; - hasSize = true; // ### Those asserts force that both child anchors have the same direction, // but can't we simplify a pair of anchors in opposite directions? diff --git a/src/gui/graphicsview/qsimplex_p.cpp b/src/gui/graphicsview/qsimplex_p.cpp index 95003d2..b8f8fb4 100644 --- a/src/gui/graphicsview/qsimplex_p.cpp +++ b/src/gui/graphicsview/qsimplex_p.cpp @@ -519,11 +519,11 @@ qreal QSimplex::solver(solverFactor factor) solveMaxHelper(); collectResults(); - #ifdef QT_DEBUG +#ifdef QT_DEBUG for (int i = 0; i < constraints.size(); ++i) { Q_ASSERT(constraints[i]->isSatisfied()); } - #endif +#endif return factor * valueAt(0, columns - 1); } diff --git a/src/gui/graphicsview/qsimplex_p.h b/src/gui/graphicsview/qsimplex_p.h index b517cb9..51991a9 100644 --- a/src/gui/graphicsview/qsimplex_p.h +++ b/src/gui/graphicsview/qsimplex_p.h @@ -95,7 +95,7 @@ struct QSimplexConstraint QPair helper; QSimplexVariable * artificial; - #ifdef QT_DEBUG +#ifdef QT_DEBUG bool isSatisfied() { qreal leftHandSide(0); @@ -118,7 +118,7 @@ struct QSimplexConstraint return false; } } - #endif +#endif }; class QSimplex -- cgit v0.12 From 3715e8ff3cc61dd869ec2ae484d6323f97c0a80a Mon Sep 17 00:00:00 2001 From: ninerider Date: Wed, 7 Oct 2009 10:55:02 +0200 Subject: A test requiring an enter/leave signal to be emitted is skipped. Enter leave signals are not yet supported on Windows Mobile. Reviewed-by: Joerg --- tests/auto/qabstractitemview/tst_qabstractitemview.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp index 4e385d5..d6911d2 100644 --- a/tests/auto/qabstractitemview/tst_qabstractitemview.cpp +++ b/tests/auto/qabstractitemview/tst_qabstractitemview.cpp @@ -1225,6 +1225,9 @@ void tst_QAbstractItemView::task250754_fontChange() void tst_QAbstractItemView::task200665_itemEntered() { +#ifdef Q_OS_WINCE_WM + QSKIP("On Windows Mobile the mouse tracking is unavailable at the moment", SkipAll); +#endif //we test that view will emit entered //when the scrollbar move but not the mouse itself QStandardItemModel model(1000,1); -- cgit v0.12 From ee383b89f16a9a75a934076255bddbef5a075fa3 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 19 Aug 2009 15:50:45 +0200 Subject: Integrate the GuiPlatformPlugin interface This is an internal interface for plugins that can be provided by the platform to give platform-specific features by platforms built on top of Qt. We can easlily integrate Qt on Windows, Mac, Gnome, ... without any plugin because we can link to their respective library (dynamically if we don't want to depend on it). On Gnome, we can dynamically resolve Gtk+ symbols. This is however not possible for KDE or other platform built on top of Qt: we can't link against their library because they depend on us and we can't dynamically resolve the symbols because they are mangled (C++) So this plugin provides hooks inside Qt to be able to do things like native File or Color dialog, native icons, accurate reading of the config file, and so on. This is currently private API. Task-number: QT-406 Reviewed-by: Jens Bache-Wiig Reviewed-by: Oswald Buddenhagen --- examples/dialogs/standarddialogs/dialog.cpp | 5 - src/gui/dialogs/qcolordialog.cpp | 21 ++- src/gui/dialogs/qcolordialog_p.h | 1 + src/gui/dialogs/qfiledialog_p.h | 24 +-- src/gui/image/qicon.cpp | 11 +- src/gui/kernel/kernel.pri | 6 +- src/gui/kernel/qapplication.cpp | 38 +---- src/gui/kernel/qapplication_p.h | 1 - src/gui/kernel/qapplication_x11.cpp | 42 +---- src/gui/kernel/qguiplatformplugin.cpp | 231 ++++++++++++++++++++++++++++ src/gui/kernel/qguiplatformplugin_p.h | 122 +++++++++++++++ src/gui/kernel/qkde.cpp | 33 +++- src/gui/kernel/qkde_p.h | 9 +- src/gui/styles/qcommonstyle.cpp | 54 +------ src/gui/styles/qcommonstyle_p.h | 1 - 15 files changed, 441 insertions(+), 158 deletions(-) create mode 100644 src/gui/kernel/qguiplatformplugin.cpp create mode 100644 src/gui/kernel/qguiplatformplugin_p.h diff --git a/examples/dialogs/standarddialogs/dialog.cpp b/examples/dialogs/standarddialogs/dialog.cpp index c29d2dd..6e06190 100644 --- a/examples/dialogs/standarddialogs/dialog.cpp +++ b/examples/dialogs/standarddialogs/dialog.cpp @@ -150,11 +150,6 @@ Dialog::Dialog(QWidget *parent) native = new QCheckBox(this); native->setText("Use native file dialog."); native->setChecked(true); -#ifndef Q_WS_WIN -#ifndef Q_OS_MAC - native->hide(); -#endif -#endif QGridLayout *layout = new QGridLayout; layout->setColumnStretch(1, 1); layout->setColumnMinimumWidth(1, 250); diff --git a/src/gui/dialogs/qcolordialog.cpp b/src/gui/dialogs/qcolordialog.cpp index a7df999..44a82ef 100644 --- a/src/gui/dialogs/qcolordialog.cpp +++ b/src/gui/dialogs/qcolordialog.cpp @@ -62,6 +62,7 @@ #include "qmime.h" #include "qspinbox.h" #include "qdialogbuttonbox.h" +#include "private/qguiplatformplugin_p.h" #ifdef Q_WS_S60 #include "private/qt_s60_p.h" @@ -1454,6 +1455,8 @@ void QColorDialogPrivate::init(const QColor &initial) q->setSizeGripEnabled(false); q->setWindowTitle(QColorDialog::tr("Select Color")); + nativeDialogInUse = false; + nextCust = 0; QVBoxLayout *mainLay = new QVBoxLayout(q); // there's nothing in this dialog that benefits from sizing up @@ -1719,6 +1722,8 @@ void QColorDialog::setCurrentColor(const QColor &color) d->setCurrentQColor(color); d->setCocoaPanelColor(color); #endif + if (d->nativeDialogInUse) + qt_guiPlatformPlugin()->colorDialogSetCurrentColor(this, color); } QColor QColorDialog::currentColor() const @@ -1871,6 +1876,17 @@ void QColorDialog::setVisible(bool visible) setAttribute(Qt::WA_DontShowOnScreen, false); } } +#else + + if (!(d->opts & DontUseNativeDialog) && qt_guiPlatformPlugin()->colorDialogSetVisible(this, visible)) { + d->nativeDialogInUse = true; + // Set WA_DontShowOnScreen so that QDialog::setVisible(visible) below + // updates the state correctly, but skips showing the non-native version: + setAttribute(Qt::WA_DontShowOnScreen); + } else { + d->nativeDialogInUse = false; + setAttribute(Qt::WA_DontShowOnScreen, false); + } #endif QDialog::setVisible(visible); @@ -1970,8 +1986,8 @@ QRgb QColorDialog::getRgba(QRgb initial, bool *ok, QWidget *parent) QColorDialog::~QColorDialog() { -#if defined(Q_WS_MAC) Q_D(QColorDialog); +#if defined(Q_WS_MAC) if (d->delegate) { d->releaseCocoaColorPanelDelegate(); QColorDialogPrivate::sharedColorPanelAvailable = true; @@ -1985,6 +2001,9 @@ QColorDialog::~QColorDialog() settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), cusrgb[i]); } #endif + if (d->nativeDialogInUse) + qt_guiPlatformPlugin()->colorDialogDelete(this); + } diff --git a/src/gui/dialogs/qcolordialog_p.h b/src/gui/dialogs/qcolordialog_p.h index c7cabfb..81df503 100644 --- a/src/gui/dialogs/qcolordialog_p.h +++ b/src/gui/dialogs/qcolordialog_p.h @@ -114,6 +114,7 @@ public: QColorDialog::ColorDialogOptions opts; QPointer receiverToDisconnectOnClose; QByteArray memberToDisconnectOnClose; + bool nativeDialogInUse; #ifdef Q_WS_MAC void openCocoaColorPanel(const QColor &initial, diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h index 54fc0e0..44289d9 100644 --- a/src/gui/dialogs/qfiledialog_p.h +++ b/src/gui/dialogs/qfiledialog_p.h @@ -76,6 +76,8 @@ #include #include "qsidebar_p.h" #include "qfscompleter_p.h" +#include "../kernel/qguiplatformplugin_p.h" + #if defined (Q_OS_UNIX) #include @@ -405,17 +407,17 @@ inline QString QFileDialogPrivate::rootPath() const { #ifndef Q_WS_MAC // Dummies for platforms that don't use native dialogs: - inline void QFileDialogPrivate::deleteNativeDialog_sys() {} - inline bool QFileDialogPrivate::setVisible_sys(bool) { return false; } - inline QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys(){ return QDialog::Rejected; } - inline void QFileDialogPrivate::setDirectory_sys(const QString &) {} - inline QString QFileDialogPrivate::directory_sys() const { return QString(); } - inline void QFileDialogPrivate::selectFile_sys(const QString &) {} - inline QStringList QFileDialogPrivate::selectedFiles_sys() const { return QStringList(); } - inline void QFileDialogPrivate::setFilter_sys() {} - inline void QFileDialogPrivate::setNameFilters_sys(const QStringList &) {} - inline void QFileDialogPrivate::selectNameFilter_sys(const QString &) {} - inline QString QFileDialogPrivate::selectedNameFilter_sys() const { return QString(); } + inline void QFileDialogPrivate::deleteNativeDialog_sys() { qt_guiPlatformPlugin()->fileDialogDelete(q_func()); } + inline bool QFileDialogPrivate::setVisible_sys(bool visible) { return qt_guiPlatformPlugin()->fileDialogSetVisible(q_func(), visible); } + inline QDialog::DialogCode QFileDialogPrivate::dialogResultCode_sys(){ return qt_guiPlatformPlugin()->fileDialogResultCode(q_func()); } + inline void QFileDialogPrivate::setDirectory_sys(const QString &directory) { qt_guiPlatformPlugin()->fileDialogSetDirectory(q_func(), directory); } + inline QString QFileDialogPrivate::directory_sys() const { return qt_guiPlatformPlugin()->fileDialogDirectory(q_func()); } + inline void QFileDialogPrivate::selectFile_sys(const QString &filename) { qt_guiPlatformPlugin()->fileDialogSelectFile(q_func(), filename); } + inline QStringList QFileDialogPrivate::selectedFiles_sys() const { return qt_guiPlatformPlugin()->fileDialogSelectedFiles(q_func()); } + inline void QFileDialogPrivate::setFilter_sys() { qt_guiPlatformPlugin()->fileDialogSetFilter(q_func()); } + inline void QFileDialogPrivate::setNameFilters_sys(const QStringList &filters) { qt_guiPlatformPlugin()->fileDialogSetNameFilters(q_func(), filters); } + inline void QFileDialogPrivate::selectNameFilter_sys(const QString &filter) { qt_guiPlatformPlugin()->fileDialogSelectNameFilter(q_func(), filter); } + inline QString QFileDialogPrivate::selectedNameFilter_sys() const { return qt_guiPlatformPlugin()->fileDialogSelectedNameFilter(q_func()); } #endif QT_END_NAMESPACE diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index fce4508..3448459 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -54,6 +54,7 @@ #include "qvariant.h" #include "qcache.h" #include "qdebug.h" +#include "private/qguiplatformplugin_p.h" #ifdef Q_WS_MAC #include @@ -966,13 +967,9 @@ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback) QIcon icon; -#ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) { - icon = QKde::kdeIcon(name); - if (!icon.isNull()) - return icon; - } -#endif + icon = qt_guiPlatformPlugin()->loadIcon(name); + if (!icon.isNull()) + return icon; if (iconCache.contains(name)) { icon = *iconCache.object(name); diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 7cde384..760d73c 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -47,7 +47,8 @@ HEADERS += \ kernel/qgesture_p.h \ kernel/qstandardgestures.h \ kernel/qstandardgestures_p.h \ - kernel/qsoftkeymanager_p.h + kernel/qsoftkeymanager_p.h \ + kernel/qguiplatformplugin_p.h SOURCES += \ kernel/qaction.cpp \ @@ -79,7 +80,8 @@ SOURCES += \ kernel/qkeymapper.cpp \ kernel/qgesture.cpp \ kernel/qstandardgestures.cpp \ - kernel/qsoftkeymanager.cpp + kernel/qsoftkeymanager.cpp \ + kernel/qguiplatformplugin.cpp win32 { DEFINES += QT_NO_DIRECTDRAW diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp index 044fedd..43addb6 100644 --- a/src/gui/kernel/qapplication.cpp +++ b/src/gui/kernel/qapplication.cpp @@ -84,6 +84,8 @@ #include "qinputcontextfactory.h" #endif +#include "qguiplatformplugin_p.h" + #include #include @@ -788,6 +790,9 @@ void QApplicationPrivate::construct( qCritical("Library qttestability load failed!"); } } + + //make sure the plugin is loaded + qt_guiPlatformPlugin(); #endif } @@ -1955,38 +1960,7 @@ void QApplicationPrivate::setSystemFont(const QFont &font) */ QString QApplicationPrivate::desktopStyleKey() { -QString desktopstyle; -#if defined(Q_WS_WIN) && defined(Q_WS_WINCE) - if (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()) - desktopstyle = QLatin1String("WindowsMobile"); - else - desktopstyle = QLatin1String("WindowsCE"); - -#elif defined(Q_WS_WIN) - if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) - desktopstyle = QLatin1String("WindowsVista"); - else if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP - && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) - desktopstyle = QLatin1String("WindowsXP"); - else - desktopstyle = QLatin1String("Windows"); // default styles for Windows -#elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS) - desktopstyle = QLatin1String("CDE"); // default style for X11 on Solaris -#elif defined(Q_WS_S60) - desktopstyle = QLatin1String("S60"); // default style for Symbian with S60 -#elif defined(Q_OS_SYMBIAN) - desktopstyle = QLatin1String("Windows"); // default style for Symbian without S60 -#elif defined(Q_WS_X11) && defined(Q_OS_IRIX) - desktopstyle = QLatin1String("SGI"); // default style for X11 on IRIX -#elif defined(Q_WS_QWS) - desktopstyle = QLatin1String("Plastique"); // default style for X11 and small devices -#elif defined(Q_WS_X11) - desktopstyle = QApplicationPrivate::x11_desktop_style(); // default runtime dependant style for X11 -#elif defined(Q_WS_MAC) - desktopstyle = QLatin1String("Macintosh"); // default style for all Mac's -#endif - return desktopstyle; + return qt_guiPlatformPlugin()->styleName(); } /*! diff --git a/src/gui/kernel/qapplication_p.h b/src/gui/kernel/qapplication_p.h index 6036196..95b6d28 100644 --- a/src/gui/kernel/qapplication_p.h +++ b/src/gui/kernel/qapplication_p.h @@ -305,7 +305,6 @@ public: #if defined(Q_WS_X11) #ifndef QT_NO_SETTINGS - static QString x11_desktop_style(); static bool x11_apply_settings(); #endif static void reset_instance_pointer(); diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index e46a370..bf95684 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -85,6 +85,7 @@ #include "qtimer.h" #include "qlibrary.h" #include +#include "qguiplatformplugin_p.h" #include "qkde_p.h" #if !defined (QT_NO_TABLET) @@ -919,7 +920,7 @@ bool QApplicationPrivate::x11_apply_settings() QString stylename = settings.value(QLatin1String("style")).toString(); if (stylename.isEmpty() && QApplicationPrivate::styleOverride.isNull() && X11->use_xrender) { - stylename = x11_desktop_style(); + stylename = qt_guiPlatformPlugin()->styleName(); } static QString currentStyleName = stylename; @@ -1313,8 +1314,7 @@ static void qt_set_x11_resources(const char* font = 0, const char* fg = 0, pal.setColor(QPalette::Disabled, QPalette::Highlight, Qt::darkBlue); } - if (kdeColors) - pal = QKde::kdePalette().resolve(pal); + pal = qt_guiPlatformPlugin()->palette().resolve(pal); QApplicationPrivate::setSystemPalette(pal); QColor::setAllowX11ColorNames(allowX11ColorNames); } @@ -2560,42 +2560,6 @@ void qt_init(QApplicationPrivate *priv, int, #endif } - - // run-time search for default style -/*! - \internal -*/ -QString QApplicationPrivate::x11_desktop_style() -{ - QString stylename; - switch(X11->desktopEnvironment) { - case DE_KDE: - stylename = QKde::kdeStyle(); - break; - case DE_GNOME: { - QStringList availableStyles = QStyleFactory::keys(); - // Set QGtkStyle for GNOME if available - QString gtkStyleKey = QString::fromLatin1("GTK+"); - if (availableStyles.contains(gtkStyleKey)) { - stylename = gtkStyleKey; - break; - } - if (X11->use_xrender) - stylename = QLatin1String("cleanlooks"); - else - stylename = QLatin1String("windows"); - break; - } - case DE_CDE: - stylename = QLatin1String("cde"); - break; - default: - // Don't do anything - break; - } - return stylename; -} - void QApplicationPrivate::initializeWidgetPaletteHash() { } diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp new file mode 100644 index 0000000..cf15aa2 --- /dev/null +++ b/src/gui/kernel/qguiplatformplugin.cpp @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qguiplatformplugin_p.h" +#include +#include "private/qfactoryloader_p.h" +#include "qstylefactory.h" +#include "qapplication.h" +#include "qplatformdefs.h" + +#ifdef Q_WS_WINCE +#include "qguifunctions_wince.h" +extern bool qt_wince_is_smartphone(); //qguifunctions_wince.cpp +extern bool qt_wince_is_mobile(); //qguifunctions_wince.cpp +extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp +#endif + + +#if defined(Q_WS_X11) +#include "qkde_p.h" +#include "qt_x11_p.h" +#endif + + +QT_BEGIN_NAMESPACE + + +/*! \internal + Return (an construct if necesseray) the Gui Platform plugin. + + The plugin key to be loaded is inside the QT_PLATFORM_PLUGIN environment variable. + If it is not set, it will be the DESKTOP_SESSION on X11. + + If no plugin can be loaded, the default one is returned. + */ +QGuiPlatformPlugin *qt_guiPlatformPlugin() +{ + static QGuiPlatformPlugin *plugin; + if (!plugin) + { +#if !defined(QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS) + + QString key = QString::fromLocal8Bit(qgetenv("QT_PLATFORM_PLUGIN")); +#ifdef Q_WS_X11 + if (key.isEmpty()) { + switch(X11->desktopEnvironment) { + case DE_KDE: + key = QString::fromLatin1("kde"); + break; + default: + key = QString::fromLocal8Bit(qgetenv("DESKTOP_SESSION")); + break; + } + } +#endif + + if (!key.isEmpty() && QApplication::desktopSettingsAware()) { + QFactoryLoader loader(QGuiPlatformPluginInterface_iid, QLatin1String("/gui_platform")); + plugin = qobject_cast(loader.instance(key)); + } +#endif // QT_NO_LIBRARY + + if(!plugin) { + static QGuiPlatformPlugin def; + plugin = &def; + } + } + return plugin; +} + + +/* \class QPlatformPlugin + QGuiPlatformPlugin can be used to integrate Qt applications in a platform built on top of Qt. + The application developer should not know or use the plugin, it is only used by Qt internaly. + + But full platform that are built on top of Qt may provide a plugin so 3rd party Qt application + running in the platform are integrated. + */ + +/* + The constructor can be used to install hooks in Qt + */ +QGuiPlatformPlugin::QGuiPlatformPlugin(QObject *parent) : QObject(parent) {} +QGuiPlatformPlugin::~QGuiPlatformPlugin() {} + + +/* return the string key to be used by default the application */ +QString QGuiPlatformPlugin::styleName() +{ +#if defined(Q_WS_WIN) && defined(Q_WS_WINCE) + if (qt_wince_is_smartphone() || qt_wince_is_pocket_pc()) + return QLatin1String("WindowsMobile"); + else + return QLatin1String("WindowsCE"); +#elif defined(Q_WS_WIN) + if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA + && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + return QLatin1String("WindowsVista"); + else if ((QSysInfo::WindowsVersion >= QSysInfo::WV_XP + && QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) + return QLatin1String("WindowsXP"); + else + return QLatin1String("Windows"); // default styles for Windows +#elif defined(Q_WS_X11) && defined(Q_OS_SOLARIS) + return QLatin1String("CDE"); // default style for X11 on Solaris +#elif defined(Q_WS_S60) + return QLatin1String("S60"); // default style for Symbian with S60 +#elif defined(Q_OS_SYMBIAN) + return QLatin1String("Windows"); // default style for Symbian without S60 +#elif defined(Q_WS_X11) && defined(Q_OS_IRIX) + return QLatin1String("SGI"); // default style for X11 on IRIX +#elif defined(Q_WS_QWS) + return QLatin1String("Plastique"); // default style for X11 and small devices +#elif defined(Q_WS_MAC) + return QLatin1String("Macintosh"); // default style for all Mac's +#elif defined(Q_WS_X11) + QString stylename; + switch(X11->desktopEnvironment) { + case DE_KDE: + stylename = QKde::kdeStyle(); + break; + case DE_GNOME: { + QStringList availableStyles = QStyleFactory::keys(); + // Set QGtkStyle for GNOME if available + QString gtkStyleKey = QString::fromLatin1("GTK+"); + if (availableStyles.contains(gtkStyleKey)) { + stylename = gtkStyleKey; + break; + } + if (X11->use_xrender) + stylename = QLatin1String("cleanlooks"); + else + stylename = QLatin1String("windows"); + break; + } + case DE_CDE: + stylename = QLatin1String("cde"); + break; + default: + // Don't do anything + break; + } + return stylename; +#endif +} + +/* return an aditional default palette (only work on X11) */ +QPalette QGuiPlatformPlugin::palette() +{ +#ifdef Q_WS_X11 + if (QApplication::desktopSettingsAware() && X11->desktopEnvironment == DE_KDE) + return QKde::kdePalette(); +#endif + + return QPalette(); +} + +/* backend for QIcon::fromTheme. A null icon means it uses the default backend */ +QIcon QGuiPlatformPlugin::loadIcon(const QString &name) +{ + return QIcon(); +} + +/* Like QStyle::styleHint */ +int QGuiPlatformPlugin::platformHint(PlatformHint hint) +{ + int ret = 0; + switch(hint) + { + case PH_ToolButtonStyle: + ret = Qt::ToolButtonIconOnly; +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4 + && QApplication::desktopSettingsAware()) { + ret = QKde::kdeToolButtonStyle(); + } +#endif + break; + case PH_ToolBarIconSize: +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4 + && QApplication::desktopSettingsAware()) { + ret = QKde::kdeToolBarIconSize(); + } +#endif + //by default keep ret = 0 so QCommonStyle will use the style default + break; + } + return ret; +} + + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qguiplatformplugin_p.h b/src/gui/kernel/qguiplatformplugin_p.h new file mode 100644 index 0000000..57ea8af --- /dev/null +++ b/src/gui/kernel/qguiplatformplugin_p.h @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGUIPLATFORM_P_H +#define QGUIPLATFORM_P_H + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include +#include +#include + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QStyle; +class QPalette; +class QIcon; +class QFileDialog; +class QColorDialog; + +struct Q_GUI_EXPORT QGuiPlatformPluginInterface : public QFactoryInterface +{ +}; + +#define QGuiPlatformPluginInterface_iid "com.nokia.qt.QGuiPlatformPluginInterface" + +Q_DECLARE_INTERFACE(QGuiPlatformPluginInterface, QGuiPlatformPluginInterface_iid) + +class Q_GUI_EXPORT QGuiPlatformPlugin : public QObject, public QGuiPlatformPluginInterface +{ + Q_OBJECT + Q_INTERFACES(QGuiPlatformPluginInterface:QFactoryInterface) + public: + explicit QGuiPlatformPlugin(QObject *parent = 0); + ~QGuiPlatformPlugin(); + + virtual QStringList keys() const { return QStringList() << QLatin1String("default"); }; + + virtual QString styleName(); + virtual QPalette palette(); + virtual QIcon loadIcon(const QString &name); + enum PlatformHint { PH_ToolButtonStyle, PH_ToolBarIconSize }; + virtual int platformHint(PlatformHint hint); + + + virtual void fileDialogDelete(QFileDialog *) {} + virtual bool fileDialogSetVisible(QFileDialog *, bool) { return false; } + virtual QDialog::DialogCode fileDialogResultCode(QFileDialog *) { return QDialog::Rejected; } + virtual void fileDialogSetDirectory(QFileDialog *, const QString &) {} + virtual QString fileDialogDirectory(const QFileDialog *) const { return QString(); } + virtual void fileDialogSelectFile(QFileDialog *, const QString &) {} + virtual QStringList fileDialogSelectedFiles(const QFileDialog *) const { return QStringList(); } + virtual void fileDialogSetFilter(QFileDialog *) {} + virtual void fileDialogSetNameFilters(QFileDialog *, const QStringList &) {} + virtual void fileDialogSelectNameFilter(QFileDialog *, const QString &) {} + virtual QString fileDialogSelectedNameFilter(const QFileDialog *) const { return QString(); } + + virtual void colorDialogDelete(QColorDialog *) {} + virtual bool colorDialogSetVisible(QColorDialog *, bool) { return false; } + virtual void colorDialogSetCurrentColor(QColorDialog *, const QColor &) {} +}; + +//internal +QGuiPlatformPlugin *qt_guiPlatformPlugin(); + +QT_END_NAMESPACE + +QT_END_HEADER + + +#endif // QGUIPLATFORMPLUGIN_H diff --git a/src/gui/kernel/qkde.cpp b/src/gui/kernel/qkde.cpp index 6c8909f..edc53ac 100644 --- a/src/gui/kernel/qkde.cpp +++ b/src/gui/kernel/qkde.cpp @@ -141,14 +141,33 @@ QString QKde::kdeStyle() return QLatin1String("windows"); } -/*!\internal - placeholder to load icon from kde. - to be implemented - */ -QIcon QKde::kdeIcon(const QString &name) + +int QKde::kdeToolButtonStyle() +{ + QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), + QSettings::IniFormat); + settings.beginGroup(QLatin1String("Toolbar style")); + QString toolbarStyle = settings.value(QLatin1String("ToolButtonStyle"), QLatin1String("TextBesideIcon")).toString(); + if (toolbarStyle == QLatin1String("TextBesideIcon")) + return Qt::ToolButtonTextBesideIcon; + else if (toolbarStyle == QLatin1String("TextOnly")) + return Qt::ToolButtonTextOnly; + else if (toolbarStyle == QLatin1String("TextUnderIcon")) + return Qt::ToolButtonTextUnderIcon; + + return Qt::ToolButtonTextBesideIcon; +} + +int QKde::kdeToolBarIconSize() { - //###todo - return QIcon(); + static int iconSize = -1; + if (iconSize == -1) { + QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), + QSettings::IniFormat); + settings.beginGroup(QLatin1String("ToolbarIcons")); + iconSize = settings.value(QLatin1String("Size")).toInt(); + } + return iconSize; } QT_END_NAMESPACE diff --git a/src/gui/kernel/qkde_p.h b/src/gui/kernel/qkde_p.h index 4063f0e..c22a145 100644 --- a/src/gui/kernel/qkde_p.h +++ b/src/gui/kernel/qkde_p.h @@ -61,12 +61,17 @@ QT_BEGIN_NAMESPACE -// This namespace contains helper function to help KDE integration +/*!\internal + This namespace contains helper function to help KDE integration + They are only used if we detect the use of KDE and the KDE platform plugin is not found (old KDE version) + Or if the detected KDE version is KDE3 +*/ namespace QKde { QString kdeHome(); QString kdeStyle(); QPalette kdePalette(); - QIcon kdeIcon(const QString &name); + int kdeToolButtonStyle(); + int kdeToolBarIconSize(); } diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index df4f866..612258a 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -63,7 +63,6 @@ #include #include #include -#include <../kernel/qkde_p.h> #include #include #include @@ -75,6 +74,7 @@ #include #include #include +#include #include @@ -837,35 +837,6 @@ static void drawArrow(const QStyle *style, const QStyleOptionToolButton *toolbut } #endif // QT_NO_TOOLBUTTON - -#ifdef Q_WS_X11 // These functions are used to parse the X11 freedesktop icon spec - -/*!internal - -Checks if you are running KDE and looks up the toolbar -from the KDE configuration file - -*/ -int QCommonStylePrivate::lookupToolButtonStyle() const -{ - int result = Qt::ToolButtonIconOnly; - if (X11->desktopEnvironment == DE_KDE && X11->desktopVersion >= 4) { - QSettings settings(QKde::kdeHome() + - QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); - settings.beginGroup(QLatin1String("Toolbar style")); - QString toolbarStyle = settings.value(QLatin1String("ToolButtonStyle"), QLatin1String("TextBesideIcon")).toString(); - if (toolbarStyle == QLatin1String("TextBesideIcon")) - result = Qt::ToolButtonTextBesideIcon; - else if (toolbarStyle == QLatin1String("TextOnly")) - result = Qt::ToolButtonTextOnly; - else if (toolbarStyle == QLatin1String("TextUnderIcon")) - result = Qt::ToolButtonTextUnderIcon; - } - return result; -} - -#endif //Q_WS_X11 - #ifndef QT_NO_ITEMVIEWS QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItemV4 *option, int role) const @@ -4688,19 +4659,8 @@ int QCommonStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const QWid break; case PM_ToolBarIconSize: -#ifdef Q_WS_X11 - if (X11->desktopVersion >= 4) { - static int iconSize = 0; - if (!iconSize) { - QSettings settings(QKde::kdeHome() + - QLatin1String("/share/config/kdeglobals"), - QSettings::IniFormat); - settings.beginGroup(QLatin1String("ToolbarIcons")); - iconSize = settings.value(QLatin1String("Size"), QLatin1String("22")).toInt(); - } - ret = iconSize; - } else -#endif + ret = qt_guiPlatformPlugin()->platformHint(QGuiPlatformPlugin::PH_ToolBarIconSize); + if (!ret) ret = proxy()->pixelMetric(PM_SmallIconSize, opt, widget); break; @@ -5192,13 +5152,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget ret = true; break; case SH_ToolButtonStyle: - ret = Qt::ToolButtonIconOnly; -#ifdef Q_WS_X11 - { - static int buttonStyle = d_func()->lookupToolButtonStyle(); - return buttonStyle; - } -#endif + ret = qt_guiPlatformPlugin()->platformHint(QGuiPlatformPlugin::PH_ToolButtonStyle); break; case SH_RequestSoftwareInputPanel: ret = RSIP_OnMouseClickAndAlreadyFocused; diff --git a/src/gui/styles/qcommonstyle_p.h b/src/gui/styles/qcommonstyle_p.h index 7162392..a905601 100644 --- a/src/gui/styles/qcommonstyle_p.h +++ b/src/gui/styles/qcommonstyle_p.h @@ -122,7 +122,6 @@ public: } #endif mutable QIcon tabBarcloseButtonIcon; - int lookupToolButtonStyle() const; #ifndef QT_NO_TABBAR void tabLayout(const QStyleOptionTabV3 *opt, const QWidget *widget, QRect *textRect, QRect *pixmapRect) const; #endif -- cgit v0.12 From ed9fb96a626c284cebd4fcd9a2e00f32e202099a Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 7 Oct 2009 11:20:23 +0200 Subject: Fix compilation with -pedantic Merge-request: 1716 Reviewed-by: Thiago Macieira --- src/gui/effects/qgraphicseffect.cpp | 2 +- src/gui/kernel/qsoftkeymanager_p.h | 2 +- src/gui/text/qfontengine.cpp | 2 +- src/opengl/gl2paintengineex/qglcustomshaderstage_p.h | 2 +- src/opengl/util/fragmentprograms_p.h | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/gui/effects/qgraphicseffect.cpp b/src/gui/effects/qgraphicseffect.cpp index e971fd8..ee01fdc 100644 --- a/src/gui/effects/qgraphicseffect.cpp +++ b/src/gui/effects/qgraphicseffect.cpp @@ -566,7 +566,7 @@ QGraphicsColorizeEffect::~QGraphicsColorizeEffect() \brief the color of the effect. By default, the color is light blue (QColor(0, 0, 192)). -*/; +*/ QColor QGraphicsColorizeEffect::color() const { Q_D(const QGraphicsColorizeEffect); diff --git a/src/gui/kernel/qsoftkeymanager_p.h b/src/gui/kernel/qsoftkeymanager_p.h index c4bb84d..b455445 100644 --- a/src/gui/kernel/qsoftkeymanager_p.h +++ b/src/gui/kernel/qsoftkeymanager_p.h @@ -74,7 +74,7 @@ public: SelectSoftKey, DoneSoftKey, MenuSoftKey, - CancelSoftKey, + CancelSoftKey }; static void updateSoftKeys(); diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index e5a88fc..21b9cca 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -1160,7 +1160,7 @@ Q_GLOBAL_STATIC_WITH_INITIALIZER(QVector, qt_grayPalette, { QRgb *it = x->data(); for (int i = 0; i < x->size(); ++i, ++it) *it = 0xff000000 | i | (i<<8) | (i<<16); -}); +}) const QVector &QFontEngine::grayPalette() { diff --git a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h index 25f5c2f..f8c13c5 100644 --- a/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h +++ b/src/opengl/gl2paintengineex/qglcustomshaderstage_p.h @@ -64,7 +64,7 @@ QT_MODULE(OpenGL) class QGLCustomShaderStagePrivate; class Q_OPENGL_EXPORT QGLCustomShaderStage { - Q_DECLARE_PRIVATE(QGLCustomShaderStage); + Q_DECLARE_PRIVATE(QGLCustomShaderStage) public: QGLCustomShaderStage(); virtual ~QGLCustomShaderStage(); diff --git a/src/opengl/util/fragmentprograms_p.h b/src/opengl/util/fragmentprograms_p.h index 18da5c8..340023c 100644 --- a/src/opengl/util/fragmentprograms_p.h +++ b/src/opengl/util/fragmentprograms_p.h @@ -71,7 +71,7 @@ enum FragmentVariable { VAR_FMP2_M_RADIUS2, VAR_FMP, VAR_INV_MATRIX_M0, - VAR_ANGLE, + VAR_ANGLE }; enum FragmentBrushType { @@ -80,7 +80,7 @@ enum FragmentBrushType { FRAGMENT_PROGRAM_BRUSH_CONICAL, FRAGMENT_PROGRAM_BRUSH_LINEAR, FRAGMENT_PROGRAM_BRUSH_TEXTURE, - FRAGMENT_PROGRAM_BRUSH_PATTERN, + FRAGMENT_PROGRAM_BRUSH_PATTERN }; enum FragmentCompositionModeType { @@ -109,12 +109,12 @@ enum FragmentCompositionModeType { COMPOSITION_MODES_DIFFERENCE_NOMASK, COMPOSITION_MODES_EXCLUSION_NOMASK, COMPOSITION_MODE_BLEND_MODE_MASK, - COMPOSITION_MODE_BLEND_MODE_NOMASK, + COMPOSITION_MODE_BLEND_MODE_NOMASK }; enum FragmentMaskType { FRAGMENT_PROGRAM_MASK_TRAPEZOID_AA, - FRAGMENT_PROGRAM_MASK_ELLIPSE_AA, + FRAGMENT_PROGRAM_MASK_ELLIPSE_AA }; static const unsigned int num_fragment_variables = 19; -- cgit v0.12 From dde11ce47c2d83bae685f3ff032ee9e6e372058f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Wed, 7 Oct 2009 11:30:30 +0200 Subject: Make some lines in the autotest more readable. --- .../qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp index b076631..286ea2d 100644 --- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp +++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp @@ -161,15 +161,13 @@ void tst_QGraphicsAnchorLayout::simple() l->setContentsMargins(0, 0, 0, 0); // Horizontal - l->addAnchor(w1, Qt::AnchorLeft, l, Qt::AnchorLeft); + l->addAnchor(l, Qt::AnchorLeft, w1, Qt::AnchorLeft); l->addAnchor(w1, Qt::AnchorRight, w2, Qt::AnchorLeft); l->addAnchor(w2, Qt::AnchorRight, l, Qt::AnchorRight); // Vertical - l->addAnchor(w1, Qt::AnchorTop, l, Qt::AnchorTop); - l->addAnchor(w2, Qt::AnchorTop, l, Qt::AnchorTop); - l->addAnchor(w1, Qt::AnchorBottom, l, Qt::AnchorBottom); - l->addAnchor(w2, Qt::AnchorBottom, l, Qt::AnchorBottom); + l->addAnchors(l, w1, Qt::Vertical); + l->addAnchors(l, w2, Qt::Vertical); QGraphicsWidget p; p.setLayout(l); @@ -1172,12 +1170,9 @@ void tst_QGraphicsAnchorLayout::delete_anchor() l->addAnchor(w3, Qt::AnchorRight, l, Qt::AnchorRight); // Vertical - l->addAnchor(w1, Qt::AnchorTop, l, Qt::AnchorTop); - l->addAnchor(w1, Qt::AnchorBottom, l, Qt::AnchorBottom); - l->addAnchor(w2, Qt::AnchorTop, l, Qt::AnchorTop); - l->addAnchor(w2, Qt::AnchorBottom, l, Qt::AnchorBottom); - l->addAnchor(w3, Qt::AnchorTop, l, Qt::AnchorTop); - l->addAnchor(w3, Qt::AnchorBottom, l, Qt::AnchorBottom); + l->addAnchors(l, w1, Qt::Vertical); + l->addAnchors(l, w2, Qt::Vertical); + l->addAnchors(l, w3, Qt::Vertical); QGraphicsAnchor *anchor = l->anchor(w3, Qt::AnchorRight, l, Qt::AnchorRight); anchor->setSpacing(10); -- cgit v0.12 From fb3e09c620b519eed57488cb229d42ebb793f387 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 7 Oct 2009 11:55:58 +0200 Subject: Use the recursive mutex functions for D-Bus only. At least in D-Bus 1.2.16, there's a deadlock caused by locking an already-locked mutex. When Qt is linked to libdbus-1 instead of dynamically loading it, it maintains legacy compatibility by only providing the non-recursive mutexes, which triggers this deadlock. The recursive functions have been present since 0.93, so I guess the non-recursive variants aren't tested. Report: https://bugzilla.novell.com/show_bug.cgi?id=482749#c30 --- configure | 2 +- dist/changes-4.6.0 | 5 ++++- src/dbus/qdbusthread.cpp | 32 +++++--------------------------- 3 files changed, 10 insertions(+), 29 deletions(-) diff --git a/configure b/configure index ea50b37..1a7a8ef 100755 --- a/configure +++ b/configure @@ -617,7 +617,7 @@ fi unset QTDIR # the minimum version of libdbus-1 that we require: -MIN_DBUS_1_VERSION=0.62 +MIN_DBUS_1_VERSION=0.93 # initalize internal variables CFG_CONFIGURE_EXIT_ON_ERROR=yes diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0 index 2e7e699..cd9f130 100644 --- a/dist/changes-4.6.0 +++ b/dist/changes-4.6.0 @@ -19,6 +19,9 @@ information about a particular change. * General * **************************************************************************** + - QtDBus + * The minimum required version of the D-Bus reference library is + now 0.93. **************************************************************************** @@ -133,4 +136,4 @@ information about a particular change. for all floating point numbers, and this can be changed using the new function setFloatingPointPrecision(). Set Qt_4_5 as the version of the QDataStream to get the behavior of previous versions. - \ No newline at end of file + diff --git a/src/dbus/qdbusthread.cpp b/src/dbus/qdbusthread.cpp index 6e180b1..7bc107a 100644 --- a/src/dbus/qdbusthread.cpp +++ b/src/dbus/qdbusthread.cpp @@ -47,33 +47,24 @@ QT_USE_NAMESPACE -static DBusMutex* mutex_new() -{ - return reinterpret_cast(new QMutex(QMutex::NonRecursive)); -} - -#if 0 static DBusMutex* recursive_mutex_new() { return reinterpret_cast(new QMutex(QMutex::Recursive)); } -#endif static void mutex_free(DBusMutex *mutex) { delete reinterpret_cast(mutex); } -static dbus_bool_t mutex_lock(DBusMutex *mutex) +static void mutex_lock(DBusMutex *mutex) { reinterpret_cast(mutex)->lock(); - return true; } -static dbus_bool_t mutex_unlock(DBusMutex *mutex) +static void mutex_unlock(DBusMutex *mutex) { reinterpret_cast(mutex)->unlock(); - return true; } static DBusCondVar* condvar_new() @@ -110,42 +101,29 @@ QT_BEGIN_NAMESPACE bool qDBusInitThreads() { - // ### Disable the recursive mutex functions. + // Use only the non-recursive mutex functions static DBusThreadFunctions fcn = { - DBUS_THREAD_FUNCTIONS_MUTEX_NEW_MASK | - DBUS_THREAD_FUNCTIONS_MUTEX_FREE_MASK | - DBUS_THREAD_FUNCTIONS_MUTEX_LOCK_MASK | - DBUS_THREAD_FUNCTIONS_MUTEX_UNLOCK_MASK | DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK | DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK | DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK | DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK | DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK | - DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK, -#if 0 + DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK | DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_NEW_MASK | DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_FREE_MASK | DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_LOCK_MASK | DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_UNLOCK_MASK, -#endif - mutex_new, - mutex_free, - mutex_lock, - mutex_unlock, + 0, 0, 0, 0, // non-recursive mutex functions condvar_new, condvar_free, condvar_wait, condvar_wait_timeout, condvar_wake_one, condvar_wake_all, -#if 0 recursive_mutex_new, mutex_free, mutex_lock, mutex_unlock, -#else - 0, 0, 0, 0, -#endif 0, 0, 0, 0 }; -- cgit v0.12 From bb13e2d43c664359aa61fc39c31f75a5c3fb4f5e Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 7 Oct 2009 12:04:44 +0200 Subject: Use dbus_threads_init_default instead of QMutex wrappers The minimum version for the recursive mutexes is D-Bus 0.93. That's also the same version that introduced the default thread functions. So we don't need to provide ours anymore, just use the default. --- src/dbus/dbus.pro | 1 - src/dbus/qdbus_symbols_p.h | 3 + src/dbus/qdbusintegrator.cpp | 2 +- src/dbus/qdbusthread.cpp | 149 ------------------------------------------- 4 files changed, 4 insertions(+), 151 deletions(-) delete mode 100644 src/dbus/qdbusthread.cpp diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro index dcd8418..57c6a58 100644 --- a/src/dbus/dbus.pro +++ b/src/dbus/dbus.pro @@ -61,7 +61,6 @@ SOURCES += qdbusconnection.cpp \ qdbusutil.cpp \ qdbusintrospection.cpp \ qdbusabstractadaptor.cpp \ - qdbusthread.cpp \ qdbusinternalfilters.cpp \ qdbusmetaobject.cpp \ qdbusxmlgenerator.cpp \ diff --git a/src/dbus/qdbus_symbols_p.h b/src/dbus/qdbus_symbols_p.h index bc90328..69c6ee4 100644 --- a/src/dbus/qdbus_symbols_p.h +++ b/src/dbus/qdbus_symbols_p.h @@ -357,6 +357,9 @@ DEFINEFUNC(dbus_bool_t , dbus_type_is_basic, (int typecode), DEFINEFUNC(dbus_bool_t , dbus_type_is_fixed, (int typecode), (typecode), return) +/* dbus-thread.h */ +DEFINEFUNC(dbus_bool_t , dbus_threads_init_default, (), (), return) + QT_END_NAMESPACE #endif diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 6ff50ac..8143cba 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -920,7 +920,7 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) watchAndTimeoutLock(QMutex::Recursive), rootNode(QString(QLatin1Char('/'))) { - static const bool threads = qDBusInitThreads(); + static const bool threads = q_dbus_threads_init_default(); static const int debugging = ::isDebugging = qgetenv("QDBUS_DEBUG").toInt(); Q_UNUSED(threads) diff --git a/src/dbus/qdbusthread.cpp b/src/dbus/qdbusthread.cpp deleted file mode 100644 index 7bc107a..0000000 --- a/src/dbus/qdbusthread.cpp +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtDBus module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include - -#include -#include - -QT_USE_NAMESPACE - -static DBusMutex* recursive_mutex_new() -{ - return reinterpret_cast(new QMutex(QMutex::Recursive)); -} - -static void mutex_free(DBusMutex *mutex) -{ - delete reinterpret_cast(mutex); -} - -static void mutex_lock(DBusMutex *mutex) -{ - reinterpret_cast(mutex)->lock(); -} - -static void mutex_unlock(DBusMutex *mutex) -{ - reinterpret_cast(mutex)->unlock(); -} - -static DBusCondVar* condvar_new() -{ - return reinterpret_cast(new QWaitCondition); -} - -static void condvar_free(DBusCondVar *cond) -{ - delete reinterpret_cast(cond); -} - -static void condvar_wait(DBusCondVar *cond, DBusMutex *mutex) -{ - reinterpret_cast(cond)->wait(reinterpret_cast(mutex)); -} - -static dbus_bool_t condvar_wait_timeout(DBusCondVar *cond, DBusMutex *mutex, int msec) -{ - return reinterpret_cast(cond)->wait(reinterpret_cast(mutex), msec); -} - -static void condvar_wake_one(DBusCondVar *cond) -{ - reinterpret_cast(cond)->wakeOne(); -} - -static void condvar_wake_all(DBusCondVar *cond) -{ - reinterpret_cast(cond)->wakeAll(); -} - -QT_BEGIN_NAMESPACE - -bool qDBusInitThreads() -{ - // Use only the non-recursive mutex functions - static DBusThreadFunctions fcn = { - DBUS_THREAD_FUNCTIONS_CONDVAR_NEW_MASK | - DBUS_THREAD_FUNCTIONS_CONDVAR_FREE_MASK | - DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_MASK | - DBUS_THREAD_FUNCTIONS_CONDVAR_WAIT_TIMEOUT_MASK | - DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ONE_MASK | - DBUS_THREAD_FUNCTIONS_CONDVAR_WAKE_ALL_MASK | - DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_NEW_MASK | - DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_FREE_MASK | - DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_LOCK_MASK | - DBUS_THREAD_FUNCTIONS_RECURSIVE_MUTEX_UNLOCK_MASK, - 0, 0, 0, 0, // non-recursive mutex functions - condvar_new, - condvar_free, - condvar_wait, - condvar_wait_timeout, - condvar_wake_one, - condvar_wake_all, - recursive_mutex_new, - mutex_free, - mutex_lock, - mutex_unlock, - 0, 0, 0, 0 - }; - -#if !defined QT_LINKED_LIBDBUS - void (*threads_init_default)() = (void (*)())qdbus_resolve_conditionally("dbus_threads_init_default"); - void (*threads_init)(DBusThreadFunctions *) = (void (*)(DBusThreadFunctions*))qdbus_resolve_conditionally("dbus_threads_init"); - - if (threads_init_default) - threads_init_default(); - else if (threads_init) - threads_init(&fcn); - else - return false; - - return true; -#else - dbus_threads_init(&fcn); - - return true; -#endif -} - -QT_END_NAMESPACE -- cgit v0.12 From fd89f9255d7965421a39a9089bb1d983264aff6f Mon Sep 17 00:00:00 2001 From: David Faure Date: Wed, 7 Oct 2009 12:10:52 +0200 Subject: QUrl autotest additions Add autotest which actually passes, the problem (in kurltest) was the underscore in the hostname. Rename ok_hostname to bad_hostname in the error test, for clarity. Merge-request: 1710 Reviewed-by: Thiago Macieira --- tests/auto/qurl/tst_qurl.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 8856792..026c30e 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -2624,6 +2624,13 @@ void tst_QUrl::tolerantParser() //QCOMPARE(tsdgeosQUrl.toEncoded(), tsdgeosExpected); // unusable output from qtestlib... QCOMPARE(QString(tsdgeosQUrl.toEncoded()), QString(tsdgeosExpected)); } + + { + QUrl url; + url.setUrl("http://strange@hostname/", QUrl::TolerantMode); + QVERIFY(url.isValid()); + QCOMPARE(QString(url.toEncoded()), QString("http://strange%3Cusername%3E@hostname/")); + } } void tst_QUrl::correctEncodedMistakes_data() @@ -3594,9 +3601,9 @@ void tst_QUrl::setAuthority() void tst_QUrl::errorString() { - QUrl u = QUrl::fromEncoded("http://strange@ok_hostname/", QUrl::StrictMode); + QUrl u = QUrl::fromEncoded("http://strange@bad_hostname/", QUrl::StrictMode); QVERIFY(!u.isValid()); - QString errorString = "Invalid URL \"http://strange@ok_hostname/\": " + QString errorString = "Invalid URL \"http://strange@bad_hostname/\": " "error at position 14: expected end of URL, but found '<'"; QCOMPARE(u.errorString(), errorString); -- cgit v0.12 From 8bcf844d95cdf9f69bbf02da49d8d3282eb40cfb Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 7 Oct 2009 12:17:25 +0200 Subject: Get rid of some superfluous checks in QScriptString::operator==() Reviewed-by: Olivier Goffart --- src/script/api/qscriptstring.cpp | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/script/api/qscriptstring.cpp b/src/script/api/qscriptstring.cpp index c2362da..2fb157f 100644 --- a/src/script/api/qscriptstring.cpp +++ b/src/script/api/qscriptstring.cpp @@ -150,14 +150,8 @@ bool QScriptString::isValid() const bool QScriptString::operator==(const QScriptString &other) const { Q_D(const QScriptString); - if (d == other.d_func()) - return true; if (!d || !other.d_func()) return d == other.d_func(); - if (d->engine != other.d_func()->engine) - return false; - if (!d->engine) - return true; return d->identifier == other.d_func()->identifier; } -- cgit v0.12 From 350410f19fd589986e51eba8f018abd92eddc287 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 09:39:14 +0200 Subject: Skipping ActiveQt examples removes a couple of warnings and errors Reviewed-by: Thiago Macieira --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 1a7a8ef..323224c 100755 --- a/configure +++ b/configure @@ -7612,6 +7612,7 @@ for file in .projects .projects.3; do case $a in *winmain/winmain.pro) continue ;; *s60main/s60main.pro) continue ;; + *examples/activeqt/*) continue ;; */qmake/qmake.pro) continue ;; *tools/bootstrap*|*tools/moc*|*tools/rcc*|*tools/uic*) SPEC=$QMAKESPEC ;; *) SPEC=$XQMAKESPEC ;; -- cgit v0.12 From 41a47906475f3970bd662c3d24e7e642ea65a191 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 09:44:18 +0200 Subject: Fixing some GCC warnings Reviewed-by: Markus Goetz --- demos/browser/webview.cpp | 2 ++ demos/sub-attaq/graphicsscene.cpp | 2 +- examples/richtext/textobject/svgtextobject.cpp | 4 ++-- src/corelib/thread/qthread_unix.cpp | 1 + src/dbus/qdbusintegrator.cpp | 1 + src/gui/painting/qpaintengineex.cpp | 2 +- src/opengl/qpixmapdata_gl.cpp | 2 +- src/xmlpatterns/data/qvaluefactory.cpp | 2 +- src/xmlpatterns/functions/qsequencefns_p.h | 1 - src/xmlpatterns/schema/qxsdschemaparser.cpp | 1 + 10 files changed, 11 insertions(+), 7 deletions(-) diff --git a/demos/browser/webview.cpp b/demos/browser/webview.cpp index e1d9b12..754fedc 100644 --- a/demos/browser/webview.cpp +++ b/demos/browser/webview.cpp @@ -151,6 +151,8 @@ void WebPage::handleUnsupportedContent(QNetworkReply *reply) QFile file(QLatin1String(":/notfound.html")); bool isOpened = file.open(QIODevice::ReadOnly); Q_ASSERT(isOpened); + Q_UNUSED(isOpened) + QString title = tr("Error loading page: %1").arg(reply->url().toString()); QString html = QString(QLatin1String(file.readAll())) .arg(title) diff --git a/demos/sub-attaq/graphicsscene.cpp b/demos/sub-attaq/graphicsscene.cpp index 812eadf..e29095e 100644 --- a/demos/sub-attaq/graphicsscene.cpp +++ b/demos/sub-attaq/graphicsscene.cpp @@ -129,7 +129,7 @@ void GraphicsScene::setupScene(QAction *newAction, QAction *quitAction) { static const int nLetters = 10; static struct { - char *pix; + char const *pix; qreal initX, initY; qreal destX, destY; } logoData[nLetters] = { diff --git a/examples/richtext/textobject/svgtextobject.cpp b/examples/richtext/textobject/svgtextobject.cpp index f5810b6..cf0b0ba 100644 --- a/examples/richtext/textobject/svgtextobject.cpp +++ b/examples/richtext/textobject/svgtextobject.cpp @@ -46,7 +46,7 @@ #include "window.h" //![0] -QSizeF SvgTextObject::intrinsicSize(QTextDocument *doc, int posInDocument, +QSizeF SvgTextObject::intrinsicSize(QTextDocument * /*doc*/, int /*posInDocument*/, const QTextFormat &format) { QImage bufferedImage = qVariantValue(format.property(Window::SvgData)); @@ -61,7 +61,7 @@ QSizeF SvgTextObject::intrinsicSize(QTextDocument *doc, int posInDocument, //![1] void SvgTextObject::drawObject(QPainter *painter, const QRectF &rect, - QTextDocument *doc, int posInDocument, + QTextDocument * /*doc*/, int /*posInDocument*/, const QTextFormat &format) { QImage bufferedImage = qVariantValue(format.property(Window::SvgData)); diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp index c590553..21b5e65 100644 --- a/src/corelib/thread/qthread_unix.cpp +++ b/src/corelib/thread/qthread_unix.cpp @@ -624,6 +624,7 @@ void QThread::setTerminationEnabled(bool enabled) Q_ASSERT_X(thr != 0, "QThread::setTerminationEnabled()", "Current thread was not started with QThread."); #ifndef Q_OS_SYMBIAN + Q_UNUSED(thr) pthread_setcancelstate(enabled ? PTHREAD_CANCEL_ENABLE : PTHREAD_CANCEL_DISABLE, NULL); if (enabled) pthread_testcancel(); diff --git a/src/dbus/qdbusintegrator.cpp b/src/dbus/qdbusintegrator.cpp index 8143cba..fb2dd77 100644 --- a/src/dbus/qdbusintegrator.cpp +++ b/src/dbus/qdbusintegrator.cpp @@ -923,6 +923,7 @@ QDBusConnectionPrivate::QDBusConnectionPrivate(QObject *p) static const bool threads = q_dbus_threads_init_default(); static const int debugging = ::isDebugging = qgetenv("QDBUS_DEBUG").toInt(); Q_UNUSED(threads) + Q_UNUSED(debugging) #ifdef QDBUS_THREAD_DEBUG if (debugging > 1) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index d712669..195be0a 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -932,7 +932,7 @@ void QPaintEngineEx::drawTiledPixmap(const QRectF &r, const QPixmap &pixmap, con fill(path, brush); } -void QPaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints hints) +void QPaintEngineEx::drawPixmaps(const QDrawPixmaps::Data *drawingData, int dataCount, const QPixmap &pixmap, QDrawPixmaps::DrawingHints /*hints*/) { qreal oldOpacity = state()->opacity; QTransform oldTransform = state()->matrix; diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp index ae4bed0..cbb310b 100644 --- a/src/opengl/qpixmapdata_gl.cpp +++ b/src/opengl/qpixmapdata_gl.cpp @@ -318,7 +318,7 @@ void QGLPixmapData::ensureCreated() const } void QGLPixmapData::fromImage(const QImage &image, - Qt::ImageConversionFlags flags) + Qt::ImageConversionFlags /*flags*/) { if (image.size() == QSize(w, h)) setSerialNumber(++qt_gl_pixmap_serial); diff --git a/src/xmlpatterns/data/qvaluefactory.cpp b/src/xmlpatterns/data/qvaluefactory.cpp index bac53b2..8f7e5a3 100644 --- a/src/xmlpatterns/data/qvaluefactory.cpp +++ b/src/xmlpatterns/data/qvaluefactory.cpp @@ -66,7 +66,7 @@ public: } AtomicValue::Ptr operator()(const AtomicValue::Ptr &lexicalValue, - const SchemaType::Ptr &type, + const SchemaType::Ptr & /*type*/, const ReportContext::Ptr &context) { prepareCasting(context, BuiltinTypes::xsString); diff --git a/src/xmlpatterns/functions/qsequencefns_p.h b/src/xmlpatterns/functions/qsequencefns_p.h index e406b95..fa799d3 100644 --- a/src/xmlpatterns/functions/qsequencefns_p.h +++ b/src/xmlpatterns/functions/qsequencefns_p.h @@ -149,7 +149,6 @@ namespace QPatternist // RVCT doesn't like using template parameter in trinary operator when the trinary operator result is // passed directly into another constructor. Q_ASSERT(Id == IDExistsFN || Id == IDEmptyFN); - const Expression::Ptr me(FunctionCall::compress(context)); diff --git a/src/xmlpatterns/schema/qxsdschemaparser.cpp b/src/xmlpatterns/schema/qxsdschemaparser.cpp index 8f7b6af..41c6b82 100644 --- a/src/xmlpatterns/schema/qxsdschemaparser.cpp +++ b/src/xmlpatterns/schema/qxsdschemaparser.cpp @@ -123,6 +123,7 @@ class ElementNamespaceHandler : m_parser(parser) { Q_ASSERT(m_parser->isStartElement() && (XsdSchemaToken::toToken(m_parser->name()) == tag) && (XsdSchemaToken::toToken(m_parser->namespaceUri()) == XsdSchemaToken::XML_NS_SCHEMA_URI)); + Q_UNUSED(tag) m_parser->m_namespaceSupport.pushContext(); m_parser->m_namespaceSupport.setPrefixes(m_parser->namespaceDeclarations()); } -- cgit v0.12 From ba5109e94d35a8c58fc4a4f412a3368bfa8851cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 09:45:21 +0200 Subject: Fixing more GCC warnings Reviewed-by: Marius Storm-Olsen --- src/corelib/global/qglobal.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 5720505..df17546 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1615,11 +1615,11 @@ Q_CORE_EXPORT_INLINE QDebug qCritical(); inline QNoDebug qDebug(); #endif -#define QT_NO_QDEBUG_MACRO if(1) {} else qDebug +#define QT_NO_QDEBUG_MACRO while (false) qDebug #ifdef QT_NO_DEBUG_OUTPUT # define qDebug QT_NO_QDEBUG_MACRO #endif -#define QT_NO_QWARNING_MACRO if(1) {} else qWarning +#define QT_NO_QWARNING_MACRO while (false) qWarning #ifdef QT_NO_WARNING_OUTPUT # define qWarning QT_NO_QWARNING_MACRO #endif -- cgit v0.12 From f250aa63d2f4fd7d7a40977552253bc68c21df29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 09:46:06 +0200 Subject: Only a character but could still be interrupted by a signal Reviewed-by: Brad --- src/corelib/kernel/qeventdispatcher_unix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/kernel/qeventdispatcher_unix.cpp b/src/corelib/kernel/qeventdispatcher_unix.cpp index 5a0afb8..5d206ed 100644 --- a/src/corelib/kernel/qeventdispatcher_unix.cpp +++ b/src/corelib/kernel/qeventdispatcher_unix.cpp @@ -939,7 +939,7 @@ void QEventDispatcherUNIX::wakeUp() Q_D(QEventDispatcherUNIX); if (d->wakeUps.testAndSetAcquire(0, 1)) { char c = 0; - ::write( d->thread_pipe[1], &c, 1 ); + qt_safe_write( d->thread_pipe[1], &c, 1 ); } } -- cgit v0.12 From fbe25541d84ec719633d97f200c4217b324a0f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 09:49:46 +0200 Subject: The ::reads and ::writes were generating warnings The ::closes were changed just for fun. Reviewed-by: Thiago Macieira --- src/qt3support/other/q3process_unix.cpp | 91 +++++++++++++++++---------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/src/qt3support/other/q3process_unix.cpp b/src/qt3support/other/q3process_unix.cpp index d42468b..955b65f 100644 --- a/src/qt3support/other/q3process_unix.cpp +++ b/src/qt3support/other/q3process_unix.cpp @@ -60,6 +60,7 @@ #include "qregexp.h" #include "private/q3membuf_p.h" #include "private/qobject_p.h" +#include "private/qcore_unix_p.h" #include #include @@ -160,11 +161,11 @@ public: process->d->proc = 0; } if( socketStdin ) - ::close( socketStdin ); + qt_safe_close( socketStdin ); if( socketStdout ) - ::close( socketStdout ); + qt_safe_close( socketStdout ); if( socketStderr ) - ::close( socketStderr ); + qt_safe_close( socketStderr ); } pid_t pid; @@ -213,7 +214,7 @@ static void q3process_cleanup() } #ifdef Q_OS_QNX6 -#define BAILOUT close(tmpSocket);close(socketFD[1]);return -1; +#define BAILOUT qt_safe_close(tmpSocket);qt_safe_close(socketFD[1]);return -1; int qnx6SocketPairReplacement (int socketFD[2]) { int tmpSocket; tmpSocket = socket (AF_INET, SOCK_STREAM, 0); @@ -252,7 +253,7 @@ int qnx6SocketPairReplacement (int socketFD[2]) { if(socketFD[0] == -1) { BAILOUT }; // We're done - close(tmpSocket); + qt_safe_close(tmpSocket); // Restore original flags , ie return to blocking fcntl(socketFD[1], F_SETFL, originalFlags); @@ -319,9 +320,9 @@ Q3ProcessManager::~Q3ProcessManager() delete procList; if ( sigchldFd[0] != 0 ) - ::close( sigchldFd[0] ); + qt_safe_close( sigchldFd[0] ); if ( sigchldFd[1] != 0 ) - ::close( sigchldFd[1] ); + qt_safe_close( sigchldFd[1] ); // restore SIGCHLD handler #if defined(QT_Q3PROCESS_DEBUG) @@ -384,7 +385,7 @@ void Q3ProcessManager::sigchldHnd( int fd ) } char tmp; - ::read( fd, &tmp, sizeof(tmp) ); + qt_safe_read( fd, &tmp, sizeof(tmp) ); #if defined(QT_Q3PROCESS_DEBUG) qDebug( "Q3ProcessManager::sigchldHnd()" ); #endif @@ -434,13 +435,13 @@ void Q3ProcessManager::sigchldHnd( int fd ) // close filedescriptors if open, and disable the // socket notifiers if ( proc->socketStdout ) { - ::close( proc->socketStdout ); + qt_safe_close( proc->socketStdout ); proc->socketStdout = 0; if (process->d->notifierStdout) process->d->notifierStdout->setEnabled(false); } if ( proc->socketStderr ) { - ::close( proc->socketStderr ); + qt_safe_close( proc->socketStderr ); proc->socketStderr = 0; if (process->d->notifierStderr) process->d->notifierStderr->setEnabled(false); @@ -509,7 +510,7 @@ Q3ProcessPrivate::~Q3ProcessPrivate() if ( proc != 0 ) { if ( proc->socketStdin != 0 ) { - ::close( proc->socketStdin ); + qt_safe_close( proc->socketStdin ); proc->socketStdin = 0; } proc->process = 0; @@ -532,15 +533,15 @@ void Q3ProcessPrivate::closeOpenSocketsForChild() { if ( procManager != 0 ) { if ( procManager->sigchldFd[0] != 0 ) - ::close( procManager->sigchldFd[0] ); + qt_safe_close( procManager->sigchldFd[0] ); if ( procManager->sigchldFd[1] != 0 ) - ::close( procManager->sigchldFd[1] ); + qt_safe_close( procManager->sigchldFd[1] ); // close also the sockets from other Q3Process instances for ( QProc *p=procManager->procList->first(); p!=0; p=procManager->procList->next() ) { - ::close( p->socketStdin ); - ::close( p->socketStdout ); - ::close( p->socketStderr ); + qt_safe_close( p->socketStdin ); + qt_safe_close( p->socketStdout ); + qt_safe_close( p->socketStderr ); } } } @@ -569,7 +570,7 @@ static QT_SIGNAL_RETTYPE qt_C_sigchldHnd(QT_SIGNAL_ARGS) return; char a = 1; - ::write( Q3ProcessPrivate::procManager->sigchldFd[0], &a, sizeof(a) ); + qt_safe_write( Q3ProcessPrivate::procManager->sigchldFd[0], &a, sizeof(a) ); } @@ -682,8 +683,8 @@ bool Q3Process::start( QStringList *env ) if ( (comms & Stderr) && qnx6SocketPairReplacement(sStderr) == -1 ) { #endif if ( comms & Stdin ) { - ::close( sStdin[0] ); - ::close( sStdin[1] ); + qt_safe_close( sStdin[0] ); + qt_safe_close( sStdin[1] ); } return false; } @@ -693,12 +694,12 @@ bool Q3Process::start( QStringList *env ) if ( (comms & Stdout) && qnx6SocketPairReplacement(sStdout) == -1 ) { #endif if ( comms & Stdin ) { - ::close( sStdin[0] ); - ::close( sStdin[1] ); + qt_safe_close( sStdin[0] ); + qt_safe_close( sStdin[1] ); } if ( comms & Stderr ) { - ::close( sStderr[0] ); - ::close( sStderr[1] ); + qt_safe_close( sStderr[0] ); + qt_safe_close( sStderr[1] ); } return false; } @@ -758,15 +759,15 @@ bool Q3Process::start( QStringList *env ) // child d->closeOpenSocketsForChild(); if ( comms & Stdin ) { - ::close( sStdin[1] ); + qt_safe_close( sStdin[1] ); ::dup2( sStdin[0], STDIN_FILENO ); } if ( comms & Stdout ) { - ::close( sStdout[0] ); + qt_safe_close( sStdout[0] ); ::dup2( sStdout[1], STDOUT_FILENO ); } if ( comms & Stderr ) { - ::close( sStderr[0] ); + qt_safe_close( sStderr[0] ); ::dup2( sStderr[1], STDERR_FILENO ); } if ( comms & DupStderr ) { @@ -776,7 +777,7 @@ bool Q3Process::start( QStringList *env ) ::chdir( workingDir.absPath().latin1() ); #endif if ( fd[0] ) - ::close( fd[0] ); + qt_safe_close( fd[0] ); if ( fd[1] ) ::fcntl( fd[1], F_SETFD, FD_CLOEXEC ); // close on exec shows success @@ -850,8 +851,8 @@ bool Q3Process::start( QStringList *env ) } if ( fd[1] ) { char buf = 0; - ::write( fd[1], &buf, 1 ); - ::close( fd[1] ); + qt_safe_write( fd[1], &buf, 1 ); + qt_safe_close( fd[1] ); } ::_exit( -1 ); } else if ( pid == -1 ) { @@ -861,7 +862,7 @@ bool Q3Process::start( QStringList *env ) // test if exec was successful if ( fd[1] ) - ::close( fd[1] ); + qt_safe_close( fd[1] ); if ( fd[0] ) { char buf; for ( ;; ) { @@ -882,13 +883,13 @@ bool Q3Process::start( QStringList *env ) } break; } - ::close( fd[0] ); + qt_safe_close( fd[0] ); } d->newProc( pid, this ); if ( comms & Stdin ) { - ::close( sStdin[0] ); + qt_safe_close( sStdin[0] ); d->proc->socketStdin = sStdin[1]; // Select non-blocking mode @@ -904,7 +905,7 @@ bool Q3Process::start( QStringList *env ) } } if ( comms & Stdout ) { - ::close( sStdout[1] ); + qt_safe_close( sStdout[1] ); d->proc->socketStdout = sStdout[0]; d->notifierStdout = new QSocketNotifier( sStdout[0], QSocketNotifier::Read ); connect( d->notifierStdout, SIGNAL(activated(int)), @@ -913,7 +914,7 @@ bool Q3Process::start( QStringList *env ) d->notifierStdout->setEnabled( true ); } if ( comms & Stderr ) { - ::close( sStderr[1] ); + qt_safe_close( sStderr[1] ); d->proc->socketStderr = sStderr[0]; d->notifierStderr = new QSocketNotifier( sStderr[0], QSocketNotifier::Read ); connect( d->notifierStderr, SIGNAL(activated(int)), @@ -934,19 +935,19 @@ error: if ( d->procManager ) d->procManager->cleanup(); if ( comms & Stdin ) { - ::close( sStdin[1] ); - ::close( sStdin[0] ); + qt_safe_close( sStdin[1] ); + qt_safe_close( sStdin[0] ); } if ( comms & Stdout ) { - ::close( sStdout[0] ); - ::close( sStdout[1] ); + qt_safe_close( sStdout[0] ); + qt_safe_close( sStdout[1] ); } if ( comms & Stderr ) { - ::close( sStderr[0] ); - ::close( sStderr[1] ); + qt_safe_close( sStderr[0] ); + qt_safe_close( sStderr[1] ); } - ::close( fd[0] ); - ::close( fd[1] ); + qt_safe_close( fd[0] ); + qt_safe_close( fd[1] ); delete[] arglistQ; delete[] arglist; return false; @@ -1049,7 +1050,7 @@ void Q3Process::closeStdin() d->notifierStdin->setEnabled(false); qDeleteInEventHandler(d->notifierStdin); d->notifierStdin = 0; - if ( ::close( d->proc->socketStdin ) != 0 ) { + if ( qt_safe_close( d->proc->socketStdin ) != 0 ) { qWarning( "Could not close stdin of child process" ); } #if defined(QT_Q3PROCESS_DEBUG) @@ -1115,7 +1116,7 @@ void Q3Process::socketRead( int fd ) d->notifierStdout->setEnabled( false ); qDeleteInEventHandler(d->notifierStdout); d->notifierStdout = 0; - ::close( d->proc->socketStdout ); + qt_safe_close( d->proc->socketStdout ); d->proc->socketStdout = 0; return; } else if ( fd == d->proc->socketStderr ) { @@ -1125,7 +1126,7 @@ void Q3Process::socketRead( int fd ) d->notifierStderr->setEnabled( false ); qDeleteInEventHandler(d->notifierStderr); d->notifierStderr = 0; - ::close( d->proc->socketStderr ); + qt_safe_close( d->proc->socketStderr ); d->proc->socketStderr = 0; return; } -- cgit v0.12 From 81e0167b13abf81bf630281ac940a2b73509ed5b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 09:53:32 +0200 Subject: The plugindialog was moved to tools/designer/src/lib/shared Reviewed-by: Friedemann Kleint --- tools/designer/translations/translations.pro | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/designer/translations/translations.pro b/tools/designer/translations/translations.pro index a37918c..2323882 100644 --- a/tools/designer/translations/translations.pro +++ b/tools/designer/translations/translations.pro @@ -82,7 +82,6 @@ SOURCES += $$APP_DIR/appfontdialog.cpp \ $$APP_DIR/main.cpp \ $$APP_DIR/mainwindow.cpp \ $$APP_DIR/newform.cpp \ - $$APP_DIR/plugindialog.cpp \ $$APP_DIR/preferencesdialog.cpp \ $$APP_DIR/qdesigner_actions.cpp \ $$APP_DIR/qdesigner_appearanceoptions.cpp \ @@ -100,7 +99,6 @@ HEADERS+= $$APP_DIR/appfontdialog.h \ $$APP_DIR/designer_enums.h \ $$APP_DIR/mainwindow.h \ $$APP_DIR/newform.h \ - $$APP_DIR/plugindialog.h \ $$APP_DIR/preferencesdialog.h \ $$APP_DIR/qdesigner_actions.h \ $$APP_DIR/qdesigner_appearanceoptions.h \ @@ -114,8 +112,7 @@ HEADERS+= $$APP_DIR/appfontdialog.h \ $$APP_DIR/saveformastemplate.h \ $$APP_DIR/versiondialog.h -FORMS += $$APP_DIR/plugindialog.ui \ - $$APP_DIR/preferencesdialog.ui \ +FORMS += $$APP_DIR/preferencesdialog.ui \ $$APP_DIR/qdesigner_appearanceoptions.ui \ $$APP_DIR/saveformastemplate.ui -- cgit v0.12 From e9e37393a4c1cfc43b5dca94a832d73cd009d73e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 10:05:51 +0200 Subject: Removing errors from the configure step... Reviewed-by: Thiago Macieira --- tools/assistant/translations/qt_help.pro | 4 +--- tools/assistant/translations/translations_adp.pro | 2 -- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/tools/assistant/translations/qt_help.pro b/tools/assistant/translations/qt_help.pro index 69570d3..0133ea4 100644 --- a/tools/assistant/translations/qt_help.pro +++ b/tools/assistant/translations/qt_help.pro @@ -42,11 +42,9 @@ HEADERS += ../lib/qhelpcollectionhandler_p.h \ TR_DIR = $$PWD/../../../translations TRANSLATIONS = \ $$TR_DIR/qt_help_da.ts \ - $$TR_DIR/qt_help_de.ts + $$TR_DIR/qt_help_de.ts \ $$TR_DIR/qt_help_ja.ts \ $$TR_DIR/qt_help_pl.ts \ $$TR_DIR/qt_help_ru.ts \ $$TR_DIR/qt_help_zh_CN.ts \ $$TR_DIR/qt_help_zh_TW.ts - -error("This is a dummy profile to be used for translations ONLY.") diff --git a/tools/assistant/translations/translations_adp.pro b/tools/assistant/translations/translations_adp.pro index 852bdeb..f8da2e3 100644 --- a/tools/assistant/translations/translations_adp.pro +++ b/tools/assistant/translations/translations_adp.pro @@ -39,5 +39,3 @@ TRANSLATIONS = \ $$TR_DIR/assistant_adp_ru.ts \ $$TR_DIR/assistant_adp_zh_CN.ts \ $$TR_DIR/assistant_adp_zh_TW.ts - -error("This is a dummy profile to be used for translations ONLY.") -- cgit v0.12 From 038f3eef0f5a0d3012a1529fd4b768bbb9b8fb3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 11:58:04 +0200 Subject: Fixing warnings on GCC... (I) ... by establishing a default behaviour for the switch statements that follow. Reviewed-by: Kim --- src/gui/painting/qdrawutil.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qdrawutil.cpp b/src/gui/painting/qdrawutil.cpp index c20d8d8..1182b9a 100644 --- a/src/gui/painting/qdrawutil.cpp +++ b/src/gui/painting/qdrawutil.cpp @@ -1147,8 +1147,8 @@ void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargin yTarget[rows - 1] = targetCenterBottom; yTarget[rows] = targetRect.top() + targetRect.height(); - qreal dx; - qreal dy; + qreal dx = targetCenterWidth; + qreal dy = targetCenterHeight; switch (rules.horizontal) { case Qt::StretchTile: -- cgit v0.12 From 3f371e2afc9b680b5747a94df57d29afe01204f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 11:59:32 +0200 Subject: Fixing warnings on GCC... (II) ... by establishing a default behaviour for the switch statements that follow. Reviewed-by: ck --- tools/assistant/lib/qhelpsearchquerywidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/assistant/lib/qhelpsearchquerywidget.cpp b/tools/assistant/lib/qhelpsearchquerywidget.cpp index 9ac4a7d..361e9ac 100644 --- a/tools/assistant/lib/qhelpsearchquerywidget.cpp +++ b/tools/assistant/lib/qhelpsearchquerywidget.cpp @@ -229,7 +229,7 @@ private: const QList &query = queryHist->queries.at(queryHist->curQuery); foreach (const QHelpSearchQuery &queryPart, query) { - QLineEdit *lineEdit; + QLineEdit *lineEdit = 0; switch (queryPart.fieldName) { case QHelpSearchQuery::DEFAULT: lineEdit = defaultQuery; -- cgit v0.12 From d8e68a95c43d0eef4ac0ebc31c7dd0e6c487e3b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 12:00:50 +0200 Subject: Fixing warnings on GCC... (III) ... by establishing a default behaviour for the switch statements that follow. Reviewed-by: Thierry Bastian --- src/gui/kernel/qsoftkeymanager.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gui/kernel/qsoftkeymanager.cpp b/src/gui/kernel/qsoftkeymanager.cpp index 265f971..cd3ad22 100644 --- a/src/gui/kernel/qsoftkeymanager.cpp +++ b/src/gui/kernel/qsoftkeymanager.cpp @@ -112,7 +112,7 @@ QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *act { const char* text = standardSoftKeyText(standardKey); QAction *action = new QAction(QSoftKeyManager::tr(text), actionWidget); - QAction::SoftKeyRole softKeyRole; + QAction::SoftKeyRole softKeyRole = QAction::NoSoftKey; switch (standardKey) { case OkSoftKey: case SelectSoftKey: @@ -121,7 +121,6 @@ QAction *QSoftKeyManager::createAction(StandardSoftKey standardKey, QWidget *act softKeyRole = QAction::PositiveSoftKey; break; case CancelSoftKey: - default: softKeyRole = QAction::NegativeSoftKey; break; } -- cgit v0.12 From 95ec7681b70933ce61ef198ed60a375b7393a395 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Abecasis?= Date: Wed, 7 Oct 2009 10:04:33 +0200 Subject: Check the result of scanf Fixes a warning with GCC. Reviewed-by: Markus Goetz --- tools/porting/src/filewriter.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/tools/porting/src/filewriter.cpp b/tools/porting/src/filewriter.cpp index ee8debb..99bd6e7 100644 --- a/tools/porting/src/filewriter.cpp +++ b/tools/porting/src/filewriter.cpp @@ -44,6 +44,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE @@ -106,11 +107,18 @@ FileWriter::WriteResult FileWriter::writeFile(QString filePath, QByteArray conte char answer = 0; while (answer != 'y' && answer != 'n' && answer != 'a') { #if defined(Q_OS_WIN) && defined(_MSC_VER) && _MSC_VER >= 1400 - scanf_s("%c", &answer); + int result = scanf_s("%c", &answer); #else - scanf("%c", &answer); + int result = scanf("%c", &answer); #endif - answer = tolower(answer); + if (1 == result) + answer = tolower(answer); + else if (EOF == result) { + if (EINTR == errno || EILSEQ == errno) + continue; + + answer = 'n'; + } } if(answer == 'n') -- cgit v0.12 From 9c23f571341811b07606db79dd4a4d44ff98acc1 Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Tue, 6 Oct 2009 15:27:30 +0000 Subject: 2009-10-06 Janne Koskinen Reviewed by Simon Hausmann. [Qt] don't enable input methods on Symbian by default. https://bugs.webkit.org/show_bug.cgi?id=30117 If input methods are enabled Symbian FEP will be launched on every pointer event making webpage navigation impossible with QWebView. * Api/qwebview.cpp: (QWebView::QWebView): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49188 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp | 2 +- src/3rdparty/webkit/WebKit/qt/ChangeLog | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp index 3c5f89f..882f3d7 100644 --- a/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp +++ b/src/3rdparty/webkit/WebKit/qt/Api/qwebview.cpp @@ -198,7 +198,7 @@ QWebView::QWebView(QWidget *parent) { d = new QWebViewPrivate(this); -#if !defined(Q_WS_QWS) +#if !defined(Q_WS_QWS) && !defined(Q_OS_SYMBIAN) setAttribute(Qt::WA_InputMethodEnabled); #endif diff --git a/src/3rdparty/webkit/WebKit/qt/ChangeLog b/src/3rdparty/webkit/WebKit/qt/ChangeLog index fd2768c..99ddaa5 100644 --- a/src/3rdparty/webkit/WebKit/qt/ChangeLog +++ b/src/3rdparty/webkit/WebKit/qt/ChangeLog @@ -1,3 +1,16 @@ +2009-10-06 Janne Koskinen + + Reviewed by Simon Hausmann. + + [Qt] don't enable input methods on Symbian by default. + https://bugs.webkit.org/show_bug.cgi?id=30117 + + If input methods are enabled Symbian FEP will be launched on every + pointer event making webpage navigation impossible with QWebView. + + * Api/qwebview.cpp: + (QWebView::QWebView): + 2009-10-01 Simon Hausmann Reviewed by Tor Arne Vestbø. -- cgit v0.12 From d73ea9d00fec200b2dd6de5e4c8f298caffa4aca Mon Sep 17 00:00:00 2001 From: Janne Koskinen Date: Wed, 7 Oct 2009 10:58:16 +0000 Subject: 2009-10-07 Janne Koskinen Reviewed by Simon Hausmann. [Qt] Symbian SBSv2 .data segment adress fix https://bugs.webkit.org/show_bug.cgi?id=30157 RO-section in qtwebkit.dll exceeds allocated space in SBSv2. Move RW-section base address to start from 0x800000 instead of the toolchain default 0x400000 * WebCore.pro: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49239 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- src/3rdparty/webkit/WebCore/ChangeLog | 12 ++++++++++++ src/3rdparty/webkit/WebCore/WebCore.pro | 3 +++ 2 files changed, 15 insertions(+) diff --git a/src/3rdparty/webkit/WebCore/ChangeLog b/src/3rdparty/webkit/WebCore/ChangeLog index aacc3dc..4f7dd4f 100644 --- a/src/3rdparty/webkit/WebCore/ChangeLog +++ b/src/3rdparty/webkit/WebCore/ChangeLog @@ -1,3 +1,15 @@ +2009-10-07 Janne Koskinen + + Reviewed by Simon Hausmann. + + [Qt] Symbian SBSv2 .data segment adress fix + https://bugs.webkit.org/show_bug.cgi?id=30157 + + RO-section in qtwebkit.dll exceeds allocated space in SBSv2. Move RW-section + base address to start from 0x800000 instead of the toolchain default 0x400000 + + * WebCore.pro: + 2009-09-29 Dave Hyatt Reviewed by Jon Honeycutt. diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro index bc22b7a..1c39bb8 100644 --- a/src/3rdparty/webkit/WebCore/WebCore.pro +++ b/src/3rdparty/webkit/WebCore/WebCore.pro @@ -13,6 +13,9 @@ symbian: { TARGET.UID3 = 0x200267C2 } +# RO-section in qtwebkit.dll exceeds allocated space in SBSv2. Move RW-section +# base address to start from 0x800000 instead of the toolchain default 0x400000. +symbian-sbsv2: MMP_RULES += "LINKEROPTION armcc --rw-base 0x800000" include($$PWD/../WebKit.pri) -- cgit v0.12 From 342fcb287b09d016d482e25482ddd1b36e2983a3 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 7 Oct 2009 12:58:57 +0200 Subject: Fix linker error with Symbian/ARM RVCT ABIv2 toolchain Not exporting the whole class prevents the capabilities example from linking, because the vtable is not exported. Changing from member exports to exporting the class also fixes the GCC 3.4.x compiler error. Task-number: QTBUG-4593 Reviewed-by: Thiago --- src/3rdparty/phonon/phonon/objectdescriptionmodel.h | 16 ++++------------ src/s60installs/eabi/phononu.def | 20 ++++++++++---------- 2 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h index ba3cb42..9af2615 100644 --- a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h +++ b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h @@ -175,26 +175,18 @@ namespace Phonon * \author Matthias Kretz */ template - class ObjectDescriptionModel : public QAbstractListModel + class PHONON_EXPORT ObjectDescriptionModel : public QAbstractListModel { public: Q_OBJECT_CHECK -/* MinGW 3.4.x gives an ICE when trying to instantiate one of the - ObjectDescriptionModel classes because it can't handle - half exported classes correct. gcc 4.3.x has a fix for this but - we currently there's no official gcc 4.3 on windows available. - Because of this we need this little hack - */ -#if !defined(Q_CC_MINGW) || __MINGW32_MAJOR_VERSION >= 4 /** \internal */ - static PHONON_EXPORT const QMetaObject staticMetaObject; + static const QMetaObject staticMetaObject; /** \internal */ - PHONON_EXPORT const QMetaObject *metaObject() const; + const QMetaObject *metaObject() const; /** \internal */ - PHONON_EXPORT void *qt_metacast(const char *_clname); + void *qt_metacast(const char *_clname); //int qt_metacall(QMetaObject::Call _c, int _id, void **_a); -#endif /** * Returns the number of rows in the model. This value corresponds diff --git a/src/s60installs/eabi/phononu.def b/src/s60installs/eabi/phononu.def index d407ba4..d70942c 100644 --- a/src/s60installs/eabi/phononu.def +++ b/src/s60installs/eabi/phononu.def @@ -495,11 +495,11 @@ EXPORTS _ZTIN6Phonon19AbstractVideoOutputE @ 494 NONAME _ZTIN6Phonon19BackendCapabilities8NotifierE @ 495 NONAME ABSENT _ZTIN6Phonon22MediaControllerPrivateE @ 496 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 497 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 498 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 499 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 500 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 501 NONAME ABSENT + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 497 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 498 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 499 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 500 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 501 NONAME _ZTIN6Phonon24VolumeFaderEffectPrivateE @ 502 NONAME ABSENT _ZTIN6Phonon26AbstractAudioOutputPrivateE @ 503 NONAME ABSENT _ZTIN6Phonon26AbstractMediaStreamPrivateE @ 504 NONAME @@ -532,11 +532,11 @@ EXPORTS _ZTVN6Phonon19AbstractVideoOutputE @ 531 NONAME _ZTVN6Phonon19BackendCapabilities8NotifierE @ 532 NONAME ABSENT _ZTVN6Phonon22MediaControllerPrivateE @ 533 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 534 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 535 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 536 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 537 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 538 NONAME ABSENT + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 534 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 535 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 536 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 537 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 538 NONAME _ZTVN6Phonon24VolumeFaderEffectPrivateE @ 539 NONAME ABSENT _ZTVN6Phonon26AbstractAudioOutputPrivateE @ 540 NONAME ABSENT _ZTVN6Phonon26AbstractMediaStreamPrivateE @ 541 NONAME -- cgit v0.12 From 136f866f405a60ddbc48e4c666a0fec484f24717 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Wed, 7 Oct 2009 13:25:32 +0200 Subject: Revert "There's no need to include qstringmatcher.h in qstringlist.h" Source-incompatible change This reverts commit 8714892977269591bb9b348c6eb549a7f2c45cbc. Rev-by: Trustme --- src/corelib/tools/qstringlist.cpp | 1 - src/corelib/tools/qstringlist.h | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/tools/qstringlist.cpp b/src/corelib/tools/qstringlist.cpp index f5b2a59..ce39b47 100644 --- a/src/corelib/tools/qstringlist.cpp +++ b/src/corelib/tools/qstringlist.cpp @@ -41,7 +41,6 @@ #include #include -#include QT_BEGIN_NAMESPACE diff --git a/src/corelib/tools/qstringlist.h b/src/corelib/tools/qstringlist.h index c959209..2a2a1d7 100644 --- a/src/corelib/tools/qstringlist.h +++ b/src/corelib/tools/qstringlist.h @@ -47,6 +47,7 @@ #include #include #include +#include #ifdef QT_INCLUDE_COMPAT #include #endif -- cgit v0.12 From 2c579ce42d89ad4cb8c03231b41ae496f24fad4b Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 6 Oct 2009 09:12:58 +0200 Subject: Prevented deployment of QtScript when not compiling that module. RevBy: Miikka Heikkinen --- src/s60installs/s60installs.pro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 3aef05e..7233e8a 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -19,7 +19,6 @@ symbian: { QtXml.dll \ QtGui.dll \ QtNetwork.dll \ - QtScript.dll \ QtTest.dll \ QtSql.dll @@ -94,6 +93,10 @@ symbian: { qtlibraries.sources += Phonon.dll } + contains(QT_CONFIG, script): { + qtlibraries.sources += QtScript.dll + } + contains(QT_CONFIG, webkit): { qtlibraries.sources += QtWebKit.dll } -- cgit v0.12 From 330dc1e5895a8950615a9bbf26154f5387b023b1 Mon Sep 17 00:00:00 2001 From: axis Date: Tue, 6 Oct 2009 17:05:50 +0200 Subject: Fixed a crash bug on S60 SDK 3.1. The crash was caused by the image data not being locked before being accessed. Also avoided an unnecessary detach copy by making the image variable a reference. RevBy: Jani Hautakangas Task: QTBUG-4705 AutoTest: QWidget passed --- src/gui/painting/qwindowsurface_s60.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 664ad48..dc4e43b 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -85,7 +85,9 @@ QS60WindowSurface::~QS60WindowSurface() void QS60WindowSurface::beginPaint(const QRegion &rgn) { if (!qt_widget_private(window())->isOpaque) { - QImage image = static_cast(d_ptr->device.data_ptr().data())->image; + QS60PixmapData *pixmapData = static_cast(d_ptr->device.data_ptr().data()); + pixmapData->beginDataAccess(); + QImage &image = pixmapData->image; QRgb *data = reinterpret_cast(image.bits()); const int row_stride = image.bytesPerLine() / 4; @@ -103,6 +105,7 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn) row += row_stride; } } + pixmapData->endDataAccess(); } } -- cgit v0.12 From 5ce632d3a8354f118225911103628e602559124e Mon Sep 17 00:00:00 2001 From: axis Date: Wed, 7 Oct 2009 11:32:30 +0200 Subject: Fixed deployment when using cetest. Cetest (and other programs that upload dlls manually without using a package) need to deploy some plugins for specific tests. If those tests are deployed in a normal package however, the installation will fail because the plugins are already included in the Qt installation. Fixed that by putting the deployment inside a scope that cetest will define. RevBy: Miikka Heikkinen --- tests/auto/qicoimageformat/qicoimageformat.pro | 9 ++++++--- tests/auto/qicon/qicon.pro | 9 ++++++--- tests/auto/qimage/qimage.pro | 9 ++++++--- tests/auto/qimagereader/qimagereader.pro | 10 +++++++--- tests/auto/qimagewriter/qimagewriter.pro | 9 ++++++--- tests/auto/qitemmodel/qitemmodel.pro | 10 ++++++---- tests/auto/qmovie/qmovie.pro | 10 ++++++---- tests/auto/qsql/qsql.pro | 10 ++++++---- tests/auto/qsqldatabase/qsqldatabase.pro | 10 ++++++---- tests/auto/qsqldriver/qsqldriver.pro | 10 ++++++---- tests/auto/qsqlerror/qsqlerror.pro | 10 ++++++---- tests/auto/qsqlfield/qsqlfield.pro | 10 ++++++---- tests/auto/qsqlquery/qsqlquery.pro | 10 ++++++---- tests/auto/qsqlquerymodel/qsqlquerymodel.pro | 10 ++++++---- tests/auto/qsqlrecord/qsqlrecord.pro | 11 +++++++---- .../qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro | 10 ++++++---- tests/auto/qsqltablemodel/qsqltablemodel.pro | 10 ++++++---- tests/auto/qsqlthread/qsqlthread.pro | 10 ++++++---- tests/auto/qtextstream/test/test.pro | 8 +++++--- 19 files changed, 115 insertions(+), 70 deletions(-) diff --git a/tests/auto/qicoimageformat/qicoimageformat.pro b/tests/auto/qicoimageformat/qicoimageformat.pro index c0aa4b5..b9c8622 100644 --- a/tests/auto/qicoimageformat/qicoimageformat.pro +++ b/tests/auto/qicoimageformat/qicoimageformat.pro @@ -15,9 +15,12 @@ wince*: { } else:symbian* { addFiles.sources = icons addFiles.path = . - addPlugins.sources = qico.dll - addPlugins.path = imageformats - DEPLOYMENT += addFiles addPlugins + DEPLOYMENT += addFiles + qt_not_deployed { + addPlugins.sources = qico.dll + addPlugins.path = imageformats + DEPLOYMENT += addPlugins + } TARGET.UID3 = 0xE0340004 DEFINES += SYMBIAN_SRCDIR_UID=$$lower($$replace(TARGET.UID3,"0x","")) } else { diff --git a/tests/auto/qicon/qicon.pro b/tests/auto/qicon/qicon.pro index 8ae252f..68b888d 100644 --- a/tests/auto/qicon/qicon.pro +++ b/tests/auto/qicon/qicon.pro @@ -18,9 +18,12 @@ wince* { QT += xml svg addFiles.sources = *.png tst_qicon.cpp *.svg *.svgz addFiles.path = . - plugins.sources = qsvgicon.dll - plugins.path = iconengines - DEPLOYMENT += addFiles plugins + DEPLOYMENT += addFiles + qt_not_deployed { + plugins.sources = qsvgicon.dll + plugins.path = iconengines + DEPLOYMENT += plugins + } } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/qimage/qimage.pro b/tests/auto/qimage/qimage.pro index 69d6f0f..3e0bd69 100644 --- a/tests/auto/qimage/qimage.pro +++ b/tests/auto/qimage/qimage.pro @@ -10,9 +10,12 @@ wince*: { TARGET.EPOCHEAPSIZE = 0x200000 0x800000 addImages.sources = images/* addImages.path = images - imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll qtiff.dll qico.dll - imagePlugins.path = imageformats - DEPLOYMENT += addImages imagePlugins + DEPLOYMENT += addImages + qt_not_deployed { + imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll qtiff.dll qico.dll + imagePlugins.path = imageformats + DEPLOYMENT += imagePlugins + } } else { contains(QT_CONFIG, qt3support): QT += qt3support DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/qimagereader/qimagereader.pro b/tests/auto/qimagereader/qimagereader.pro index 31a9b0f..5b061b0 100644 --- a/tests/auto/qimagereader/qimagereader.pro +++ b/tests/auto/qimagereader/qimagereader.pro @@ -30,8 +30,12 @@ symbian*: { images.sources = images images.path = . - imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll - imagePlugins.path = imageformats + DEPLOYMENT += images - DEPLOYMENT += images imagePlugins + qt_not_deployed { + imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll + imagePlugins.path = imageformats + + DEPLOYMENT += imagePlugins + } } diff --git a/tests/auto/qimagewriter/qimagewriter.pro b/tests/auto/qimagewriter/qimagewriter.pro index 5a2c908..8da2942 100644 --- a/tests/auto/qimagewriter/qimagewriter.pro +++ b/tests/auto/qimagewriter/qimagewriter.pro @@ -13,9 +13,12 @@ wince*: { } else:symbian* { addFiles.sources = images\*.* addFiles.path = images - imagePlugins.sources = qjpeg.dll qtiff.dll - imagePlugins.path = imageformats - DEPLOYMENT += addFiles imagePlugins + DEPLOYMENT += addFiles + qt_not_deployed { + imagePlugins.sources = qjpeg.dll qtiff.dll + imagePlugins.path = imageformats + DEPLOYMENT += imagePlugins + } } else { DEFINES += SRCDIR=\\\"$$PWD\\\" } diff --git a/tests/auto/qitemmodel/qitemmodel.pro b/tests/auto/qitemmodel/qitemmodel.pro index eb62b24..2d0bdea 100644 --- a/tests/auto/qitemmodel/qitemmodel.pro +++ b/tests/auto/qitemmodel/qitemmodel.pro @@ -16,9 +16,11 @@ QT += sql symbian { TARGET.EPOCHEAPSIZE="0x100000 0x1000000 // Min 1Mb, max 16Mb" - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qmovie/qmovie.pro b/tests/auto/qmovie/qmovie.pro index 15f0c83..30e5901 100644 --- a/tests/auto/qmovie/qmovie.pro +++ b/tests/auto/qmovie/qmovie.pro @@ -18,7 +18,9 @@ symbian*: { addFiles.path = animations DEPLOYMENT += addFiles - imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll - imagePlugins.path = imageformats - DEPLOYMENT += imagePlugins -} \ No newline at end of file + qt_not_deployed { + imagePlugins.sources = qjpeg.dll qgif.dll qmng.dll + imagePlugins.path = imageformats + DEPLOYMENT += imagePlugins + } +} diff --git a/tests/auto/qsql/qsql.pro b/tests/auto/qsql/qsql.pro index 167a38d..0ec581d 100644 --- a/tests/auto/qsql/qsql.pro +++ b/tests/auto/qsql/qsql.pro @@ -10,9 +10,11 @@ wince*: { } symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qsqldatabase/qsqldatabase.pro b/tests/auto/qsqldatabase/qsqldatabase.pro index 964c8c9..6381219 100644 --- a/tests/auto/qsqldatabase/qsqldatabase.pro +++ b/tests/auto/qsqldatabase/qsqldatabase.pro @@ -23,10 +23,12 @@ symbian { TARGET.EPOCHEAPSIZE=5000 5000000 TARGET.EPOCSTACKSIZE=50000 - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qsqldriver/qsqldriver.pro b/tests/auto/qsqldriver/qsqldriver.pro index 7f289a6..d04ca83 100644 --- a/tests/auto/qsqldriver/qsqldriver.pro +++ b/tests/auto/qsqldriver/qsqldriver.pro @@ -17,9 +17,11 @@ wince*: { } symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qsqlerror/qsqlerror.pro b/tests/auto/qsqlerror/qsqlerror.pro index 2eb7934..456f585 100644 --- a/tests/auto/qsqlerror/qsqlerror.pro +++ b/tests/auto/qsqlerror/qsqlerror.pro @@ -8,9 +8,11 @@ QT = core sql SOURCES += tst_qsqlerror.cpp symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qsqlfield/qsqlfield.pro b/tests/auto/qsqlfield/qsqlfield.pro index 6e5b461..7339854 100644 --- a/tests/auto/qsqlfield/qsqlfield.pro +++ b/tests/auto/qsqlfield/qsqlfield.pro @@ -4,10 +4,12 @@ SOURCES += tst_qsqlfield.cpp QT += sql symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qsqlquery/qsqlquery.pro b/tests/auto/qsqlquery/qsqlquery.pro index 494ca4c..97646ed 100644 --- a/tests/auto/qsqlquery/qsqlquery.pro +++ b/tests/auto/qsqlquery/qsqlquery.pro @@ -15,9 +15,11 @@ wince*: { } symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } diff --git a/tests/auto/qsqlquerymodel/qsqlquerymodel.pro b/tests/auto/qsqlquerymodel/qsqlquerymodel.pro index cd8586c..cda8cab 100644 --- a/tests/auto/qsqlquerymodel/qsqlquerymodel.pro +++ b/tests/auto/qsqlquerymodel/qsqlquerymodel.pro @@ -7,10 +7,12 @@ wince*: { DEPLOYMENT_PLUGIN += qsqlite LIBS += -lws2 }else:symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } else { win32:LIBS += -lws2_32 diff --git a/tests/auto/qsqlrecord/qsqlrecord.pro b/tests/auto/qsqlrecord/qsqlrecord.pro index 67e8ab9..7a72075 100644 --- a/tests/auto/qsqlrecord/qsqlrecord.pro +++ b/tests/auto/qsqlrecord/qsqlrecord.pro @@ -2,10 +2,13 @@ load(qttest_p4) SOURCES += tst_qsqlrecord.cpp symbian { -contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } + } } TARGET.EPOCSTACKSIZE=50000 diff --git a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro index 2fddd03..ee4f2f0 100644 --- a/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro +++ b/tests/auto/qsqlrelationaltablemodel/qsqlrelationaltablemodel.pro @@ -9,10 +9,12 @@ wince*: { DEPLOYMENT += plugFiles LIBS += -lws2 }else:symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } } else { win32-g++ { diff --git a/tests/auto/qsqltablemodel/qsqltablemodel.pro b/tests/auto/qsqltablemodel/qsqltablemodel.pro index a046fb1..9a23237 100644 --- a/tests/auto/qsqltablemodel/qsqltablemodel.pro +++ b/tests/auto/qsqltablemodel/qsqltablemodel.pro @@ -9,10 +9,12 @@ wince*: { DEPLOYMENT += plugFiles LIBS += -lws2 }else:symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } }else { win32:LIBS += -lws2_32 diff --git a/tests/auto/qsqlthread/qsqlthread.pro b/tests/auto/qsqlthread/qsqlthread.pro index 2708f1a..5522232 100644 --- a/tests/auto/qsqlthread/qsqlthread.pro +++ b/tests/auto/qsqlthread/qsqlthread.pro @@ -10,10 +10,12 @@ wince*: { DEPLOYMENT += plugFiles LIBS += -lws2 }else:symbian { - contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { - sqlite.path = /sys/bin - sqlite.sources = sqlite3.dll - DEPLOYMENT += sqlite + qt_not_deployed { + contains(S60_VERSION, 3.1)|contains(S60_VERSION, 3.2)|contains(S60_VERSION, 5.0) { + sqlite.path = /sys/bin + sqlite.sources = sqlite3.dll + DEPLOYMENT += sqlite + } } }else { win32:LIBS += -lws2_32 diff --git a/tests/auto/qtextstream/test/test.pro b/tests/auto/qtextstream/test/test.pro index 9f117d5..c70c27b 100644 --- a/tests/auto/qtextstream/test/test.pro +++ b/tests/auto/qtextstream/test/test.pro @@ -30,9 +30,11 @@ wince*: { }else:symbian { load(data_caging_paths) # Symbian can't define SRCDIR meaningfully here - codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll - codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs - DEPLOYMENT += codecs_plugins + qt_not_deployed { + codecs_plugins.sources = qcncodecs.dll qjpcodecs.dll qtwcodecs.dll qkrcodecs.dll + codecs_plugins.path = $$QT_PLUGINS_BASE_DIR/codecs + DEPLOYMENT += codecs_plugins + } }else { DEFINES += SRCDIR=\\\"$$PWD/../\\\" } -- cgit v0.12 From 0418d438d1c1acfe2c95ee748c1e7c84a0ee8837 Mon Sep 17 00:00:00 2001 From: Denis Dzyubenko Date: Wed, 7 Oct 2009 12:16:04 +0200 Subject: Fixed initialization of the system locale on Symbian. Made it thread-safe and actually make sure that we don't initialize the data several times. Reviewed-by: axis --- src/corelib/tools/qlocale_symbian.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qlocale_symbian.cpp b/src/corelib/tools/qlocale_symbian.cpp index 931fbb4..1660e95 100644 --- a/src/corelib/tools/qlocale_symbian.cpp +++ b/src/corelib/tools/qlocale_symbian.cpp @@ -43,6 +43,7 @@ #include #include #include +#include #include #include "private/qcore_symbian_p.h" @@ -773,8 +774,8 @@ static QLocale::MeasurementSystem symbianMeasurementSystem() QLocale QSystemLocale::fallbackLocale() const { // load system data before query calls - static bool initDone = false; - if (!initDone) { + static QBasicAtomicInt initDone = Q_BASIC_ATOMIC_INITIALIZER(0); + if (initDone.testAndSetRelaxed(0, 1)) { _s60Locale.LoadSystemSettings(); // Initialize platform version dependent function pointers @@ -794,7 +795,12 @@ QLocale QSystemLocale::fallbackLocale() const ptrGetLongDateFormatSpec = &defaultFormatSpec; if (!ptrGetShortDateFormatSpec) ptrGetShortDateFormatSpec = &defaultFormatSpec; + bool ret = initDone.testAndSetRelease(1, 2); + Q_ASSERT(ret); + Q_UNUSED(ret); } + while(initDone != 2) + QThread::yieldCurrentThread(); TLanguage lang = User::Language(); QString locale = QLatin1String(qt_symbianLocaleName(lang)); -- cgit v0.12 From 1e6d00443428cc9c714ba7e3cf323b3e2684db79 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 7 Oct 2009 13:52:57 +0200 Subject: tests/auto/qscriptengine/qscriptengine.pro Windows CE fix Reviewed-by: TrustMe --- tests/auto/qscriptengine/qscriptengine.pro | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/auto/qscriptengine/qscriptengine.pro b/tests/auto/qscriptengine/qscriptengine.pro index d4c0f4c..dd058a4 100644 --- a/tests/auto/qscriptengine/qscriptengine.pro +++ b/tests/auto/qscriptengine/qscriptengine.pro @@ -1,7 +1,12 @@ load(qttest_p4) QT = core gui script SOURCES += tst_qscriptengine.cpp -!symbian:DEFINES += SRCDIR=\\\"$$PWD\\\" + +wince* { + DEFINES += SRCDIR=\\\"./\\\" +} else:!symbian { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} wince*|symbian*: { addFiles.sources = script -- cgit v0.12 From 16c4afe4592587a4bc48ae2170da748e0d149a64 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 7 Oct 2009 13:51:12 +0200 Subject: Fix compile error on Symbian platform Missing header file, resulting in compiler error about returning an incomplete type. Reviewed-by: Trust Me --- src/gui/kernel/qguiplatformplugin.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp index cf15aa2..c48b8f6 100644 --- a/src/gui/kernel/qguiplatformplugin.cpp +++ b/src/gui/kernel/qguiplatformplugin.cpp @@ -45,6 +45,7 @@ #include "qstylefactory.h" #include "qapplication.h" #include "qplatformdefs.h" +#include "qicon.h" #ifdef Q_WS_WINCE #include "qguifunctions_wince.h" -- cgit v0.12 From 722d351de797135273a05ff0f4c63315bf37592d Mon Sep 17 00:00:00 2001 From: Jens Bache-Wiig Date: Wed, 16 Sep 2009 13:59:20 +0200 Subject: Fix QDesktopServices::storageLocation() when registry keys are missing We should not use the registry key when looking up the storage location as this is not really supported by Microsoft and not allways accessible. Instead we now use SHGetSpecialFolderPath. Note that we avoid SHGetKnownFolderPath as it is not available on all CE platforms though it is the reccommended function by Microsoft. Task-number: QTBUG-3241 Reviewed-by: prasanth --- src/gui/util/qdesktopservices_win.cpp | 66 +++++++++++++++++++++++------------ 1 file changed, 44 insertions(+), 22 deletions(-) diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp index 9ae3a15..bf29870 100644 --- a/src/gui/util/qdesktopservices_win.cpp +++ b/src/gui/util/qdesktopservices_win.cpp @@ -41,6 +41,7 @@ #include #include +#include #include #include #include @@ -168,50 +169,72 @@ static bool launchWebBrowser(const QUrl &url) QString QDesktopServices::storageLocation(StandardLocation type) { -#if !defined(QT_NO_SETTINGS) - QSettings settings(QSettings::UserScope, QLatin1String("Microsoft"), QLatin1String("Windows")); - settings.beginGroup(QLatin1String("CurrentVersion/Explorer/Shell Folders")); + QString result; + +#ifndef Q_OS_WINCE + QLibrary library(QLatin1String("shell32")); +#else + QLibrary library(QLatin1String("coredll")); +#endif // Q_OS_WINCE + typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL); + static GetSpecialFolderPath SHGetSpecialFolderPath = + (GetSpecialFolderPath)library.resolve("SHGetSpecialFolderPathW"); + if (!SHGetSpecialFolderPath) + return QString(); + + wchar_t path[MAX_PATH]; + switch (type) { - case CacheLocation: - // Although Microsoft has a Cache key it is a pointer to IE's cache, not a cache - // location for everyone. Most applications seem to be using a - // cache directory located in their AppData directory - return storageLocation(DataLocation) + QLatin1String("\\cache"); case DataLocation: - if (!settings.contains(QLatin1String("Local AppData"))) - break; - return settings.value(QLatin1String("Local AppData")).toString() - + QLatin1String("\\") + QCoreApplication::organizationName() - + QLatin1String("\\") + QCoreApplication::applicationName(); + if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) + result = QString::fromWCharArray(path); + if (!QCoreApplication::organizationName().isEmpty()) + result = result + QLatin1String("\\") + QCoreApplication::organizationName(); + if (!QCoreApplication::applicationName().isEmpty()) + result = result + QLatin1String("\\") + QCoreApplication::applicationName(); break; + case DesktopLocation: - return settings.value(QLatin1String("Desktop")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_DESKTOPDIRECTORY, FALSE)) + result = QString::fromWCharArray(path); break; case DocumentsLocation: - return settings.value(QLatin1String("Personal")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_PERSONAL, FALSE)) + result = QString::fromWCharArray(path); break; case FontsLocation: - return settings.value(QLatin1String("Fonts")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_FONTS, FALSE)) + result = QString::fromWCharArray(path); break; case ApplicationsLocation: - return settings.value(QLatin1String("Programs")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_PROGRAMS, FALSE)) + result = QString::fromWCharArray(path); break; case MusicLocation: - return settings.value(QLatin1String("My Music")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_MYMUSIC, FALSE)) + result = QString::fromWCharArray(path); break; case MoviesLocation: - return settings.value(QLatin1String("My Video")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_MYVIDEO, FALSE)) + result = QString::fromWCharArray(path); break; case PicturesLocation: - return settings.value(QLatin1String("My Pictures")).toString(); + if (SHGetSpecialFolderPath(0, path, CSIDL_MYPICTURES, FALSE)) + result = QString::fromWCharArray(path); break; + case CacheLocation: + // Although Microsoft has a Cache key it is a pointer to IE's cache, not a cache + // location for everyone. Most applications seem to be using a + // cache directory located in their AppData directory + return storageLocation(DataLocation) + QLatin1String("\\cache"); + case QDesktopServices::HomeLocation: return QDir::homePath(); break; @@ -221,8 +244,7 @@ QString QDesktopServices::storageLocation(StandardLocation type) default: break; } -#endif - return QString(); + return result; } QString QDesktopServices::displayName(StandardLocation type) -- cgit v0.12 From 9cf618492d1c89b489bf7e52e45c9577f9d52c1c Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 Oct 2009 20:47:52 +0200 Subject: Autotest: use port 12346 instead of 1, to ensure that it's not a firewall issue Also check if we're not timing out instead of being able to fail. --- tests/auto/networkselftest/tst_networkselftest.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index c6a3119..e927a7a 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -335,10 +335,15 @@ void tst_NetworkSelfTest::dnsResolution() void tst_NetworkSelfTest::serverReachability() { - // check that we get a proper error connecting to port 1 + // check that we get a proper error connecting to port 12346 QTcpSocket socket; - socket.connectToHost(QtNetworkSettings::serverName(), 1); + socket.connectToHost(QtNetworkSettings::serverName(), 12346); + + QTime timer; + timer.start(); socket.waitForConnected(10000); + QVERIFY2(timer.elapsed() < 9900, "Connection to closed port timed out instead of refusing, something is wrong"); + QVERIFY2(socket.state() == QAbstractSocket::UnconnectedState, "Socket connected unexpectedly!"); QVERIFY2(socket.error() == QAbstractSocket::ConnectionRefusedError, QString("Could not reach server: %1").arg(socket.errorString()).toLocal8Bit()); -- cgit v0.12 From d47b7e6d0adcd675ba9da11818b3fa9acc3caff5 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Tue, 6 Oct 2009 20:51:18 +0200 Subject: Autotest: add a few more tests, with IP address and actual hostname --- tests/auto/networkselftest/tst_networkselftest.cpp | 78 ++++++++++++++++++++-- 1 file changed, 74 insertions(+), 4 deletions(-) diff --git a/tests/auto/networkselftest/tst_networkselftest.cpp b/tests/auto/networkselftest/tst_networkselftest.cpp index e927a7a..5a82f28 100644 --- a/tests/auto/networkselftest/tst_networkselftest.cpp +++ b/tests/auto/networkselftest/tst_networkselftest.cpp @@ -46,6 +46,10 @@ class tst_NetworkSelfTest: public QObject { Q_OBJECT + QHostAddress cachedIpAddress; +public: + QHostAddress serverIpAddress(); + private slots: void hostTest(); void dnsResolution_data(); @@ -303,6 +307,16 @@ static void netChat(int port, const QList &chat) } } +QHostAddress tst_NetworkSelfTest::serverIpAddress() +{ + if (cachedIpAddress.protocol() == QAbstractSocket::UnknownNetworkLayerProtocol) { + // need resolving + QHostInfo resolved = QHostInfo::fromName(QtNetworkSettings::serverName()); + cachedIpAddress = resolved.addresses().first(); + } + return cachedIpAddress; +} + void tst_NetworkSelfTest::hostTest() { // this is a localhost self-test @@ -331,6 +345,9 @@ void tst_NetworkSelfTest::dnsResolution() QHostInfo resolved = QHostInfo::fromName(hostName); QVERIFY2(resolved.error() == QHostInfo::NoError, QString("Failed to resolve hostname %1: %2").arg(hostName, resolved.errorString()).toLocal8Bit()); + QVERIFY2(resolved.addresses().size() > 0, "Got 0 addresses for server IP"); + + cachedIpAddress = resolved.addresses().first(); } void tst_NetworkSelfTest::serverReachability() @@ -469,7 +486,18 @@ void tst_NetworkSelfTest::httpsServer() void tst_NetworkSelfTest::httpProxy() { netChat(3128, QList() - // proxy GET + // proxy GET by IP + << Chat::send("GET http://" + serverIpAddress().toString().toLatin1() + "/ HTTP/1.0\r\n" + "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" + "Proxy-connection: close\r\n" + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("200 ") + << Chat::DiscardUntilDisconnect + + // proxy GET by hostname + << Chat::Reconnect << Chat::send("GET http://" + QtNetworkSettings::serverName().toLatin1() + "/ HTTP/1.0\r\n" "Host: " + QtNetworkSettings::serverName().toLatin1() + "\r\n" "Proxy-connection: close\r\n" @@ -479,7 +507,17 @@ void tst_NetworkSelfTest::httpProxy() << Chat::expect("200 ") << Chat::DiscardUntilDisconnect - // proxy CONNECT + // proxy CONNECT by IP + << Chat::Reconnect + << Chat::send("CONNECT " + serverIpAddress().toString().toLatin1() + ":21 HTTP/1.0\r\n" + "\r\n") + << Chat::expect("HTTP/1.") + << Chat::discardUntil(" ") + << Chat::expect("200 ") + << Chat::discardUntil("\r\n\r\n") + << ftpChat() + + // proxy CONNECT by hostname << Chat::Reconnect << Chat::send("CONNECT " + QtNetworkSettings::serverName().toLatin1() + ":21 HTTP/1.0\r\n" "\r\n") @@ -487,7 +525,8 @@ void tst_NetworkSelfTest::httpProxy() << Chat::discardUntil(" ") << Chat::expect("200 ") << Chat::discardUntil("\r\n\r\n") - << ftpChat()); + << ftpChat() + ); } void tst_NetworkSelfTest::httpProxyBasicAuth() @@ -540,11 +579,22 @@ static const char handshakeAuthPassword[] = "\5\1\2\1\12qsockstest\10password"; static const char handshakeOkPasswdAuth[] = "\5\2\1\0"; static const char handshakeAuthNotOk[] = "\5\377"; static const char connect1[] = "\5\1\0\1\177\0\0\1\0\25"; // Connect IPv4 127.0.0.1 port 21 +static const char connect1a[] = "\5\1\0\1"; // just "Connect to IPv4" +static const char connect1b[] = "\0\25"; // just "port 21" static const char connect2[] = "\5\1\0\3\11localhost\0\25"; // Connect hostname localhost 21 +static const char connect2a[] = "\5\1\0\3"; // just "Connect to hostname" static const char connected[] = "\5\0\0"; +#define QBA(x) (QByteArray::fromRawData(x, -1 + sizeof(x))) + void tst_NetworkSelfTest::socks5Proxy() { + union { + char buf[4]; + quint32 data; + } ip4Address; + ip4Address.data = qToBigEndian(serverIpAddress().toIPv4Address()); + netChat(1080, QList() // IP address connection << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) @@ -555,7 +605,17 @@ void tst_NetworkSelfTest::socks5Proxy() << Chat::skipBytes(6) // the server's local address and port << ftpChat() - // hostname connection + // connect by IP + << Chat::Reconnect + << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) + << Chat::expect(QByteArray(handshakeOkNoAuth, -1 + sizeof handshakeOkNoAuth)) + << Chat::send(QBA(connect1a) + QByteArray::fromRawData(ip4Address.buf, 4) + QBA(connect1b)) + << Chat::expect(QByteArray(connected, -1 + sizeof connected)) + << Chat::expect("\1") // IPv4 address following + << Chat::skipBytes(6) // the server's local address and port + << ftpChat() + + // connect to "localhost" by hostname << Chat::Reconnect << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) << Chat::expect(QByteArray(handshakeOkNoAuth, -1 + sizeof handshakeOkNoAuth)) @@ -564,6 +624,16 @@ void tst_NetworkSelfTest::socks5Proxy() << Chat::expect("\1") // IPv4 address following << Chat::skipBytes(6) // the server's local address and port << ftpChat() + + // connect to server by its official name + << Chat::Reconnect + << Chat::send(QByteArray(handshakeNoAuth, -1 + sizeof handshakeNoAuth)) + << Chat::expect(QByteArray(handshakeOkNoAuth, -1 + sizeof handshakeOkNoAuth)) + << Chat::send(QBA(connect2a) + char(QtNetworkSettings::serverName().size()) + QtNetworkSettings::serverName().toLatin1() + QBA(connect1b)) + << Chat::expect(QByteArray(connected, -1 + sizeof connected)) + << Chat::expect("\1") // IPv4 address following + << Chat::skipBytes(6) // the server's local address and port + << ftpChat() ); } -- cgit v0.12 From 591f5353c88439594b9340226b4843d7ca2888ef Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Wed, 7 Oct 2009 11:48:08 +0200 Subject: Fix ASSERT caused by Plastique style when setting an application font with a pixel size Use QFontInfo to query the pointSize() instead of asking the font directly, fixing this assert: ASSERT failure in QFont::setPointSize: "point size must be greater than 0", file text/qfont.cpp, line 855 Task-number: QTBUG-3555 Reviewed-by: Simon Hausmann --- src/gui/styles/qplastiquestyle.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/styles/qplastiquestyle.cpp b/src/gui/styles/qplastiquestyle.cpp index 349a60d..8e19022 100644 --- a/src/gui/styles/qplastiquestyle.cpp +++ b/src/gui/styles/qplastiquestyle.cpp @@ -3328,7 +3328,7 @@ void QPlastiqueStyle::drawControl(ControlElement element, const QStyleOption *op // Draw the text centered QFont font = painter->font(); - font.setPointSize(font.pointSize() - 1); + font.setPointSize(QFontInfo(font).pointSize() - 1); painter->setFont(font); painter->setPen(dockWidget->palette.windowText().color()); painter->drawText(titleRect, -- cgit v0.12 From 1c5b84937a7dd993e188f2a6fbf4e28916f683c9 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Wed, 7 Oct 2009 12:01:06 +0200 Subject: fix ts and qm targets under windows --- translations/translations.pri | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/translations/translations.pri b/translations/translations.pri index 0c5c1ee..0fb91e8 100644 --- a/translations/translations.pri +++ b/translations/translations.pri @@ -9,12 +9,9 @@ defineReplace(prependAll) { } defineReplace(fixPath) { -WIN { - return ($$replace($$1, /, \)) -} ELSE { + win32:1 ~= s|/|\\| return ($$1) } -} LUPDATE = $$fixPath($$QT_BUILD_TREE/bin/lupdate) -locations relative -no-ui-lines LRELEASE = $$fixPath($$QT_BUILD_TREE/bin/lrelease) -- cgit v0.12 From 75b41faff44a1488d88eca6e910d4b617cb42221 Mon Sep 17 00:00:00 2001 From: Marius Storm-Olsen Date: Wed, 7 Oct 2009 13:28:25 +0200 Subject: Avoid adding a debug library to the glue projects, when debug_and_release The VCPROJ/SLN generator generates dependencies on the glue project, so the glue must use the correct library for the dependencies to be correct. The qtAddLibrary() would add the project 'default' to the glue, which could end up adding a debug lib to the glue, so the dependency checker wouldn't find the proper project. We therefore force qtAddLibrary to only add d/_debug if we're not using debug_and_release, or not in the glue part Reviewed-by: Rohan McGovern --- mkspecs/features/qt_functions.prf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 243a829..6322233 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -50,7 +50,7 @@ defineTest(qtAddLibrary) { INCLUDEPATH *= $$MW_LAYER_SYSTEMINCLUDE } isEmpty(LINKAGE) { - CONFIG(debug, debug|release) { + if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { win32:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}d mac:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}_debug } -- cgit v0.12 From 16e21cb0beb0e5f5189048b95d1cb74ae0c0702a Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Wed, 7 Oct 2009 14:10:26 +0200 Subject: mediaplayer: crash in settings dialog. The MediaPlayer requires that an output device is available. Task-number: QTBUG-4755 Reviewed-by: Gareth Stockwell --- src/3rdparty/phonon/mmf/audiooutput.cpp | 26 +++++++++++++++++++------- src/3rdparty/phonon/mmf/audiooutput.h | 13 +++++++++---- src/3rdparty/phonon/mmf/backend.cpp | 18 ++++++++++++++---- 3 files changed, 42 insertions(+), 15 deletions(-) diff --git a/src/3rdparty/phonon/mmf/audiooutput.cpp b/src/3rdparty/phonon/mmf/audiooutput.cpp index 58e2f5e..5a00f60 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.cpp +++ b/src/3rdparty/phonon/mmf/audiooutput.cpp @@ -18,6 +18,8 @@ along with this library. If not, see . #include +#include + #include "audiooutput.h" #include "defs.h" #include "mediaobject.h" @@ -74,16 +76,13 @@ void MMF::AudioOutput::setVolume(qreal volume) int MMF::AudioOutput::outputDevice() const { - return 0; -} - -bool MMF::AudioOutput::setOutputDevice(int) -{ - return true; + return AudioOutputDeviceID; } -bool MMF::AudioOutput::setOutputDevice(const Phonon::AudioOutputDevice &) +bool MMF::AudioOutput::setOutputDevice(int index) { + Q_ASSERT_X(index == AudioOutputDeviceID, Q_FUNC_INFO, + "We only support one output device, with id 0"); return true; } @@ -101,4 +100,17 @@ bool MMF::AudioOutput::activateOnMediaObject(MediaObject *mo) return true; } +QHash MMF::AudioOutput::audioOutputDescription(int index) +{ + if (index == AudioOutputDeviceID) { + QHash retval; + + retval.insert("name", QCoreApplication::translate("Phonon::MMF", "Audio Output")); + retval.insert("description", QCoreApplication::translate("Phonon::MMF", "The audio output device")); + retval.insert("available", true); + + return retval; + } +} + QT_END_NAMESPACE diff --git a/src/3rdparty/phonon/mmf/audiooutput.h b/src/3rdparty/phonon/mmf/audiooutput.h index 0a962a9..d0ba086 100644 --- a/src/3rdparty/phonon/mmf/audiooutput.h +++ b/src/3rdparty/phonon/mmf/audiooutput.h @@ -19,6 +19,8 @@ along with this library. If not, see . #ifndef PHONON_MMF_AUDIOOUTPUT_H #define PHONON_MMF_AUDIOOUTPUT_H +#include + #include "mmf_medianode.h" #include @@ -65,10 +67,12 @@ public: */ virtual bool setOutputDevice(int); - /** - * Has no effect. - */ - virtual bool setOutputDevice(const Phonon::AudioOutputDevice &); + static QHash audioOutputDescription(int index); + + enum Constants + { + AudioOutputDeviceID = 0 + }; protected: virtual bool activateOnMediaObject(MediaObject *mo); @@ -78,6 +82,7 @@ Q_SIGNALS: void audioDeviceFailed(); private: + void setVolumeObserver(VolumeObserver* observer); qreal m_volume; diff --git a/src/3rdparty/phonon/mmf/backend.cpp b/src/3rdparty/phonon/mmf/backend.cpp index be43f46..f542ec9 100644 --- a/src/3rdparty/phonon/mmf/backend.cpp +++ b/src/3rdparty/phonon/mmf/backend.cpp @@ -107,6 +107,12 @@ QList Backend::objectDescriptionIndexes(ObjectDescriptionType type) const { case EffectType: retval.append(EffectFactory::effectIndexes()); + break; + case AudioOutputDeviceType: + // We only have one possible output device, but we need at least + // one. + retval.append(AudioOutput::AudioOutputDeviceID); + break; default: ; } @@ -119,10 +125,14 @@ QHash Backend::objectDescriptionProperties(ObjectDescripti { TRACE_CONTEXT(Backend::connectNodes, EBackend); - if (type == EffectType) - return EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type(index)); - else - return QHash(); + switch (type) { + case EffectType: + return EffectFactory::audioEffectDescriptions(AbstractAudioEffect::Type(index)); + case AudioOutputDeviceType: + return AudioOutput::audioOutputDescription(index); + default: + return QHash(); + } } bool Backend::startConnectionChange(QSet) -- cgit v0.12 From 350f97874544396a99cf82b47eb9a6e50838a88a Mon Sep 17 00:00:00 2001 From: Frans Englich Date: Wed, 7 Oct 2009 14:29:06 +0200 Subject: Use QScopedPointer for AudioPlayer's CPlayerType. Reviewed-by: Gareth Stockwell --- src/3rdparty/phonon/mmf/audioplayer.cpp | 9 +++------ src/3rdparty/phonon/mmf/audioplayer.h | 5 ++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/3rdparty/phonon/mmf/audioplayer.cpp b/src/3rdparty/phonon/mmf/audioplayer.cpp index 6c1fc68..ceaf305 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.cpp +++ b/src/3rdparty/phonon/mmf/audioplayer.cpp @@ -34,14 +34,13 @@ using namespace Phonon::MMF; // Constructor / destructor //----------------------------------------------------------------------------- -MMF::AudioPlayer::AudioPlayer() : m_player(0) +MMF::AudioPlayer::AudioPlayer() { construct(); } MMF::AudioPlayer::AudioPlayer(const AbstractPlayer& player) : AbstractMediaPlayer(player) - , m_player(0) { construct(); } @@ -51,7 +50,7 @@ void MMF::AudioPlayer::construct() TRACE_CONTEXT(AudioPlayer::AudioPlayer, EAudioApi); TRACE_ENTRY_0(); - TRAPD(err, m_player = CPlayerType::NewL(*this, 0, EMdaPriorityPreferenceNone)); + TRAPD(err, m_player.reset(CPlayerType::NewL(*this, 0, EMdaPriorityPreferenceNone))); if (KErrNone != err) { changeState(ErrorState); } @@ -64,8 +63,6 @@ MMF::AudioPlayer::~AudioPlayer() TRACE_CONTEXT(AudioPlayer::~AudioPlayer, EAudioApi); TRACE_ENTRY_0(); - delete m_player; - TRACE_EXIT_0(); } @@ -237,7 +234,7 @@ void MMF::AudioPlayer::MapcPlayComplete(TInt aError) CPlayerType *MMF::AudioPlayer::player() const { - return m_player; + return m_player.data(); } diff --git a/src/3rdparty/phonon/mmf/audioplayer.h b/src/3rdparty/phonon/mmf/audioplayer.h index f16de1d..60ef436 100644 --- a/src/3rdparty/phonon/mmf/audioplayer.h +++ b/src/3rdparty/phonon/mmf/audioplayer.h @@ -86,6 +86,9 @@ public: virtual void MapcPlayComplete(TInt aError); #endif + /** + * This class owns the pointer. + */ CPlayerType *player() const; private: @@ -96,7 +99,7 @@ private: * Using CPlayerType typedef in order to be able to easily switch between * CMdaAudioPlayerUtility and CDrmPlayerUtility */ - CPlayerType* m_player; + QScopedPointer m_player; }; } } -- cgit v0.12 From f2363657d53f033488ca0ec141cb1261847eed5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Wed, 7 Oct 2009 16:13:17 +0300 Subject: Compiler warning given for missing audio file (sax.mp3) Use desktopservices sax.mp3 instead of one in autotests when deploying mediaplayer for symbian. This avoids getting a warning for missing file in install packages. Task-number: QTBUG-4719 Reviewed-by: Alessandro Portale --- demos/mediaplayer/mediaplayer.pro | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/demos/mediaplayer/mediaplayer.pro b/demos/mediaplayer/mediaplayer.pro index 84293f2..a420cc3 100644 --- a/demos/mediaplayer/mediaplayer.pro +++ b/demos/mediaplayer/mediaplayer.pro @@ -28,8 +28,7 @@ DEPLOYMENT_PLUGIN += phonon_ds9 phonon_waveout symbian { TARGET.UID3 = 0xA000C613 - addFiles.sources = ../../tests/auto/mediaobject/media/sax.mp3 - + addFiles.sources = ../embedded/desktopservices/data/sax.mp3 addFiles.path = /data/sounds/ DEPLOYMENT += addFiles -- cgit v0.12 From 97005819172157c9d178bc338013488d22102bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?= Date: Wed, 7 Oct 2009 15:16:09 +0200 Subject: Using const refs for passing qreal will make Qt slower on some systems. For instance, if sizeof(qreal) == 4 (for instance on ARM) the stack size needed will be the same, so it will just add an extra indirection. --- src/gui/graphicsview/qgraphicsanchorlayout_p.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp index 34071cc..e3cd4f9 100644 --- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp +++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp @@ -275,8 +275,8 @@ static qreal getFactor(qreal value, qreal min, qreal pref, qreal max) } } -static qreal getExpandingFactor(const qreal &expSize, const qreal &sizeAtPreferred, - const qreal &sizeAtExpanding, const qreal &sizeAtMaximum) +static qreal getExpandingFactor(qreal expSize, qreal sizeAtPreferred, + qreal sizeAtExpanding, qreal sizeAtMaximum) { const qreal lower = qMin(sizeAtPreferred, sizeAtMaximum); const qreal upper = qMax(sizeAtPreferred, sizeAtMaximum); -- cgit v0.12 From 4c4875919de4a46cc40df93f64fe04e3fdad81fb Mon Sep 17 00:00:00 2001 From: Liang QI Date: Wed, 7 Oct 2009 15:45:22 +0200 Subject: Support small screen for QToolBar auto test. We need to test through extension tool button and menu for it when there is no enough width on embedded devices. Reviewed-by: TrustMe --- src/gui/widgets/qtoolbarextension_p.h | 2 +- tests/auto/qtoolbar/tst_qtoolbar.cpp | 123 +++++++++++++++++++++++++++++----- 2 files changed, 107 insertions(+), 18 deletions(-) diff --git a/src/gui/widgets/qtoolbarextension_p.h b/src/gui/widgets/qtoolbarextension_p.h index 5d622ec..5fe74a9 100644 --- a/src/gui/widgets/qtoolbarextension_p.h +++ b/src/gui/widgets/qtoolbarextension_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE #ifndef QT_NO_TOOLBUTTON -class QToolBarExtension : public QToolButton +class Q_AUTOTEST_EXPORT QToolBarExtension : public QToolButton { Q_OBJECT Qt::Orientation orientation; diff --git a/tests/auto/qtoolbar/tst_qtoolbar.cpp b/tests/auto/qtoolbar/tst_qtoolbar.cpp index e4f317c..ac86fd9 100644 --- a/tests/auto/qtoolbar/tst_qtoolbar.cpp +++ b/tests/auto/qtoolbar/tst_qtoolbar.cpp @@ -54,6 +54,8 @@ #include #include #include +#include +#include #include "../../shared/util.h" @@ -569,6 +571,29 @@ void tst_QToolBar::actionGeometry() qt_x11_wait_for_window_manager(&tb); #endif + QList extensions = tb.findChildren(); + + QRect rect01; + QRect rect02; + QRect rect03; + QRect rect04; + QMenu *popupMenu; + + if (extensions.size() != 0) + { + QToolBarExtension *extension = extensions.at(0); + if (extension->isVisible()) { + QRect rect0 = extension->geometry(); + QTest::mouseClick( extension, Qt::LeftButton, 0, rect0.center(), -1 ); + QApplication::processEvents(); + popupMenu = qobject_cast(extension->menu()); + rect01 = popupMenu->actionGeometry(&action1); + rect02 = popupMenu->actionGeometry(&action2); + rect03 = popupMenu->actionGeometry(&action3); + rect04 = popupMenu->actionGeometry(&action4); + } + } + QRect rect1 = tb.actionGeometry(&action1); QRect rect2 = tb.actionGeometry(&action2); QRect rect3 = tb.actionGeometry(&action3); @@ -590,10 +615,25 @@ void tst_QToolBar::actionGeometry() QVERIFY(!rect4.isNull()); QVERIFY(!rect4.isEmpty()); - QCOMPARE(tb.actionAt(rect1.center()), &action1); - QCOMPARE(tb.actionAt(rect2.center()), &action2); - QCOMPARE(tb.actionAt(rect3.center()), &action3); - QCOMPARE(tb.actionAt(rect4.center()), &action4); + if (rect01.isValid()) + QCOMPARE(popupMenu->actionAt(rect01.center()), &action1); + else + QCOMPARE(tb.actionAt(rect1.center()), &action1); + + if (rect02.isValid()) + QCOMPARE(popupMenu->actionAt(rect02.center()), &action2); + else + QCOMPARE(tb.actionAt(rect2.center()), &action2); + + if (rect03.isValid()) + QCOMPARE(popupMenu->actionAt(rect03.center()), &action3); + else + QCOMPARE(tb.actionAt(rect3.center()), &action3); + + if (rect04.isValid()) + QCOMPARE(popupMenu->actionAt(rect04.center()), &action4); + else + QCOMPARE(tb.actionAt(rect4.center()), &action4); } void tst_QToolBar::actionAt() @@ -864,33 +904,82 @@ void tst_QToolBar::actionTriggered() qt_x11_wait_for_window_manager(&tb); #endif + QList extensions = tb.findChildren(); + + QRect rect01; + QRect rect02; + QRect rect03; + QRect rect04; + QMenu *popupMenu; + + if (extensions.size() != 0) + { + QToolBarExtension *extension = extensions.at(0); + if (extension->isVisible()) { + QRect rect0 = extension->geometry(); + QTest::mouseClick( extension, Qt::LeftButton, 0, rect0.center(), -1 ); + QApplication::processEvents(); + popupMenu = qobject_cast(extension->menu()); + rect01 = popupMenu->actionGeometry(&action1); + rect02 = popupMenu->actionGeometry(&action2); + rect03 = popupMenu->actionGeometry(&action3); + rect04 = popupMenu->actionGeometry(&action4); + } + } + QRect rect1 = tb.actionGeometry(&action1); QRect rect2 = tb.actionGeometry(&action2); QRect rect3 = tb.actionGeometry(&action3); QRect rect4 = tb.actionGeometry(&action4); - QAbstractButton *button1 = qobject_cast(tb.childAt(rect1.center())); - QAbstractButton *button2 = qobject_cast(tb.childAt(rect2.center())); - QAbstractButton *button3 = qobject_cast(tb.childAt(rect3.center())); - QAbstractButton *button4 = qobject_cast(tb.childAt(rect4.center())); - QVERIFY(button1 != 0); - QVERIFY(button2 != 0); - QVERIFY(button3 != 0); - QVERIFY(button4 != 0); + + QAbstractButton *button1; + QAbstractButton *button2; + QAbstractButton *button3; + QAbstractButton *button4; + + if (!rect01.isValid()) { + button1 = qobject_cast(tb.childAt(rect1.center())); + QVERIFY(button1 != 0); + } + if (!rect02.isValid()) { + button2 = qobject_cast(tb.childAt(rect2.center())); + QVERIFY(button2 != 0); + } + if (!rect03.isValid()) { + button3 = qobject_cast(tb.childAt(rect3.center())); + QVERIFY(button3 != 0); + } + if (!rect04.isValid()) { + button4 = qobject_cast(tb.childAt(rect4.center())); + QVERIFY(button4 != 0); + } ::triggered = 0; - QTest::mouseClick(button1, Qt::LeftButton); + if (!rect01.isValid()) + QTest::mouseClick(button1, Qt::LeftButton); + else + QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect01.center(), -1 ); QCOMPARE(::triggered, &action1); ::triggered = 0; - QTest::mouseClick(button2, Qt::LeftButton); + if (!rect02.isValid()) + QTest::mouseClick(button2, Qt::LeftButton); + else + QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect02.center(), -1 ); QCOMPARE(::triggered, &action2); ::triggered = 0; - QTest::mouseClick(button3, Qt::LeftButton); + if (!rect03.isValid()) + QTest::mouseClick(button3, Qt::LeftButton); + else + QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect03.center(), -1 ); QCOMPARE(::triggered, &action3); ::triggered = 0; - QTest::mouseClick(button4, Qt::LeftButton); + if (!rect04.isValid()) + QTest::mouseClick(button4, Qt::LeftButton); + else + QTest::mouseClick(popupMenu, Qt::LeftButton, 0, rect04.center(), -1 ); QCOMPARE(::triggered, &action4); } @@ -977,7 +1066,7 @@ void tst_QToolBar::accel() mw.show(); QApplication::setActiveWindow(&mw); QTest::qWait(100); - QTRY_COMPARE(QApplication::activeWindow(), &mw); + QTRY_COMPARE(QApplication::activeWindow(), static_cast(&mw)); QTest::keyClick(&mw, Qt::Key_T, Qt::AltModifier); QTest::qWait(300); -- cgit v0.12 From cc95666378ee0aef1cc6b02b544fdf52645f6d9b Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 7 Oct 2009 15:52:59 +0200 Subject: ignore invalid WM_KEYDOWN messages on Windows For some strange reason, I get the following message if I press a non-numerical key on the SIP of a Samsung Omnia device, running Windows mobile 6.1: WM_KEYDOWN wParam == 0 lParam == 1 That message is invalid. We must ignore it. Reviewed-by: mauricek --- src/gui/kernel/qkeymapper_win.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qkeymapper_win.cpp b/src/gui/kernel/qkeymapper_win.cpp index 25b6dce..8138839 100644 --- a/src/gui/kernel/qkeymapper_win.cpp +++ b/src/gui/kernel/qkeymapper_win.cpp @@ -949,8 +949,8 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, const MSG &msg, bool if(msg.wParam == VK_PROCESSKEY) return true; - // Ignore invalid virtual keycode (see bug 127424) - if (msg.wParam == 0xFF) + // Ignore invalid virtual keycodes (see bugs 127424, QTBUG-3630) + if (msg.wParam == 0 || msg.wParam == 0xFF) return true; // Translate VK_* (native) -> Key_* (Qt) keys -- cgit v0.12 From aa863c61ec5e68ff73c02e25a2954cdba9c2ef15 Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 3 Jul 2009 16:40:32 +0200 Subject: QHeaderView: fixed the sizeHint with hidden sections We used to check the 100 first sections and 100 last sections Now we make sure we check 100 visible sections Task-number: 255574 --- src/gui/itemviews/qheaderview.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/gui/itemviews/qheaderview.cpp b/src/gui/itemviews/qheaderview.cpp index c5e6fed..b1306cc 100644 --- a/src/gui/itemviews/qheaderview.cpp +++ b/src/gui/itemviews/qheaderview.cpp @@ -526,20 +526,24 @@ QSize QHeaderView::sizeHint() const return d->cachedSizeHint; int width = 0; int height = 0; + d->executePostedLayout(); + // get size hint for the first n sections - int c = qMin(count(), 100); - for (int i = 0; i < c; ++i) { + int i = 0; + for (int checked = 0; checked < 100 && i < d->sectionCount; ++i) { if (isSectionHidden(i)) continue; + checked++; QSize hint = sectionSizeFromContents(i); width = qMax(hint.width(), width); height = qMax(hint.height(), height); } // get size hint for the last n sections - c = qMax(count() - 100, c); - for (int j = count() - 1; j >= c; --j) { + i = qMax(i, d->sectionCount - 100 ); + for (int j = d->sectionCount - 1, checked = 0; j > i && checked < 100; --j) { if (isSectionHidden(j)) continue; + checked++; QSize hint = sectionSizeFromContents(j); width = qMax(hint.width(), width); height = qMax(hint.height(), height); -- cgit v0.12 From 5ecccd6a67333066978055604a50973d8fb12748 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 7 Oct 2009 16:15:30 +0200 Subject: Fix: Lazy instantiation of a static QAction We should not create a QAction instance at program startup, that is before QApplication was initialized. One reason not to do that is that internal fonts are prematurely initialized without QApplication::qt_is_gui_used set to true, which leads to wrong font Dpis in qt_defaultDpiX(). This issue was detected due to the failure in tst_QTextLayout, cases: testDefaultTabs, testTabs, testMultilineTab, testRightTab, testTabsInAlignedParag, testCenteredTab, testDelimiterTab, testMultiTab and tabsForRtl. Fix: create a Q_GLOBAL_STATIC_WITH_ARGS for that QAction instance. Reviewed-by: Liang QI --- src/gui/widgets/qmenu_symbian.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/widgets/qmenu_symbian.cpp b/src/gui/widgets/qmenu_symbian.cpp index c656ef8..d757f98 100644 --- a/src/gui/widgets/qmenu_symbian.cpp +++ b/src/gui/widgets/qmenu_symbian.cpp @@ -74,12 +74,13 @@ struct SymbianMenuItem QAction* action; }; +Q_GLOBAL_STATIC_WITH_ARGS(QAction, contextAction, (0)) + static QList symbianMenus; static QList nativeMenuBars; static uint qt_symbian_menu_static_cmd_id = QT_SYMBIAN_FIRST_MENU_ITEM; static QPointer widgetWithContextMenu; static QList contextMenuActionList; -static QAction contextAction(0); static int contexMenuCommand=0; bool menuExists() @@ -400,8 +401,8 @@ void QMenuBarPrivate::QSymbianMenuBarPrivate::rebuild() contextMenuActionList.clear(); if (widgetWithContextMenu) { contexMenuCommand = qt_symbian_menu_static_cmd_id; // Increased inside insertNativeMenuItems - contextAction.setText(QMenuBar::tr("Actions")); - contextMenuActionList.append(&contextAction); + contextAction()->setText(QMenuBar::tr("Actions")); + contextMenuActionList.append(contextAction()); insertNativeMenuItems(contextMenuActionList); } } -- cgit v0.12 From bf8d74bb8e849cb9eea74ef8fdb82d8926c48880 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 7 Oct 2009 16:16:15 +0200 Subject: Fix tst_QTextLayout::testTabDPIScale Symbian has a different default font size than other OSses. Consider that fact in tst_QTextLayout::testTabDPIScale Reviewed-By: Liang QI --- tests/auto/qtextlayout/tst_qtextlayout.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 5ccae94..f63742a 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -55,7 +55,12 @@ #include +// Same font point size values as in QFont::QFont(..) +#ifdef Q_OS_SYMBIAN +#define TESTFONT_SIZE 7 +#else #define TESTFONT_SIZE 12 +#endif //TESTED_CLASS= //TESTED_FILES= -- cgit v0.12 From 080e0a369932323d9f14224bca8922e4abb3ebfb Mon Sep 17 00:00:00 2001 From: Alexis Menard Date: Wed, 7 Oct 2009 16:42:09 +0200 Subject: With an embedded linux licence you should also be able to use the Qt Windows version for development. This used to work before 4.5.1 Task-number:Qt-704 Reviewed-by:thiago --- configure.exe | Bin 1168896 -> 2362880 bytes tools/configure/tools.cpp | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/configure.exe b/configure.exe index aa254f3..838889c 100755 Binary files a/configure.exe and b/configure.exe differ diff --git a/tools/configure/tools.cpp b/tools/configure/tools.cpp index 0d170f5..c958dd9 100644 --- a/tools/configure/tools.cpp +++ b/tools/configure/tools.cpp @@ -152,7 +152,7 @@ void Tools::checkLicense(QMap &dictionary, QMap Date: Wed, 7 Oct 2009 16:56:32 +0200 Subject: Skip the srcoll per pixel mouse wheel test on Windows CE The test data does not account for different geometries on different devices. The 'magic number' 89 would have to be adapted for each variant. A more robust test would be required to suit all cases. Reviewed-by: banana joe --- tests/auto/qtableview/tst_qtableview.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 4bf7c2e..bb0e226 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -3412,6 +3412,12 @@ void tst_QTableView::mouseWheel() QFETCH(int, horizontalPositon); QFETCH(int, verticalPosition); + if (scrollMode == int(QAbstractItemView::ScrollPerPixel)) + { +#ifdef Q_OS_WINCE + QSKIP("Since different Windows CE versions sport different taskbars, we skip this test", SkipSingle); +#endif + } QtTestTableModel model(100, 100); QtTestTableView view; view.resize(500, 500); -- cgit v0.12 From 843bb5cb6dfb1a17454fe3cebb599377884ce00e Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 7 Oct 2009 16:55:22 +0200 Subject: Revert "Fix tst_QTextLayout::testTabDPIScale" This reverts commit bf8d74bb8e849cb9eea74ef8fdb82d8926c48880. Breaks more cases than it actually fixes. modified: tests/auto/qtextlayout/tst_qtextlayout.cpp --- tests/auto/qtextlayout/tst_qtextlayout.cpp | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index f63742a..5ccae94 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -55,12 +55,7 @@ #include -// Same font point size values as in QFont::QFont(..) -#ifdef Q_OS_SYMBIAN -#define TESTFONT_SIZE 7 -#else #define TESTFONT_SIZE 12 -#endif //TESTED_CLASS= //TESTED_FILES= -- cgit v0.12 From 6480937b52c4d18dce0288c69586467f36584590 Mon Sep 17 00:00:00 2001 From: Jeremy Katz Date: Wed, 7 Oct 2009 17:07:14 +0200 Subject: viewport()->update() after delegate set for QAbstractItemView Reviewed-by: Olivier --- src/gui/itemviews/qabstractitemview.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp index 27528de..37f4184 100644 --- a/src/gui/itemviews/qabstractitemview.cpp +++ b/src/gui/itemviews/qabstractitemview.cpp @@ -761,7 +761,7 @@ void QAbstractItemView::setItemDelegate(QAbstractItemDelegate *delegate) } } d->itemDelegate = delegate; - update(); + viewport()->update(); } /*! @@ -826,7 +826,7 @@ void QAbstractItemView::setItemDelegateForRow(int row, QAbstractItemDelegate *de } d->rowDelegates.insert(row, delegate); } - update(); + viewport()->update(); } /*! @@ -883,7 +883,7 @@ void QAbstractItemView::setItemDelegateForColumn(int column, QAbstractItemDelega } d->columnDelegates.insert(column, delegate); } - update(); + viewport()->update(); } /*! -- cgit v0.12 From 3cad63946965416c89703fbf3d9730e856283c06 Mon Sep 17 00:00:00 2001 From: Alessandro Portale Date: Wed, 7 Oct 2009 17:45:48 +0200 Subject: Fix tst_QTextLayout::testTabDPIScale for WinCE/Symbian Make tst_QTextLayout::testTabDPIScale work by increasing the tab stop distances. Now, systems with higher DPIs can pass this test. Review-By: Joerg Bornemann --- tests/auto/qtextlayout/tst_qtextlayout.cpp | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/tests/auto/qtextlayout/tst_qtextlayout.cpp b/tests/auto/qtextlayout/tst_qtextlayout.cpp index 5ccae94..fe87dfb 100644 --- a/tests/auto/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/qtextlayout/tst_qtextlayout.cpp @@ -1085,10 +1085,6 @@ QT_END_NAMESPACE void tst_QTextLayout::testTabDPIScale() { - #ifdef Q_OS_WINCE - QSKIP("This test fails for large DPIs.", SkipAll); - #endif - class MyPaintDevice : public QPaintDevice { QPaintEngine *paintEngine () const { return 0; } int metric (QPaintDevice::PaintDeviceMetric metric) const { @@ -1118,14 +1114,14 @@ void tst_QTextLayout::testTabDPIScale() QTextOption option = layout.textOption(); QList tabs; QTextOption::Tab tab; - tab.position = 100; + tab.position = 200; tabs.append(tab); - tab.position = 200; + tab.position = 400; tab.type = QTextOption::RightTab; tabs.append(tab); - tab.position = 300; + tab.position = 600; tab.type = QTextOption::CenterTab; tabs.append(tab); option.setTabs(tabs); @@ -1133,7 +1129,7 @@ void tst_QTextLayout::testTabDPIScale() layout.beginLayout(); QTextLine line = layout.createLine(); - line.setLineWidth(500.); + line.setLineWidth(1500.); layout.endLayout(); QCOMPARE(line.cursorToX(0), 0.); QCOMPARE(line.cursorToX(1), (double) TESTFONT_SIZE); // check that the font does not resize @@ -1142,9 +1138,9 @@ void tst_QTextLayout::testTabDPIScale() int fixedScale = (int)( scale * qreal(64)); // into a QFixed scale = ((qreal)fixedScale)/(qreal)64; // and out of a QFixed - QCOMPARE(line.cursorToX(6), 100 * scale); - QCOMPARE(line.cursorToX(12), 200 * scale - TESTFONT_SIZE * 5); - QCOMPARE(line.cursorToX(18), 300 * scale - TESTFONT_SIZE * 3 / 2.0); + QCOMPARE(line.cursorToX(6), tabs.at(0).position * scale); + QCOMPARE(line.cursorToX(12), tabs.at(1).position * scale - TESTFONT_SIZE * 5); + QCOMPARE(line.cursorToX(18), tabs.at(2).position * scale - TESTFONT_SIZE * 3 / 2.0); } void tst_QTextLayout::tabHeight() -- cgit v0.12 From db182f75b69cd47ce8abbcc5acb2551306919a05 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 7 Oct 2009 13:58:02 +0200 Subject: QGuiPlatformPlugin: QFileIconProvider and QIcon backend. Add a backend for QFileIconProvider in the platform plugin Also change the QIcon::fromTheme backend in the platform plugin: On KDE, we unfortunately can't use KIcon as backend, as the current API doesn't let us know easily (and quickly) wether we should use the fallback or not (KDE always fallback to the question mark "unknown" icon) So we will use the QIconLoader even on KDE. But we need to make sure that the theme name and the icon search paths are correct. Ask that to the platform plugin Reviewed-by: Jens Bache-Wiig --- src/gui/image/qicon.cpp | 5 -- src/gui/image/qiconloader.cpp | 88 +++++---------------------------- src/gui/itemviews/qfileiconprovider.cpp | 5 ++ src/gui/kernel/qguiplatformplugin.cpp | 68 ++++++++++++++++++++++++- src/gui/kernel/qguiplatformplugin_p.h | 6 ++- 5 files changed, 87 insertions(+), 85 deletions(-) diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 3448459..e0779a0 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -962,15 +962,10 @@ QString QIcon::themeName() */ QIcon QIcon::fromTheme(const QString &name, const QIcon &fallback) { - static QCache iconCache; QIcon icon; - icon = qt_guiPlatformPlugin()->loadIcon(name); - if (!icon.isNull()) - return icon; - if (iconCache.contains(name)) { icon = *iconCache.object(name); } else { diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp index adc2967..5412e11 100644 --- a/src/gui/image/qiconloader.cpp +++ b/src/gui/image/qiconloader.cpp @@ -43,7 +43,7 @@ #include #include -#include +#include #include #include @@ -68,47 +68,25 @@ QT_BEGIN_NAMESPACE Q_GLOBAL_STATIC(QIconLoader, iconLoaderInstance) +/* Theme to use in last resort, if the theme does not have the icon, neither the parents */ static QString fallbackTheme() { - QString defaultTheme; -#ifdef Q_WS_X11 - if (X11->desktopEnvironment == DE_GNOME) - defaultTheme = QLatin1String("gnome"); - else if (X11->desktopEnvironment == DE_KDE) - defaultTheme = X11->desktopVersion >= 4 ? - QString::fromLatin1("oxygen") : - QString::fromLatin1("crystalsvg"); -#endif - return defaultTheme; -} - -static QString systemThemeName() -{ - QString result = fallbackTheme(); #ifdef Q_WS_X11 if (X11->desktopEnvironment == DE_GNOME) { -#ifndef QT_NO_STYLE_GTK - result = QGtk::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"), - result); -#endif + return QLatin1String("gnome"); } else if (X11->desktopEnvironment == DE_KDE) { - QSettings settings(QKde::kdeHome() + - QLatin1String("/share/config/kdeglobals"), - QSettings::IniFormat); - - settings.beginGroup(QLatin1String("Icons")); - - result = settings.value(QLatin1String("Theme"), result).toString(); + return X11->desktopVersion >= 4 + ? QString::fromLatin1("oxygen") + : QString::fromLatin1("crystalsvg"); } #endif - return result; + return QString(); } - QIconLoader::QIconLoader() : m_themeKey(1), m_supportsSvg(false) { - m_systemTheme = systemThemeName(); + m_systemTheme = qt_guiPlatformPlugin()->systemIconThemeName(); QFactoryLoader iconFactoryLoader(QIconEngineFactoryInterfaceV2_iid, QLatin1String("/iconengines"), @@ -128,7 +106,7 @@ void QIconLoader::updateSystemTheme() { // Only change if this is not explicitly set by the user if (m_userTheme.isEmpty()) { - QString theme = systemThemeName(); + QString theme = qt_guiPlatformPlugin()->systemIconThemeName(); if (theme != m_systemTheme) { m_systemTheme = theme; invalidateKey(); @@ -152,51 +130,7 @@ void QIconLoader::setThemeSearchPath(const QStringList &searchPaths) QStringList QIconLoader::themeSearchPaths() const { if (m_iconDirs.isEmpty()) { - -#if defined(Q_WS_X11) - - QString xdgDirString = QFile::decodeName(getenv("XDG_DATA_DIRS")); - if (xdgDirString.isEmpty()) - xdgDirString = QLatin1String("/usr/local/share/:/usr/share/"); - - QStringList xdgDirs = xdgDirString.split(QLatin1Char(':')); - - for (int i = 0 ; i < xdgDirs.size() ; ++i) { - QDir dir(xdgDirs[i]); - if (dir.exists()) - m_iconDirs.append(dir.path() + - QLatin1String("/icons")); - } - - if (X11->desktopEnvironment == DE_KDE) { - - m_iconDirs << QLatin1Char(':') + - QKde::kdeHome() + - QLatin1String("/share/icons"); - QStringList kdeDirs = - QFile::decodeName(getenv("KDEDIRS")).split(QLatin1Char(':')); - - for (int i = 0 ; i< kdeDirs.count() ; ++i) { - QDir dir(QLatin1Char(':') + kdeDirs.at(i) + - QLatin1String("/share/icons")); - if (dir.exists()) - m_iconDirs.append(dir.path()); - } - } - - // Add home directory first in search path - QDir homeDir(QDir::homePath() + QLatin1String("/.icons")); - if (homeDir.exists()) - m_iconDirs.prepend(homeDir.path()); -#endif - -#if defined(Q_WS_WIN) - m_iconDirs.append(qApp->applicationDirPath() + - QLatin1String("/icons")); -#elif defined(Q_WS_MAC) - m_iconDirs.append(qApp->applicationDirPath() + - QLatin1String("/../Resources/icons")); -#endif + m_iconDirs = qt_guiPlatformPlugin()->iconThemeSearchPaths(); // Allways add resource directory as search path m_iconDirs.append(QLatin1String(":/icons")); } @@ -291,7 +225,7 @@ QThemeIconEntries QIconLoader::findIconHelper(const QString &themeName, if (!theme.isValid()) { theme = QIconTheme(themeName); if (!theme.isValid()) - theme = fallbackTheme(); + theme = QIconTheme(fallbackTheme()); themeList.insert(themeName, theme); } diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp index c78a49b..e3d17ad 100644 --- a/src/gui/itemviews/qfileiconprovider.cpp +++ b/src/gui/itemviews/qfileiconprovider.cpp @@ -61,6 +61,7 @@ #endif #include +#include #ifndef SHGFI_ADDOVERLAYS #define SHGFI_ADDOVERLAYS 0x000000020 @@ -385,6 +386,10 @@ QIcon QFileIconProvider::icon(const QFileInfo &info) const { Q_D(const QFileIconProvider); + QIcon platformIcon = qt_guiPlatformPlugin()->fileSystemIcon(info); + if (!platformIcon.isNull()) + return platformIcon; + #if defined(Q_WS_X11) && !defined(QT_NO_STYLE_GTK) if (X11->desktopEnvironment == DE_GNOME) { QIcon gtkIcon = QGtk::getFilesystemIcon(info); diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp index c48b8f6..6e074a1 100644 --- a/src/gui/kernel/qguiplatformplugin.cpp +++ b/src/gui/kernel/qguiplatformplugin.cpp @@ -41,6 +41,9 @@ #include "qguiplatformplugin_p.h" #include +#include +#include +#include #include "private/qfactoryloader_p.h" #include "qstylefactory.h" #include "qapplication.h" @@ -58,6 +61,7 @@ extern bool qt_wince_is_pocket_pc(); //qguifunctions_wince.cpp #if defined(Q_WS_X11) #include "qkde_p.h" #include "qt_x11_p.h" +#include #endif @@ -194,8 +198,68 @@ QPalette QGuiPlatformPlugin::palette() return QPalette(); } -/* backend for QIcon::fromTheme. A null icon means it uses the default backend */ -QIcon QGuiPlatformPlugin::loadIcon(const QString &name) +/* the default icon theme name for QIcon::fromTheme. */ +QString QGuiPlatformPlugin::systemIconThemeName() +{ + QString result; +#ifdef Q_WS_X11 + if (X11->desktopEnvironment == DE_GNOME) { + result = QString::fromLatin1("gnome"); +#ifndef QT_NO_STYLE_GTK + result = QGtk::getGConfString(QLatin1String("/desktop/gnome/interface/icon_theme"), result); +#endif + } else if (X11->desktopEnvironment == DE_KDE) { + result = X11->desktopVersion >= 4 ? QString::fromLatin1("oxygen") : QString::fromLatin1("crystalsvg"); + QSettings settings(QKde::kdeHome() + QLatin1String("/share/config/kdeglobals"), QSettings::IniFormat); + settings.beginGroup(QLatin1String("Icons")); + result = settings.value(QLatin1String("Theme"), result).toString(); + } +#endif + return result; +} + + +QStringList QGuiPlatformPlugin::iconThemeSearchPaths() +{ + QStringList paths; +#if defined(Q_WS_X11) + QString xdgDirString = QFile::decodeName(getenv("XDG_DATA_DIRS")); + if (xdgDirString.isEmpty()) + xdgDirString = QLatin1String("/usr/local/share/:/usr/share/"); + + QStringList xdgDirs = xdgDirString.split(QLatin1Char(':')); + + for (int i = 0 ; i < xdgDirs.size() ; ++i) { + QDir dir(xdgDirs[i]); + if (dir.exists()) + paths.append(dir.path() + QLatin1String("/icons")); + } + if (X11->desktopEnvironment == DE_KDE) { + paths << QLatin1Char(':') + QKde::kdeHome() + QLatin1String("/share/icons"); + QStringList kdeDirs = QFile::decodeName(getenv("KDEDIRS")).split(QLatin1Char(':')); + for (int i = 0 ; i< kdeDirs.count() ; ++i) { + QDir dir(QLatin1Char(':') + kdeDirs.at(i) + QLatin1String("/share/icons")); + if (dir.exists()) + paths.append(dir.path()); + } + } + + // Add home directory first in search path + QDir homeDir(QDir::homePath() + QLatin1String("/.icons")); + if (homeDir.exists()) + paths.prepend(homeDir.path()); +#endif + +#if defined(Q_WS_WIN) + paths.append(qApp->applicationDirPath() + QLatin1String("/icons")); +#elif defined(Q_WS_MAC) + paths.append(qApp->applicationDirPath() + QLatin1String("/../Resources/icons")); +#endif + return paths; +} + +/* backend for QFileIconProvider, null icon means default */ +QIcon QGuiPlatformPlugin::fileSystemIcon(const QFileInfo &) { return QIcon(); } diff --git a/src/gui/kernel/qguiplatformplugin_p.h b/src/gui/kernel/qguiplatformplugin_p.h index 57ea8af..f7d4b92 100644 --- a/src/gui/kernel/qguiplatformplugin_p.h +++ b/src/gui/kernel/qguiplatformplugin_p.h @@ -68,6 +68,7 @@ class QPalette; class QIcon; class QFileDialog; class QColorDialog; +class QFileInfo; struct Q_GUI_EXPORT QGuiPlatformPluginInterface : public QFactoryInterface { @@ -89,7 +90,10 @@ class Q_GUI_EXPORT QGuiPlatformPlugin : public QObject, public QGuiPlatformPlugi virtual QString styleName(); virtual QPalette palette(); - virtual QIcon loadIcon(const QString &name); + virtual QString systemIconThemeName(); + virtual QStringList iconThemeSearchPaths(); + virtual QIcon fileSystemIcon(const QFileInfo &); + enum PlatformHint { PH_ToolButtonStyle, PH_ToolBarIconSize }; virtual int platformHint(PlatformHint hint); -- cgit v0.12 From 01f0164d71612ba3f03f2e8f58ff6137dc38e4cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 7 Oct 2009 12:08:29 +0200 Subject: Documented the NoOpaqueDetection enum value in ImageConversionFlags. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This might be useful for some people, so we should document it. Reviewed-by: Bjørn Erik Nilsen --- src/corelib/global/qnamespace.qdoc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/corelib/global/qnamespace.qdoc b/src/corelib/global/qnamespace.qdoc index b7775bd..ab232bf 100644 --- a/src/corelib/global/qnamespace.qdoc +++ b/src/corelib/global/qnamespace.qdoc @@ -713,7 +713,13 @@ \omitvalue Dither_Mask \omitvalue AlphaDither_Mask \omitvalue DitherMode_Mask - \omitvalue NoOpaqueDetection + + \value NoOpaqueDetection Do not check whether the image contains non-opaque + pixels. Use this if you know that the image is semi-transparent and + you want to avoid the overhead of checking the pixels in the image + until a non-opaque pixel is found, or if you want the pixmap to + retain an alpha channel for some other reason. If the image has no + alpha channel this flag has no effect. */ /*! \enum Qt::GUIStyle -- cgit v0.12 From 57209cf902f9d0c9bea5b599b54fa4bdc015d2b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 7 Oct 2009 13:37:31 +0200 Subject: Optimized clipping in the GL 2 engine for winding fills. When no stencil clip is set we reduce the number of compositing passes for rendering winding fill paths from four to two. When stencil clip is set, the number of compositing passes is reduced from five to four. For clipping with a winding fill path, the number of compositing passes are reduced from five to four when stencil clipping is already enabled. A performance improvement of up to 85 % was measured in certain cases. Reviewed-by: Trond --- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 69 +++++++++++++--------- .../gl2paintengineex/qpaintengineex_opengl2_p.h | 1 + 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 5875124..b3638ff 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -391,7 +391,6 @@ void QGL2PaintEngineExPrivate::setBrush(const QBrush* brush) } -// Unless this gets used elsewhere, it's probably best to merge it into fillStencilWithVertexArray void QGL2PaintEngineExPrivate::useSimpleShader() { shaderManager->simpleProgram()->enable(); @@ -891,16 +890,26 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); - // Stencil the brush onto the dest buffer - glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT); // Pass if stencil buff value != 0 - glStencilOp(GL_KEEP, GL_ZERO, GL_ZERO); - glStencilMask(GL_STENCIL_HIGH_BIT); + glStencilMask(0xff); + glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); + + if (q->state()->clipTestEnabled) { + // Pass when high bit is set, replace stencil value with current clip + glStencilFunc(GL_NOTEQUAL, q->state()->currentClip, GL_STENCIL_HIGH_BIT); + } else if (path.hasWindingFill()) { + // Pass when any bit is set, replace stencil value with 0 + glStencilFunc(GL_NOTEQUAL, 0, 0xff); + } else { + // Pass when high bit is set, replace stencil value with 0 + glStencilFunc(GL_NOTEQUAL, 0, GL_STENCIL_HIGH_BIT); + } prepareForDraw(currentBrush->isOpaque()); if (inRenderText) prepareDepthRangeForRenderText(); + // Stencil the brush onto the dest buffer composite(vertexCoordinateArray.boundingRect()); if (inRenderText) @@ -916,7 +925,7 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& vertexArray, bool useWindingFill) { // qDebug("QGL2PaintEngineExPrivate::fillStencilWithVertexArray()"); - glStencilMask(0xffff); // Enable stencil writes + glStencilMask(0xff); // Enable stencil writes if (dirtyStencilRegion.intersects(currentScissorBounds)) { QVector clearRegion = dirtyStencilRegion.intersected(currentScissorBounds).rects(); @@ -948,39 +957,30 @@ void QGL2PaintEngineExPrivate::fillStencilWithVertexArray(QGL2PEXVertexArray& ve if (useWindingFill) { if (q->state()->clipTestEnabled) { + // Flatten clip values higher than current clip, and set high bit to match current clip glStencilFunc(GL_LEQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); composite(vertexArray.boundingRect()); glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT, GL_STENCIL_HIGH_BIT); - } else { - glStencilFunc(GL_ALWAYS, 0, 0xffff); + } else if (!stencilClean) { + // Clear stencil buffer within bounding rect + glStencilFunc(GL_ALWAYS, 0, 0xff); glStencilOp(GL_ZERO, GL_ZERO, GL_ZERO); composite(vertexArray.boundingRect()); } // Inc. for front-facing triangle glStencilOpSeparate(GL_FRONT, GL_KEEP, GL_INCR_WRAP, GL_INCR_WRAP); - //Dec. for back-facing "holes" + // Dec. for back-facing "holes" glStencilOpSeparate(GL_BACK, GL_KEEP, GL_DECR_WRAP, GL_DECR_WRAP); glStencilMask(~GL_STENCIL_HIGH_BIT); drawVertexArrays(vertexArray, GL_TRIANGLE_FAN); if (q->state()->clipTestEnabled) { - // clear high bit of stencil outside of path - glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); - glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); - glStencilMask(GL_STENCIL_HIGH_BIT); - composite(vertexArray.boundingRect()); - // reset lower bits of stencil inside path to current clip - glStencilFunc(GL_EQUAL, GL_STENCIL_HIGH_BIT | q->state()->currentClip, GL_STENCIL_HIGH_BIT); + // Clear high bit of stencil outside of path + glStencilFunc(GL_EQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); - glStencilMask(~GL_STENCIL_HIGH_BIT); - composite(vertexArray.boundingRect()); - } else { - // set high bit of stencil inside path - glStencilFunc(GL_NOTEQUAL, 0, 0xffff); - glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); glStencilMask(GL_STENCIL_HIGH_BIT); composite(vertexArray.boundingRect()); } @@ -1020,7 +1020,7 @@ void QGL2PaintEngineExPrivate::resetClipIfNeeded() QGLRect rect(bounds.left(), bounds.top(), bounds.right(), bounds.bottom()); // Set high bit on clip region - glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xffff); + glStencilFunc(GL_LEQUAL, q->state()->currentClip, 0xff); glStencilOp(GL_KEEP, GL_INVERT, GL_INVERT); glStencilMask(GL_STENCIL_HIGH_BIT); composite(rect); @@ -1028,7 +1028,7 @@ void QGL2PaintEngineExPrivate::resetClipIfNeeded() // Reset clipping to 1 and everything else to zero glStencilFunc(GL_NOTEQUAL, 0x01, GL_STENCIL_HIGH_BIT); glStencilOp(GL_ZERO, GL_REPLACE, GL_REPLACE); - glStencilMask(0xFFFF); + glStencilMask(0xff); composite(rect); q->state()->currentClip = 1; @@ -1636,6 +1636,7 @@ bool QGL2PaintEngineEx::begin(QPaintDevice *pdev) d->use_system_clip = !systemClip().isEmpty(); d->dirtyStencilRegion = QRect(0, 0, d->width, d->height); + d->stencilClean = true; // Calling begin paint should make the correct context current. So, any // code which calls into GL or otherwise needs a current context *must* @@ -1731,7 +1732,7 @@ void QGL2PaintEngineExPrivate::updateClipScissorTest() glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); } else { glDisable(GL_STENCIL_TEST); - glStencilFunc(GL_ALWAYS, 0, 0xffff); + glStencilFunc(GL_ALWAYS, 0, 0xff); } #ifdef QT_GL_NO_SCISSOR_TEST @@ -1787,7 +1788,7 @@ void QGL2PaintEngineExPrivate::clearClip(uint value) { dirtyStencilRegion -= currentScissorBounds; - glStencilMask(0xffff); + glStencilMask(0xff); glClearStencil(value); glClear(GL_STENCIL_BUFFER_BIT); glStencilMask(0x0); @@ -1802,6 +1803,8 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) if (matrixDirty) updateMatrix(); + stencilClean = false; + const bool singlePass = !path.hasWindingFill() && (((q->state()->currentClip == maxClip - 1) && q->state()->clipTestEnabled) || q->state()->needsClipBufferClear); @@ -1819,7 +1822,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) if (q->state()->clipTestEnabled) glStencilFunc(GL_LEQUAL, q->state()->currentClip, ~GL_STENCIL_HIGH_BIT); else - glStencilFunc(GL_ALWAYS, 0, 0xffff); + glStencilFunc(GL_ALWAYS, 0, 0xff); vertexCoordinateArray.clear(); vertexCoordinateArray.addPath(path, inverseScale); @@ -1841,9 +1844,17 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); } else { - glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT); glStencilOp(GL_KEEP, GL_REPLACE, GL_REPLACE); - glStencilMask(0xffff); + glStencilMask(0xff); + + if (!q->state()->clipTestEnabled && path.hasWindingFill()) { + // Pass when any clip bit is set, set high bit + glStencilFunc(GL_NOTEQUAL, GL_STENCIL_HIGH_BIT, ~GL_STENCIL_HIGH_BIT); + composite(vertexCoordinateArray.boundingRect()); + } + + // Pass when high bit is set, replace stencil value with new clip value + glStencilFunc(GL_NOTEQUAL, value, GL_STENCIL_HIGH_BIT); composite(vertexCoordinateArray.boundingRect()); } diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h index 28c972e..46be398 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2_p.h @@ -223,6 +223,7 @@ public: bool shaderMatrixUniformDirty; bool opacityUniformDirty; + bool stencilClean; // Has the stencil not been used for clipping so far? QRegion dirtyStencilRegion; QRect currentScissorBounds; uint maxClip; -- cgit v0.12 From 14a8f1fb7414885cc3868b1d27699b5a0d59e7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 7 Oct 2009 14:59:34 +0200 Subject: Optimized rasterizing of paths using stencil method in GL 2 engine. Making the triangle fan of each sub path start at the sub path's centroid will on average improve performance for complex paths, because less pixels that are outside the path need to be touched. The centroid is a more balanced choice than just picking the first element of the sub path as triangle fan origin. A performance improvement of 20 % was measured for star formed paths. Reviewed-by: Trond --- src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp | 37 +++++++++++++++++++++- src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h | 5 ++- .../gl2paintengineex/qpaintengineex_opengl2.cpp | 6 ++-- 3 files changed, 43 insertions(+), 5 deletions(-) diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp b/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp index 866d1a2..1fe3999 100644 --- a/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp +++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray.cpp @@ -67,7 +67,30 @@ void QGL2PEXVertexArray::addRect(const QRectF &rect) << rect.bottomRight() << rect.bottomLeft() << rect.topLeft(); } -void QGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseScale) +void QGL2PEXVertexArray::addClosingLine(int index) +{ + if (QPointF(vertexArray.at(index)) != QPointF(vertexArray.last())) + vertexArray.add(vertexArray.at(index)); +} + +void QGL2PEXVertexArray::addCentroid(const QVectorPath &path, int subPathIndex) +{ + const QPointF *const points = reinterpret_cast(path.points()); + const QPainterPath::ElementType *const elements = path.elements(); + + QPointF sum = points[subPathIndex]; + int count = 1; + + for (int i = subPathIndex + 1; i < path.elementCount() && (!elements || elements[i] != QPainterPath::MoveToElement); ++i) { + sum += points[i]; + ++count; + } + + const QPointF centroid = sum / qreal(count); + vertexArray.add(centroid); +} + +void QGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline) { const QPointF* const points = reinterpret_cast(path.points()); const QPainterPath::ElementType* const elements = path.elements(); @@ -78,6 +101,10 @@ void QGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseSc boundingRectDirty = false; } + if (!outline) + addCentroid(path, 0); + + int lastMoveTo = vertexArray.size(); vertexArray.add(points[0]); // The first element is always a moveTo do { @@ -96,8 +123,14 @@ void QGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseSc const QPainterPath::ElementType elementType = elements[i]; switch (elementType) { case QPainterPath::MoveToElement: + if (!outline) + addClosingLine(lastMoveTo); // qDebug("element[%d] is a MoveToElement", i); vertexArrayStops.append(vertexArray.size()); + if (!outline) { + addCentroid(path, i); + lastMoveTo = vertexArray.size(); + } lineToArray(points[i].x(), points[i].y()); // Add the moveTo as a new vertex break; case QPainterPath::LineToElement: @@ -115,6 +148,8 @@ void QGL2PEXVertexArray::addPath(const QVectorPath &path, GLfloat curveInverseSc } } while (0); + if (!outline) + addClosingLine(lastMoveTo); vertexArrayStops.append(vertexArray.size()); } diff --git a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h index 08ce234..719904f 100644 --- a/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h +++ b/src/opengl/gl2paintengineex/qgl2pexvertexarray_p.h @@ -104,7 +104,7 @@ public: boundingRectDirty(true) {} void addRect(const QRectF &rect); - void addPath(const QVectorPath &path, GLfloat curveInverseScale); + void addPath(const QVectorPath &path, GLfloat curveInverseScale, bool outline = true); void clear(); QGLPoint* data() {return vertexArray.data();} @@ -124,6 +124,9 @@ private: bool boundingRectDirty; inline void curveToArray(const QGLPoint &cp1, const QGLPoint &cp2, const QGLPoint &ep, GLfloat inverseScale); + + void addClosingLine(int index); + void addCentroid(const QVectorPath &path, int subPathIndex); }; QT_END_NAMESPACE diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index b3638ff..ab02c69 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -880,13 +880,13 @@ void QGL2PaintEngineExPrivate::fill(const QVectorPath& path) || path.shape() == QVectorPath::ConvexPolygonHint) { vertexCoordinateArray.clear(); - vertexCoordinateArray.addPath(path, inverseScale); + vertexCoordinateArray.addPath(path, inverseScale, false); prepareForDraw(currentBrush->isOpaque()); drawVertexArrays(vertexCoordinateArray, GL_TRIANGLE_FAN); } else { // The path is too complicated & needs the stencil technique vertexCoordinateArray.clear(); - vertexCoordinateArray.addPath(path, inverseScale); + vertexCoordinateArray.addPath(path, inverseScale, false); fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); @@ -1825,7 +1825,7 @@ void QGL2PaintEngineExPrivate::writeClip(const QVectorPath &path, uint value) glStencilFunc(GL_ALWAYS, 0, 0xff); vertexCoordinateArray.clear(); - vertexCoordinateArray.addPath(path, inverseScale); + vertexCoordinateArray.addPath(path, inverseScale, false); if (!singlePass) fillStencilWithVertexArray(vertexCoordinateArray, path.hasWindingFill()); -- cgit v0.12 From df5cdc6d9a22ae11d607e9359a3bb9a80596fdb6 Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Wed, 7 Oct 2009 18:16:15 +0200 Subject: QDesktopServices compile fix for Windows CE There's no CSIDL_LOCAL_APPDATA on Windows CE. Use CSIDL_APPDATA instead. Reviewed-by: TrustMe --- src/gui/util/qdesktopservices_win.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp index bf29870..4ecef97 100644 --- a/src/gui/util/qdesktopservices_win.cpp +++ b/src/gui/util/qdesktopservices_win.cpp @@ -186,7 +186,11 @@ QString QDesktopServices::storageLocation(StandardLocation type) switch (type) { case DataLocation: +#if defined Q_WS_WINCE + if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE)) +#else if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) +#endif result = QString::fromWCharArray(path); if (!QCoreApplication::organizationName().isEmpty()) result = result + QLatin1String("\\") + QCoreApplication::organizationName(); -- cgit v0.12 From 2dd5facac01df4a90fbf9b7ce666704fddaf9e4f Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 7 Oct 2009 12:56:50 +0200 Subject: Inline QScriptValuePrivate operator new and delete Make allocation faster. --- src/script/api/qscriptengine_p.h | 16 ++++++++++++++++ src/script/api/qscriptvalue.cpp | 16 ---------------- src/script/api/qscriptvalue_p.h | 4 ++-- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/script/api/qscriptengine_p.h b/src/script/api/qscriptengine_p.h index 5f31054..f1fc135 100644 --- a/src/script/api/qscriptengine_p.h +++ b/src/script/api/qscriptengine_p.h @@ -468,6 +468,22 @@ inline QScriptValue QScriptValuePrivate::property(const QString &name, int resol return property(JSC::Identifier(exec, name), resolveMode); } +inline void* QScriptValuePrivate::operator new(size_t size, QScriptEnginePrivate *engine) +{ + if (engine) + return engine->allocateScriptValuePrivate(size); + return qMalloc(size); +} + +inline void QScriptValuePrivate::operator delete(void *ptr) +{ + QScriptValuePrivate *d = reinterpret_cast(ptr); + if (d->engine) + d->engine->freeScriptValuePrivate(d); + else + qFree(d); +} + inline void QScriptEnginePrivate::registerScriptString(QScriptStringPrivate *value) { Q_ASSERT(value->type == QScriptStringPrivate::HeapAllocated); diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 92c987c..1c668a9 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -466,22 +466,6 @@ void QScriptValuePrivate::detachFromEngine() engine = 0; } -void* QScriptValuePrivate::operator new(size_t size, QScriptEnginePrivate *engine) -{ - if (engine) - return engine->allocateScriptValuePrivate(size); - return qMalloc(size); -} - -void QScriptValuePrivate::operator delete(void *ptr) -{ - QScriptValuePrivate *d = reinterpret_cast(ptr); - if (d->engine) - d->engine->freeScriptValuePrivate(d); - else - qFree(d); -} - /*! \internal */ diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index 6cbda97..351d616 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -68,8 +68,8 @@ class QScriptValuePrivate { Q_DISABLE_COPY(QScriptValuePrivate); public: - void* operator new(size_t, QScriptEnginePrivate*); - void operator delete(void*); + inline void* operator new(size_t, QScriptEnginePrivate*); + inline void operator delete(void*); enum Type { JavaScriptCore, -- cgit v0.12 From eb10655a9e94d0953d5f43815750fe128b862051 Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 7 Oct 2009 16:31:09 +0200 Subject: Use JSC::asObject() when we know that the value is an object It's faster than calling getObject(), since getObject() will do type checking of the value. --- src/script/api/qscriptvalue.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/script/api/qscriptvalue.cpp b/src/script/api/qscriptvalue.cpp index 1c668a9..b8340a7 100644 --- a/src/script/api/qscriptvalue.cpp +++ b/src/script/api/qscriptvalue.cpp @@ -280,7 +280,7 @@ QScriptValue QScriptValuePrivate::property(const JSC::Identifier &id, int resolv { Q_ASSERT(isObject()); JSC::ExecState *exec = engine->currentFrame; - JSC::JSObject *object = jscValue.getObject(); + JSC::JSObject *object = JSC::asObject(jscValue); JSC::PropertySlot slot(const_cast(object)); JSC::JSValue result; if (const_cast(object)->getOwnPropertySlot(exec, id, slot)) { @@ -303,7 +303,7 @@ QScriptValue QScriptValuePrivate::property(quint32 index, int resolveMode) const { Q_ASSERT(isObject()); JSC::ExecState *exec = engine->currentFrame; - JSC::JSObject *object = jscValue.getObject(); + JSC::JSObject *object = JSC::asObject(jscValue); JSC::PropertySlot slot(const_cast(object)); JSC::JSValue result; if (const_cast(object)->getOwnPropertySlot(exec, index, slot)) { -- cgit v0.12 From f48432eb47eb37aa362e4da44888b718cdb3a841 Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Wed, 7 Oct 2009 18:29:18 +0200 Subject: Revert "Fix linker error with Symbian/ARM RVCT ABIv2 toolchain" This reverts commit 342fcb287b09d016d482e25482ddd1b36e2983a3. Didn't work on all compilers --- src/3rdparty/phonon/phonon/objectdescriptionmodel.h | 16 ++++++++++++---- src/s60installs/eabi/phononu.def | 20 ++++++++++---------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h index 9af2615..ba3cb42 100644 --- a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h +++ b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h @@ -175,18 +175,26 @@ namespace Phonon * \author Matthias Kretz */ template - class PHONON_EXPORT ObjectDescriptionModel : public QAbstractListModel + class ObjectDescriptionModel : public QAbstractListModel { public: Q_OBJECT_CHECK +/* MinGW 3.4.x gives an ICE when trying to instantiate one of the + ObjectDescriptionModel classes because it can't handle + half exported classes correct. gcc 4.3.x has a fix for this but + we currently there's no official gcc 4.3 on windows available. + Because of this we need this little hack + */ +#if !defined(Q_CC_MINGW) || __MINGW32_MAJOR_VERSION >= 4 /** \internal */ - static const QMetaObject staticMetaObject; + static PHONON_EXPORT const QMetaObject staticMetaObject; /** \internal */ - const QMetaObject *metaObject() const; + PHONON_EXPORT const QMetaObject *metaObject() const; /** \internal */ - void *qt_metacast(const char *_clname); + PHONON_EXPORT void *qt_metacast(const char *_clname); //int qt_metacall(QMetaObject::Call _c, int _id, void **_a); +#endif /** * Returns the number of rows in the model. This value corresponds diff --git a/src/s60installs/eabi/phononu.def b/src/s60installs/eabi/phononu.def index d70942c..d407ba4 100644 --- a/src/s60installs/eabi/phononu.def +++ b/src/s60installs/eabi/phononu.def @@ -495,11 +495,11 @@ EXPORTS _ZTIN6Phonon19AbstractVideoOutputE @ 494 NONAME _ZTIN6Phonon19BackendCapabilities8NotifierE @ 495 NONAME ABSENT _ZTIN6Phonon22MediaControllerPrivateE @ 496 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 497 NONAME - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 498 NONAME - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 499 NONAME - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 500 NONAME - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 501 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 497 NONAME ABSENT + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 498 NONAME ABSENT + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 499 NONAME ABSENT + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 500 NONAME ABSENT + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 501 NONAME ABSENT _ZTIN6Phonon24VolumeFaderEffectPrivateE @ 502 NONAME ABSENT _ZTIN6Phonon26AbstractAudioOutputPrivateE @ 503 NONAME ABSENT _ZTIN6Phonon26AbstractMediaStreamPrivateE @ 504 NONAME @@ -532,11 +532,11 @@ EXPORTS _ZTVN6Phonon19AbstractVideoOutputE @ 531 NONAME _ZTVN6Phonon19BackendCapabilities8NotifierE @ 532 NONAME ABSENT _ZTVN6Phonon22MediaControllerPrivateE @ 533 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 534 NONAME - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 535 NONAME - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 536 NONAME - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 537 NONAME - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 538 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 534 NONAME ABSENT + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 535 NONAME ABSENT + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 536 NONAME ABSENT + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 537 NONAME ABSENT + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 538 NONAME ABSENT _ZTVN6Phonon24VolumeFaderEffectPrivateE @ 539 NONAME ABSENT _ZTVN6Phonon26AbstractAudioOutputPrivateE @ 540 NONAME ABSENT _ZTVN6Phonon26AbstractMediaStreamPrivateE @ 541 NONAME -- cgit v0.12 From f85ad9872913887d0e12033517ddc989dec68005 Mon Sep 17 00:00:00 2001 From: Iain Date: Wed, 7 Oct 2009 23:28:24 +0200 Subject: Updates to EABI DEF files for Symbian OS Reviewed-by: TrustMe --- src/s60installs/eabi/QtGuiu.def | 38 ++++++++++++++++++++++++++++++++++++-- src/s60installs/eabi/QtScriptu.def | 1 + 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 581d3bc..09ea6ab 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -10640,7 +10640,7 @@ EXPORTS _ZTI17QTextFramePrivate @ 10639 NONAME ABSENT _ZTI17QTextImageHandler @ 10640 NONAME ABSENT _ZTI17QTextTablePrivate @ 10641 NONAME ABSENT - _ZTI17QToolBarExtension @ 10642 NONAME ABSENT + _ZTI17QToolBarExtension @ 10642 NONAME _ZTI17QToolBarSeparator @ 10643 NONAME ABSENT _ZTI17QUpdateLaterEvent @ 10644 NONAME ABSENT _ZTI17QWhatsThisPrivate @ 10645 NONAME ABSENT @@ -11051,7 +11051,7 @@ EXPORTS _ZTV17QTextFramePrivate @ 11050 NONAME ABSENT _ZTV17QTextImageHandler @ 11051 NONAME ABSENT _ZTV17QTextTablePrivate @ 11052 NONAME ABSENT - _ZTV17QToolBarExtension @ 11053 NONAME ABSENT + _ZTV17QToolBarExtension @ 11053 NONAME _ZTV17QToolBarSeparator @ 11054 NONAME ABSENT _ZTV17QUpdateLaterEvent @ 11055 NONAME ABSENT _ZTV17QWhatsThisPrivate @ 11056 NONAME ABSENT @@ -13102,4 +13102,38 @@ EXPORTS _ZTI28QGraphicsAnchorLayoutPrivate @ 13101 NONAME _ZTV20QGraphicsBloomEffect @ 13102 NONAME _ZTV28QGraphicsAnchorLayoutPrivate @ 13103 NONAME + _ZN17QToolBarExtension10paintEventEP11QPaintEvent @ 13104 NONAME + _ZN17QToolBarExtension11qt_metacallEN11QMetaObject4CallEiPPv @ 13105 NONAME + _ZN17QToolBarExtension11qt_metacastEPKc @ 13106 NONAME + _ZN17QToolBarExtension14setOrientationEN2Qt11OrientationE @ 13107 NONAME + _ZN17QToolBarExtension16staticMetaObjectE @ 13108 NONAME DATA 16 + _ZN17QToolBarExtension19getStaticMetaObjectEv @ 13109 NONAME + _ZN17QToolBarExtensionC1EP7QWidget @ 13110 NONAME + _ZN17QToolBarExtensionC2EP7QWidget @ 13111 NONAME + _ZN18QGuiPlatformPlugin11qt_metacallEN11QMetaObject4CallEiPPv @ 13112 NONAME + _ZN18QGuiPlatformPlugin11qt_metacastEPKc @ 13113 NONAME + _ZN18QGuiPlatformPlugin12platformHintENS_12PlatformHintE @ 13114 NONAME + _ZN18QGuiPlatformPlugin14fileSystemIconERK9QFileInfo @ 13115 NONAME + _ZN18QGuiPlatformPlugin16staticMetaObjectE @ 13116 NONAME DATA 16 + _ZN18QGuiPlatformPlugin19getStaticMetaObjectEv @ 13117 NONAME + _ZN18QGuiPlatformPlugin19systemIconThemeNameEv @ 13118 NONAME + _ZN18QGuiPlatformPlugin20iconThemeSearchPathsEv @ 13119 NONAME + _ZN18QGuiPlatformPlugin7paletteEv @ 13120 NONAME + _ZN18QGuiPlatformPlugin9styleNameEv @ 13121 NONAME + _ZN18QGuiPlatformPluginC1EP7QObject @ 13122 NONAME + _ZN18QGuiPlatformPluginC2EP7QObject @ 13123 NONAME + _ZN18QGuiPlatformPluginD0Ev @ 13124 NONAME + _ZN18QGuiPlatformPluginD1Ev @ 13125 NONAME + _ZN18QGuiPlatformPluginD2Ev @ 13126 NONAME + _ZN28QGraphicsAnchorLayoutPrivate14solveExpandingE5QListIP18QSimplexConstraintE @ 13127 NONAME + _ZN28QGraphicsAnchorLayoutPrivate21identifyNonFloatItemsE4QSetIP10AnchorDataENS_11OrientationE @ 13128 NONAME + _ZN28QGraphicsAnchorLayoutPrivate28identifyNonFloatItems_helperEPK10AnchorDataNS_11OrientationE @ 13129 NONAME + _ZNK17QToolBarExtension10metaObjectEv @ 13130 NONAME + _ZNK17QToolBarExtension8sizeHintEv @ 13131 NONAME + _ZNK18QGuiPlatformPlugin10metaObjectEv @ 13132 NONAME + _ZTI18QGuiPlatformPlugin @ 13133 NONAME + _ZTI27QGuiPlatformPluginInterface @ 13134 NONAME + _ZTV18QGuiPlatformPlugin @ 13135 NONAME + _ZThn8_N18QGuiPlatformPluginD0Ev @ 13136 NONAME + _ZThn8_N18QGuiPlatformPluginD1Ev @ 13137 NONAME diff --git a/src/s60installs/eabi/QtScriptu.def b/src/s60installs/eabi/QtScriptu.def index cca0a2a..1205c04 100644 --- a/src/s60installs/eabi/QtScriptu.def +++ b/src/s60installs/eabi/QtScriptu.def @@ -600,4 +600,5 @@ EXPORTS _ZN25QScriptEngineAgentPrivate18didReachBreakpointERKN5QTJSC17DebuggerCallFrameEiii @ 599 NONAME _ZN25QScriptEngineAgentPrivate6attachEv @ 600 NONAME _ZN25QScriptEngineAgentPrivate6detachEv @ 601 NONAME + _Z5qHashRK13QScriptString @ 602 NONAME -- cgit v0.12 From c3cfba7295c990d8135e1dd70b8cdbefd25615ab Mon Sep 17 00:00:00 2001 From: Rhys Weatherley Date: Thu, 8 Oct 2009 14:02:09 +1000 Subject: Stub out flush() in the PowerVR GL window surface class When QGLWidget was used as a viewport for QGraphicsView on PowerVR/MBX systems, it was double-flushing every frame because the window surface flush() implementation was still trying to do a raster blit after painting. This change suppresses the raster blit, leaving it up to the GL swapBuffers() call to get the painted contents onto the screen. Reviewed-by: Sarah Smith --- .../powervr/pvreglscreen/pvreglwindowsurface.cpp | 21 +++++++++++++-------- .../powervr/pvreglscreen/pvreglwindowsurface.h | 2 ++ 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp index afee77e..09c0ace 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.cpp @@ -149,6 +149,18 @@ void PvrEglWindowSurface::setPermanentState(const QByteArray &state) Q_UNUSED(state); } +void PvrEglWindowSurface::flush + (QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + // The GL paint engine is responsible for the swapBuffers() call. + // If we were to call the base class's implementation of flush() + // then it would fetch the image() and manually blit it to the + // screeen instead of using the fast PVR2D blit. + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); +} + QImage PvrEglWindowSurface::image() const { if (drawable) { @@ -165,14 +177,7 @@ QImage PvrEglWindowSurface::image() const QPaintDevice *PvrEglWindowSurface::paintDevice() { - QGLWidget *glWidget = qobject_cast(window()); - if (glWidget) - return glWidget; - - // Should be a QGLWidget, but if not return a dummy paint device. - if (!pdevice) - pdevice = new QImage(50, 50, screen->pixelFormat()); - return pdevice; + return widget; } void PvrEglWindowSurface::setDirectRegion(const QRegion &r, int id) diff --git a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h index 80fc8f8..0da3653 100644 --- a/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h +++ b/src/plugins/gfxdrivers/powervr/pvreglscreen/pvreglwindowsurface.h @@ -65,6 +65,8 @@ public: QByteArray permanentState() const; void setPermanentState(const QByteArray &state); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + QImage image() const; QPaintDevice *paintDevice(); -- cgit v0.12 From 4a99901283d44be4aaa5a5c221435099c8c8849c Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 8 Oct 2009 09:06:01 +0300 Subject: Fix "Warning: #381-D: extra ";" ignored" reported by RVCT Reviewed-by: TrustMe --- src/script/api/qscriptvalue_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/script/api/qscriptvalue_p.h b/src/script/api/qscriptvalue_p.h index 351d616..77b5084 100644 --- a/src/script/api/qscriptvalue_p.h +++ b/src/script/api/qscriptvalue_p.h @@ -66,7 +66,7 @@ class QScriptEnginePrivate; class QScriptValue; class QScriptValuePrivate { - Q_DISABLE_COPY(QScriptValuePrivate); + Q_DISABLE_COPY(QScriptValuePrivate) public: inline void* operator new(size_t, QScriptEnginePrivate*); inline void operator delete(void*); -- cgit v0.12 From 8826cc56e2989964d56ca9952e6ab639f1652cfd Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 8 Oct 2009 09:23:46 +0300 Subject: Fix qsound autotest build break in Symbian. Reviewed-by: TrustMe --- tests/auto/qsound/qsound.pro | 2 +- tests/auto/qsound/tst_qsound.cpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsound/qsound.pro b/tests/auto/qsound/qsound.pro index c48d50d..383a085 100644 --- a/tests/auto/qsound/qsound.pro +++ b/tests/auto/qsound/qsound.pro @@ -4,7 +4,7 @@ SOURCES += tst_qsound.cpp wince*|symbian*: { deploy.sources += 4.wav DEPLOYMENT = deploy - DEFINES += SRCDIR=\\\"\\\" + !symbian:DEFINES += SRCDIR=\\\"\\\" } else { DEFINES += SRCDIR=\\\"$$PWD/\\\" } diff --git a/tests/auto/qsound/tst_qsound.cpp b/tests/auto/qsound/tst_qsound.cpp index dd5f2ce..fdbf6a2 100644 --- a/tests/auto/qsound/tst_qsound.cpp +++ b/tests/auto/qsound/tst_qsound.cpp @@ -43,6 +43,10 @@ #include #include +#if defined(Q_OS_SYMBIAN) +#define SRCDIR "" +#endif + class tst_QSound : public QObject { Q_OBJECT -- cgit v0.12 From f831c60a7ae82511f9a42c1596fe7ad3fe09b97f Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 8 Oct 2009 09:29:19 +0300 Subject: Fix for "Braces mismatch \tests\auto\qsqlrecord\qsqlrecord.pro:16" Reviewed-by: Miikka Heikkinen --- tests/auto/qsqlrecord/qsqlrecord.pro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/qsqlrecord/qsqlrecord.pro b/tests/auto/qsqlrecord/qsqlrecord.pro index 7a72075..39a800e 100644 --- a/tests/auto/qsqlrecord/qsqlrecord.pro +++ b/tests/auto/qsqlrecord/qsqlrecord.pro @@ -9,11 +9,11 @@ symbian { DEPLOYMENT += sqlite } } + + TARGET.EPOCSTACKSIZE=50000 + TARGET.EPOCHEAPSIZE=50000 5000000 } -TARGET.EPOCSTACKSIZE=50000 -TARGET.EPOCHEAPSIZE=50000 5000000 -} QT += sql -- cgit v0.12 From 0c64fc77e95180171fc46d89d08bea3f2efc6bcc Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 8 Oct 2009 09:32:52 +0300 Subject: Fix for qfiledialog autotest build break in Symbian. The error was: "*** No rule to make target `\Qt\tests\auto\kernel\ qguiplatformplugin_p.h_, needed by ..." This happens since Symbian does not use same include semantics. Reviewed-by: Miikka Heikkinen --- src/gui/dialogs/qfiledialog_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/dialogs/qfiledialog_p.h b/src/gui/dialogs/qfiledialog_p.h index 44289d9..32cd397 100644 --- a/src/gui/dialogs/qfiledialog_p.h +++ b/src/gui/dialogs/qfiledialog_p.h @@ -76,7 +76,7 @@ #include #include "qsidebar_p.h" #include "qfscompleter_p.h" -#include "../kernel/qguiplatformplugin_p.h" +#include "private/qguiplatformplugin_p.h" #if defined (Q_OS_UNIX) -- cgit v0.12 From c15b370c9db16fdbfd9e7bec89ee9bf8c1110827 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 8 Oct 2009 09:15:20 +0200 Subject: Ensure that qmake doesn't lose the error code when processing subdirs When processing a project in a subdirs template failed for whatever reason then qmake would lose the result of that and would return an error code of 0 if the subdirs project file itself was processed fine. So now it ensures that any errors arising from processing a project referenced in a subdirs project file are not lost so that the error code returned from qmake will indicate an error actually occured. Task-number: QTBUG-4065 Reviewed-by: mariusSO --- qmake/generators/metamakefile.cpp | 14 ++++++++------ qmake/generators/metamakefile.h | 2 +- qmake/main.cpp | 5 ++++- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 69dd627..3acb2dd 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -291,7 +291,7 @@ SubdirsMetaMakefileGenerator::init() if(init_flag) return false; init_flag = true; - + bool hasError = false; if(Option::recursive) { QString old_output_dir = Option::output_dir; QString old_output = Option::output.fileName(); @@ -336,7 +336,7 @@ SubdirsMetaMakefileGenerator::init() } qmake_setpwd(sub->input_dir); Option::output_dir = sub->output_dir; - sub_proj->read(subdir.fileName()); + hasError |= !sub_proj->read(subdir.fileName()); if(!sub_proj->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { fprintf(stderr, "Project file(%s) not recursed because all requirements not met:\n\t%s\n", subdir.fileName().toLatin1().constData(), @@ -351,7 +351,7 @@ SubdirsMetaMakefileGenerator::init() } else { const QString output_name = Option::output.fileName(); Option::output.setFileName(sub->output_file); - sub->makefile->write(sub->output_dir); + hasError |= !sub->makefile->write(sub->output_dir); delete sub; qmakeClearCaches(); sub = 0; @@ -376,7 +376,7 @@ SubdirsMetaMakefileGenerator::init() self->makefile->init(); subs.append(self); - return true; + return !hasError; } bool @@ -745,7 +745,7 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO) } MetaMakefileGenerator * -MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op) +MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op, bool *success) { MetaMakefileGenerator *ret = 0; if ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || @@ -758,7 +758,9 @@ MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &na } if (!ret) ret = new BuildsMetaMakefileGenerator(proj, name, op); - ret->init(); + bool res = ret->init(); + if (success) + *success = res; return ret; } diff --git a/qmake/generators/metamakefile.h b/qmake/generators/metamakefile.h index e69304a..f74f4a2 100644 --- a/qmake/generators/metamakefile.h +++ b/qmake/generators/metamakefile.h @@ -62,7 +62,7 @@ public: virtual ~MetaMakefileGenerator(); - static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true); + static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true, bool *success = 0); static MakefileGenerator *createMakefileGenerator(QMakeProject *proj, bool noIO = false); inline QMakeProject *projectFile() const { return project; } diff --git a/qmake/main.cpp b/qmake/main.cpp index 73fdda9..8117a4c 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -168,7 +168,10 @@ int runQMake(int argc, char **argv) continue; } - MetaMakefileGenerator *mkfile = MetaMakefileGenerator::createMetaGenerator(&project, QString(), false); + bool success = true; + MetaMakefileGenerator *mkfile = MetaMakefileGenerator::createMetaGenerator(&project, QString(), false, &success); + if (!success) + exit_val = 3; if(mkfile && !mkfile->write(oldpwd)) { if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) fprintf(stderr, "Unable to generate project file.\n"); -- cgit v0.12 From 0f290238385f3e272e2b8afcb89a7b64764d72be Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 8 Oct 2009 09:29:41 +0200 Subject: Fix Qt Designer startup warnings about Qt::DropAction properties Add Q_ENUMS/Q_FLAGS accordingly. Reviewed-by: Olivier Goffart --- src/corelib/global/qnamespace.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h index 9d76dcc..4234a7e 100644 --- a/src/corelib/global/qnamespace.h +++ b/src/corelib/global/qnamespace.h @@ -71,8 +71,8 @@ Qt { Q_ENUMS(ArrowType ToolButtonStyle PenStyle PenCapStyle PenJoinStyle BrushStyle) Q_ENUMS(FillRule MaskMode BGMode ClipOperation SizeMode) Q_ENUMS(BackgroundMode) // Qt3 - Q_ENUMS(Axis Corner LayoutDirection SizeHint Orientation) - Q_FLAGS(Alignment Orientations) + Q_ENUMS(Axis Corner LayoutDirection SizeHint Orientation DropAction) + Q_FLAGS(Alignment Orientations DropActions) Q_FLAGS(DockWidgetAreas ToolBarAreas) Q_ENUMS(DockWidgetArea ToolBarArea) Q_ENUMS(TextFormat) -- cgit v0.12 From 902ee9839bf6d03f5e1ff3f45fb1251d50d752be Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 8 Oct 2009 10:02:03 +0200 Subject: Let the platform plugin decide on the click policy on itemview Reviewed-by: Jens Bache-Wiig --- src/gui/kernel/qguiplatformplugin_p.h | 2 +- src/gui/styles/qcommonstyle.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qguiplatformplugin_p.h b/src/gui/kernel/qguiplatformplugin_p.h index f7d4b92..2a70ee7 100644 --- a/src/gui/kernel/qguiplatformplugin_p.h +++ b/src/gui/kernel/qguiplatformplugin_p.h @@ -94,7 +94,7 @@ class Q_GUI_EXPORT QGuiPlatformPlugin : public QObject, public QGuiPlatformPlugi virtual QStringList iconThemeSearchPaths(); virtual QIcon fileSystemIcon(const QFileInfo &); - enum PlatformHint { PH_ToolButtonStyle, PH_ToolBarIconSize }; + enum PlatformHint { PH_ToolButtonStyle, PH_ToolBarIconSize, PH_ItemView_ActivateItemOnSingleClick }; virtual int platformHint(PlatformHint hint); diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 612258a..5886512 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -5058,7 +5058,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget break; case SH_ItemView_ActivateItemOnSingleClick: - ret = false; + ret = qt_guiPlatformPlugin()->platformHint(QGuiPlatformPlugin::PH_ItemView_ActivateItemOnSingleClick); break; case SH_TitleBar_ModifyNotification: -- cgit v0.12 From c851e1e6cd481e69585fab16c384ec5ab7cc7900 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 8 Oct 2009 10:05:43 +0200 Subject: Remove handling of arrow key on QDialog This code was kind of dead anyway because - On X11 and Windows, most of the widgets have the StrongFocus FocusPolicy - On Mac, e->modifiers always contains KeypadModifier for arrows, so the code is never reached on mac with real applications Morever, QAbstractButton already have a more complex handling of arrow keys. And the code breaks the QButtonGroup arrowKeyNavigation test on Mac (as when the test system simulates events, the KeyPadModifier is not set) Reviewed-by: mbm Reviewed-by: Paul --- src/gui/dialogs/qdialog.cpp | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/src/gui/dialogs/qdialog.cpp b/src/gui/dialogs/qdialog.cpp index 7df49fa..ed2d676 100644 --- a/src/gui/dialogs/qdialog.cpp +++ b/src/gui/dialogs/qdialog.cpp @@ -673,28 +673,6 @@ void QDialog::keyPressEvent(QKeyEvent *e) case Qt::Key_Escape: reject(); break; - case Qt::Key_Up: - case Qt::Key_Left: - if (focusWidget() && - (focusWidget()->focusPolicy() == Qt::StrongFocus || - focusWidget()->focusPolicy() == Qt::WheelFocus)) { - e->ignore(); - break; - } - // call ours, since c++ blocks us from calling the one - // belonging to focusWidget(). - focusNextPrevChild(false); - break; - case Qt::Key_Down: - case Qt::Key_Right: - if (focusWidget() && - (focusWidget()->focusPolicy() == Qt::StrongFocus || - focusWidget()->focusPolicy() == Qt::WheelFocus)) { - e->ignore(); - break; - } - focusNextPrevChild(true); - break; default: e->ignore(); return; -- cgit v0.12 From cdf2e8162939257c6c715659db58854457f2811f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Meril=C3=A4?= Date: Thu, 8 Oct 2009 12:19:35 +0300 Subject: DialogButtonBox is shown together with softkeys (QTBUG-4739) This fixes issue that both DialogButtonBox and softkeys are visible (e.g. in Ftp example) at the same time. Reason is that the previous implementation did the visiblitity setting when buttons were created. Unfortunately buttons can be created without parent and let layout manager to find parent them for you - so dialog as parent (=hide dialogbuttonbox as softkeys are in use) check failed. Now similar check is done before showing the widget - it is layoutted here, so it has parent as well. As a bonus, the event handling is already looking for dialog parent, so we can avoid doing another for-loop. Task-number: QTBUG-4739 --- src/gui/widgets/qdialogbuttonbox.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/src/gui/widgets/qdialogbuttonbox.cpp b/src/gui/widgets/qdialogbuttonbox.cpp index 6cc720d..280ca63 100644 --- a/src/gui/widgets/qdialogbuttonbox.cpp +++ b/src/gui/widgets/qdialogbuttonbox.cpp @@ -468,18 +468,6 @@ void QDialogButtonBoxPrivate::layoutButtons() if (center) buttonLayout->addStretch(); - -#ifdef QT_SOFTKEYS_ENABLED - QWidget *dialog = 0; - QWidget *p = q; - while (p && !p->isWindow()) { - p = p->parentWidget(); - if (dialog = qobject_cast(p)) - break; - } - if (dialog) - q->setFixedSize(0, 0); -#endif } QPushButton *QDialogButtonBoxPrivate::createButton(QDialogButtonBox::StandardButton sbutton, @@ -1196,10 +1184,12 @@ bool QDialogButtonBox::event(QEvent *event) if (!hasDefault && firstAcceptButton) firstAcceptButton->setDefault(true); #ifdef QT_SOFTKEYS_ENABLED - if (dialog) + if (dialog) { + setFixedSize(0,0); dialog->addActions(d->softKeyActions.values()); - else + } else { addActions(d->softKeyActions.values()); + } #endif }else if (event->type() == QEvent::LanguageChange) { d->retranslateStrings(); -- cgit v0.12 From 2f7d1318d2dc63322a468d8c301ae718eaba0d03 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 8 Oct 2009 08:06:02 +0300 Subject: Workaround for OpenC daylight saving cache issue when using localtime_r. OpenC incorrectly caches DST information between localtime_r calls, i.e. if previous call to localtime_r has been called for DST affected date, also the second call will be affected by DST even the date is such that DST should not be applied. The workaround is to call mktime with non-DST affected date before calling localtime_r. mktime call resets the OpenC internal DST cache to right value and localtime_r will return correct values. This commit can be reverted once Open C bug 9525 has been reverted. AutoTest: Fixes tst_QDateTime::totime_t Reviewed-by: Aleksandar Sasha Babic --- src/corelib/tools/qdatetime.cpp | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp index 1b559cf..1277623 100644 --- a/src/corelib/tools/qdatetime.cpp +++ b/src/corelib/tools/qdatetime.cpp @@ -54,7 +54,6 @@ #ifndef Q_WS_WIN #include #endif - #include #if defined(Q_OS_WINCE) #include "qfunctions_wince.h" @@ -69,6 +68,31 @@ # define QDTPDEBUGN if (false) qDebug #endif +#if defined(Q_OS_SYMBIAN) + // Workaround for OpenC bug. + + // OpenC incorrectly caches DST information between localtime_r + // calls, i.e. if previous call to localtime_r has been called for DST + // affected date, also the second call will be affected by DST even + // the date is such that DST should not be applied. + + // The workaround is to call mktime with non-DST affected date before + // calling localtime_r. mktime call resets the OpenC internal DST cache + // to right value and localtime_r will return correct values. +#define FIX_OPENC_DSTCACHE \ + tm localTM; \ + localTM.tm_sec = 0; \ + localTM.tm_min = 0; \ + localTM.tm_hour = 12; \ + localTM.tm_mday = 1; \ + localTM.tm_mon = 1; \ + localTM.tm_year = 2002 - 1900; \ + localTM.tm_isdst = -1; \ + time_t temp = mktime(&localTM); +#else +#define FIX_OPENC_DSTCACHE +#endif + #if defined(Q_WS_MAC) #include #endif @@ -1138,6 +1162,7 @@ QDate QDate::currentDate() // use the reentrant version of localtime() where available tzset(); tm res; + FIX_OPENC_DSTCACHE t = localtime_r(<ime, &res); #else t = localtime(<ime); @@ -1834,12 +1859,13 @@ QTime QTime::currentTime() // use the reentrant version of localtime() where available tzset(); tm res; + FIX_OPENC_DSTCACHE t = localtime_r(<ime, &res); #else t = localtime(<ime); #endif Q_CHECK_PTR(t); - + ct.mds = MSECS_PER_HOUR * t->tm_hour + MSECS_PER_MIN * t->tm_min + 1000 * t->tm_sec + tv.tv_usec / 1000; #else @@ -2887,6 +2913,7 @@ QDateTime QDateTime::currentDateTime() // use the reentrant version of localtime() where available tzset(); tm res; + FIX_OPENC_DSTCACHE t = localtime_r(<ime, &res); #else t = localtime(<ime); @@ -3704,6 +3731,7 @@ static QDateTimePrivate::Spec utcToLocal(QDate &date, QTime &time) // use the reentrant version of localtime() where available tzset(); tm res; + FIX_OPENC_DSTCACHE brokenDown = localtime_r(&secsSince1Jan1970UTC, &res); #elif defined(_MSC_VER) && _MSC_VER >= 1400 tm res; -- cgit v0.12 From 67ba51dd0d9d7292ee5f1d3a484330fde84a7248 Mon Sep 17 00:00:00 2001 From: Janne Anttila Date: Thu, 8 Oct 2009 12:40:36 +0300 Subject: Fixed trailing whitespaces for f831c60a. Reviewed-by: TrustMe --- tests/auto/qsqlrecord/qsqlrecord.pro | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/auto/qsqlrecord/qsqlrecord.pro b/tests/auto/qsqlrecord/qsqlrecord.pro index 39a800e..f36f076 100644 --- a/tests/auto/qsqlrecord/qsqlrecord.pro +++ b/tests/auto/qsqlrecord/qsqlrecord.pro @@ -9,9 +9,9 @@ symbian { DEPLOYMENT += sqlite } } - + TARGET.EPOCSTACKSIZE=50000 - TARGET.EPOCHEAPSIZE=50000 5000000 + TARGET.EPOCHEAPSIZE=50000 5000000 } QT += sql -- cgit v0.12 From 013503f8f1a29f12789a8f88bd095597170ff76b Mon Sep 17 00:00:00 2001 From: axis Date: Thu, 8 Oct 2009 10:34:14 +0200 Subject: Prevented input composition in password fields on X11 and Windows. This restores the behavior in 4.5. Task: QT-2257 RevBy: Simon Hausmann --- src/gui/inputmethod/qwininputcontext_win.cpp | 2 +- src/gui/inputmethod/qximinputcontext_x11.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/inputmethod/qwininputcontext_win.cpp b/src/gui/inputmethod/qwininputcontext_win.cpp index 4a160d7..e9ab870 100644 --- a/src/gui/inputmethod/qwininputcontext_win.cpp +++ b/src/gui/inputmethod/qwininputcontext_win.cpp @@ -701,7 +701,7 @@ void QWinInputContext::updateImeStatus(QWidget *w, bool hasFocus) if (!focusProxyWidget) focusProxyWidget = w; bool e = w->testAttribute(Qt::WA_InputMethodEnabled) && w->isEnabled() - && !(focusProxyWidget->inputMethodHints() & Qt::ImhExclusiveInputMask); + && !(focusProxyWidget->inputMethodHints() & (Qt::ImhExclusiveInputMask | Qt::ImhHiddenText)); bool hasIme = e && hasFocus; #ifdef Q_IME_DEBUG qDebug("%s HasFocus = %d hasIme = %d e = %d ", w->className(), hasFocus, hasIme, e); diff --git a/src/gui/inputmethod/qximinputcontext_x11.cpp b/src/gui/inputmethod/qximinputcontext_x11.cpp index bee3ce8..b46b162 100644 --- a/src/gui/inputmethod/qximinputcontext_x11.cpp +++ b/src/gui/inputmethod/qximinputcontext_x11.cpp @@ -612,7 +612,7 @@ void QXIMInputContext::setFocusWidget(QWidget *w) QInputContext::setFocusWidget(w); - if (!w || w->inputMethodHints() & Qt::ImhExclusiveInputMask) + if (!w || w->inputMethodHints() & (Qt::ImhExclusiveInputMask | Qt::ImhHiddenText)) return; ICData *data = ximData.value(w->effectiveWinId()); -- cgit v0.12 From 5987274b8ce244d0020359d113800e7305367c68 Mon Sep 17 00:00:00 2001 From: Jani Hautakangas Date: Thu, 8 Oct 2009 13:06:24 +0300 Subject: Fix to Symbian accelerated scrolling problem. The reason for scrolling bug was that CFbsBitmapDevice wasn't informed if CFbsBitmap was resized. However, it seems that scroll implementation in QRasterPixmapData is faster that CFbsBitGc->CopyRect so this is also a patch which changes QS60PixmapData's scroll function to call QRasterPixmapData::scroll(). Reviewed-by: Janne Koskinen --- src/gui/image/qpixmap_s60.cpp | 45 ++++++++++++++++++------------------------- src/gui/image/qpixmap_s60_p.h | 4 ++-- 2 files changed, 21 insertions(+), 28 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index 37b6438..554c0f3 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -229,24 +229,15 @@ static CFbsBitmap* uncompress(CFbsBitmap* bitmap) lock.relock(); - CBitmapContext *bitmapContext = 0; CFbsBitmapDevice* bitmapDevice = 0; + CFbsBitGc *bitmapGc = 0; QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(uncompressed)); - TInt err = bitmapDevice->CreateBitmapContext(bitmapContext); - if (err != KErrNone) { - delete bitmap; - delete bitmapDevice; - bitmap = 0; - bitmapDevice = 0; - - lock.relock(); + QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL()); + bitmapGc->Activate(bitmapDevice); - return bitmap; - } + bitmapGc->DrawBitmap(TPoint(), bitmap); - bitmapContext->DrawBitmap(TPoint(), bitmap); - - delete bitmapContext; + delete bitmapGc; delete bitmapDevice; return uncompressed; @@ -355,7 +346,7 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), symbianBitmapDataAccess(new QSymbianBitmapDataAccess), cfbsBitmap(0), bitmapDevice(0), - bitmapContext(0), + bitmapGc(0), pengine(0), bytes(0) { @@ -365,6 +356,7 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type), QS60PixmapData::~QS60PixmapData() { release(); + delete symbianBitmapDataAccess; } void QS60PixmapData::resize(int width, int height) @@ -391,6 +383,8 @@ void QS60PixmapData::resize(int width, int height) if(cfbsBitmap->SizeInPixels() != newSize) { cfbsBitmap->Resize(TSize(width, height)); + bitmapDevice->Resize(TSize(width, height)); + bitmapGc->Resized(); if(pengine) { delete pengine; pengine = 0; @@ -404,12 +398,9 @@ void QS60PixmapData::resize(int width, int height) bool QS60PixmapData::initSymbianBitmapContext() { QT_TRAP_THROWING(bitmapDevice = CFbsBitmapDevice::NewL(cfbsBitmap)); - TInt err = bitmapDevice->CreateBitmapContext(bitmapContext); - if (err != KErrNone) { - delete bitmapDevice; - bitmapDevice = 0; - return false; - } + QT_TRAP_THROWING(bitmapGc = CFbsBitGc::NewL()); + bitmapGc->Activate(bitmapDevice); + return true; } @@ -417,7 +408,7 @@ void QS60PixmapData::release() { if (cfbsBitmap) { QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock); - delete bitmapContext; + delete bitmapGc; delete bitmapDevice; delete cfbsBitmap; lock.relock(); @@ -426,7 +417,7 @@ void QS60PixmapData::release() delete pengine; image = QImage(); cfbsBitmap = 0; - bitmapContext = 0; + bitmapGc = 0; bitmapDevice = 0; pengine = 0; bytes = 0; @@ -559,13 +550,15 @@ void QS60PixmapData::copy(const QPixmapData *data, const QRect &rect) resize(rect.width(), rect.height()); cfbsBitmap->SetDisplayMode(s60Data->cfbsBitmap->DisplayMode()); - bitmapContext->BitBlt(TPoint(0, 0), s60Data->cfbsBitmap, qt_QRect2TRect(rect)); + bitmapGc->BitBlt(TPoint(0, 0), s60Data->cfbsBitmap, qt_QRect2TRect(rect)); } bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect) { - bitmapContext->CopyRect(TPoint(dx, dy), qt_QRect2TRect(rect)); - return true; + beginDataAccess(); + bool res = QRasterPixmapData::scroll(dx, dy, rect); + endDataAccess(); + return res; } int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h index 4498c05..b23961a 100644 --- a/src/gui/image/qpixmap_s60_p.h +++ b/src/gui/image/qpixmap_s60_p.h @@ -59,7 +59,7 @@ QT_BEGIN_NAMESPACE class CFbsBitmap; class CFbsBitmapDevice; -class CBitmapContext; +class CFbsBitGc; class QSymbianBitmapDataAccess; @@ -114,7 +114,7 @@ private: CFbsBitmap *cfbsBitmap; CFbsBitmapDevice *bitmapDevice; - CBitmapContext *bitmapContext; + CFbsBitGc *bitmapGc; QPaintEngine *pengine; uchar* bytes; -- cgit v0.12 From dac817b8d3bbcfcad34295f134dfafbf0a26c23f Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Oct 2009 12:26:29 +0200 Subject: Changing S60 to Symbian in the Docs Changing names to Symbian platform Task-number: QT-2268 Rev-by: Espen Riskedal --- doc/src/development/qmake-manual.qdoc | 87 ++++++++++++++++--------------- doc/src/getting-started/installation.qdoc | 48 +++++++++-------- doc/src/howtos/appicon.qdoc | 4 +- doc/src/platforms/qt-embedded.qdoc | 7 +-- doc/src/platforms/s60-introduction.qdoc | 27 +++++----- 5 files changed, 91 insertions(+), 82 deletions(-) diff --git a/doc/src/development/qmake-manual.qdoc b/doc/src/development/qmake-manual.qdoc index f2cae5b..87132cc 100644 --- a/doc/src/development/qmake-manual.qdoc +++ b/doc/src/development/qmake-manual.qdoc @@ -920,7 +920,7 @@ {deployment guide for Windows}. - \section1 S60 + \section1 Symbian platform Features specific to this platform include handling of static data, capabilities, stack and heap size, compiler specific options, and unique @@ -940,7 +940,7 @@ \section2 Stack and heap size - Symbian uses predefined sizes for stacks and heaps. If an + The Symbian platform uses predefined sizes for stacks and heaps. If an application exceeds either limit, it may crash or fail to complete its task. Crashes that seem to have no reason can often be traced back to insufficient stack and/or heap sizes. @@ -1095,7 +1095,7 @@ \target BLD_INF_RULES \section1 BLD_INF_RULES - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Generic \c bld.inf file content can be specified with \c BLD_INF_RULES variables. The section of \c bld.inf file where each rule goes is appended to @@ -1288,7 +1288,7 @@ The build process for bundles is also influenced by the contents of the \l{#QMAKE_BUNDLE_DATA}{QMAKE_BUNDLE_DATA} variable. - These options only have an effect on Symbian: + These options only have an effect on the Symbian platform: \table 95% \header \o Option \o Description @@ -1345,7 +1345,7 @@ \target DEPLOYMENT \section1 DEPLOYMENT - \e {This is only used on Windows CE and Symbian.} + \e {This is only used on Windows CE and the Symbian platform.} Specifies which additional files will be deployed. Deployment means the transfer of files from the development system to the target device or @@ -1363,8 +1363,8 @@ The default deployment target path for Windows CE is \c{%CSIDL_PROGRAM_FILES%\target}, which usually gets expanded to - \c{\Program Files\target}. For Symbian, the default target is the application - private directory on the drive it is installed to. + \c{\Program Files\target}. For the Symbian platform, the default target +is the application private directory on the drive it is installed to. It is also possible to specify multiple \c sources to be deployed on target \c paths. In addition, different variables can be used for @@ -1375,10 +1375,10 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 29 \note In Windows CE all linked Qt libraries will be deployed to the path - specified by \c{myFiles.path}. In Symbian all libraries and executables + specified by \c{myFiles.path}. On Symbian platform all libraries and executables will always be deployed to the \\sys\\bin of the installation drive. - Since the Symbian build system automatically moves binaries to certain + Since the Symbian platform build system automatically moves binaries to certain directories under the epoc32 directory, custom plugins, executables or dynamically loadable libraries need special handling. When deploying extra executables or dynamically loadable libraries, the target path @@ -1393,13 +1393,13 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 128 - In Symbian, generic PKG file content can also be specified with this + On the Symbian platform, generic PKG file content can also be specified with this variable. You can use either \c pkg_prerules or \c pkg_postrules to pass raw data to PKG file. The strings in \c pkg_prerules are added before package-body and \c pkg_postrules after. The strings defined in \c pkg_postrules or \c pkg_prerules are not parsed by qmake, so they should be in a format understood by Symbian package generation tools. - Please consult Symbian documentation for correct syntax. + Please consult the Symbian platform documentation for correct syntax. For example, to deploy DLL and add a new dependency: @@ -1424,7 +1424,7 @@ override languages statement, you must override also package-header statement and all other statements which are language specific. - In Symbian, the \c default_deployment item specifies + On the Symbian platform, the \c default_deployment item specifies default platform dependencies. It can be overwritten if a more restrictive set is needed - e.g. if a specific device is required to run the application. @@ -1436,7 +1436,7 @@ \target DEPLOYMENT_PLUGIN \section1 DEPLOYMENT_PLUGIN - \e {This is only used on Windows CE and Symbian.} + \e {This is only used on Windows CE and the Symbian platform.} This variable specifies the Qt plugins that will be deployed. All plugins available in Qt can be explicitly deployed to the device. See @@ -1446,9 +1446,9 @@ If the application depends on plugins, these plugins have to be specified manually. - \note In Symbian, all plugins supported by this variable will be deployed - by default with Qt libraries, so generally using this variable is not - needed. + \note On the Symbian platform, all plugins supported by this variable +will be deployed by default with Qt libraries, so generally using this +variable is not needed. For example: @@ -1556,7 +1556,7 @@ \target ICON \section1 ICON - This variable is used only in MAC and S60 to set the application icon. + This variable is used only in MAC and the Symbian platform to set the application icon. Please see \l{Setting the Application Icon}{the application icon documentation} for more information. @@ -1623,10 +1623,10 @@ This variable contains a list of libraries to be linked into the project. You can use the Unix \c -l (library) and -L (library path) flags and qmake - will do the correct thing with these libraries on Windows and Symbian - (namely this means passing the full path of the library to the linker). The - only limitation to this is the library must exist, for qmake to find which - directory a \c -l lib lives in. + will do the correct thing with these libraries on Windows and the + Symbian platform (namely this means passing the full path of the library to + the linker). The only limitation to this is the library must exist, for + qmake to find which directory a \c -l lib lives in. For example: @@ -1647,7 +1647,8 @@ explicitly specify the library to be used by including the \c{.lib} file name suffix. - \bold{Note:} On S60, the build system makes a distinction between shared and + \bold{Note:} On the Symbian platform, the build system makes a +distinction between shared and static libraries. In most cases, qmake will figure out which library you are refering to, but in some cases you may have to specify it explicitly to get the expected behavior. This typically happens if you are building a @@ -1693,7 +1694,7 @@ \target MMP_RULES \section1 MMP_RULES - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Generic MMP file content can be specified with this variable. @@ -2013,8 +2014,9 @@ the \c QMAKE_CXXFLAGS_DEBUG and \c QMAKE_CXXFLAGS_RELEASE variables, respectively. - \bold{Note:} On S60, this variable can be used to pass architecture specific - options to each compiler in the Symbian build system. For example: + \bold{Note:} On the Symbian platform, this variable can be used to pass +architecture specific options to each compiler in the Symbian build system. +For example: \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 131 @@ -2812,7 +2814,7 @@ \target RSS_RULES \section1 RSS_RULES - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Generic RSS file content can be specified with this variable. The syntax is similar to \c MMP_RULES and \c BLD_INF_RULES. @@ -2832,10 +2834,12 @@ \snippet doc/src/snippets/code/doc_src_qmake-manual.qdoc 145 - This example will install the application to MyFolder in S60 application - shell. In addition it will make the application to be launched in background. + This example will install the application to MyFolder in the Symbian + platform application shell. In addition it will make the application to + be launched in background. - For detailed list of possible RSS statements, please refer to Symbian OS help. + For detailed list of possible RSS statements, please refer to the + Symbian platform help. \note You should not use \c RSS_RULES variable to set the following RSS statements: @@ -2848,7 +2852,7 @@ \target S60_VERSION \section1 S60_VERSION - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Contains the version number of the underlying S60 SDK; e.g. "5.0". @@ -2918,7 +2922,7 @@ \target TARGET.CAPABILITY \section1 TARGET.CAPABILITY - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies which platform capabilities the application should have. For more information, please refer to the S60 SDK documentation. @@ -2926,7 +2930,7 @@ \target TARGET.EPOCALLOWDLLDATA \section1 TARGET.EPOCALLOWDLLDATA - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies whether static data should be allowed in the application. Symbian disallows this by default in order to save memory. To use it, set this to 1. @@ -2934,7 +2938,7 @@ \target TARGET.EPOCHEAPSIZE \section1 TARGET.EPOCHEAPSIZE - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies the minimum and maximum heap size of the application. The program will refuse to run if the minimum size is not available when it starts. For @@ -2945,7 +2949,7 @@ \target TARGET.EPOCSTACKSIZE \section1 TARGET.EPOCSTACKSIZE - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies the maximum stack size of the application. For example: @@ -2954,7 +2958,7 @@ \target TARGET.SID \section1 TARGET.SID - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies which secure identifier to use for the target application or library. For more information, see the S60 SDK documentation. @@ -2962,7 +2966,7 @@ \target TARGET.UID2 \section1 TARGET.UID2 - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies which unique identifier 2 to use for the target application or library. If this variable is not specified, it defaults to the same value @@ -2971,7 +2975,7 @@ \target TARGET.UID3 \section1 TARGET.UID3 - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies which unique identifier 3 to use for the target application or library. If this variable is not specified, a UID3 suitable for development @@ -2982,7 +2986,7 @@ \target TARGET.VID \section1 TARGET.VID - \e {This is only used on Symbian.} + \e {This is only used on the Symbian platform.} Specifies which vendor identifier to use for the target application or library. For more information, see the S60 SDK documentation. @@ -3862,9 +3866,10 @@ \o Indicates that the output should not be added to the list of objects to be linked in. \endtable - \note Symbian specific: Generating objects to be linked in is not supported in Symbian, - so either the \c CONFIG option \c no_link or variable \c variable_out - should always be defined for extra compilers. + \note Symbian platform specific: Generating objects to be linked in is + not supported on the Symbian platform, so either the \c CONFIG option + \c no_link or variable \c variable_out should always be defined for + extra compilers. */ diff --git a/doc/src/getting-started/installation.qdoc b/doc/src/getting-started/installation.qdoc index 2ace8de..366a906 100644 --- a/doc/src/getting-started/installation.qdoc +++ b/doc/src/getting-started/installation.qdoc @@ -497,14 +497,14 @@ in the \l{Qt for Windows CE Requirements} document. We hope you will enjoy using Qt. Good luck! */ -/*! \page install-S60-installer.html +/*! \page install-Symbian-installer.html -\title Installing Qt on S60 using binary package +\title Installing Qt on the Symbian platform using binary package \ingroup qts60 -\brief How to install Qt on S60 using the binary package. +\brief How to install Qt on the Symbian platform using the binary package. -\note Qt for S60 has some requirements that are given in more detail -in the \l{Qt for S60 Requirements} document. +\note Qt for Symbian platform has some requirements that are given in more detail +in the \l{Qt for Symbian platform Requirements} document. \list 1 @@ -527,7 +527,7 @@ in the \l{Qt for S60 Requirements} document. and follow the instructions. To run the demos and examples on the emulator, you need to build them first. - Open the "Qt for S60 Command Prompt" from the Start menu and type: + Open the "Qt for Symbian platform Command Prompt" from the Start menu and type: \snippet doc/src/snippets/code/doc_src_installation.qdoc 25 @@ -536,27 +536,29 @@ in the \l{Qt for S60 Requirements} document. \snippet doc/src/snippets/code/doc_src_installation.qdoc 27 - For more information about building and running Qt programs on S60, - see \l{S60 - Introduction to using Qt}. + For more information about building and running Qt programs on the +Symbian platform, + see \l{Symbian platform - Introduction to using Qt}. We hope you will enjoy using Qt. \endlist */ -/*! \page install-S60.html +/*! \page install-Symbian.html -\title Installing Qt on S60 +\title Installing Qt on the Symbian platform \ingroup installation \ingroup qts60 -\brief How to install Qt on S60 +\brief How to install Qt for the Symbian platform -\note Qt for S60 has some requirements that are given in more detail -in the \l{Qt for S60 Requirements} document. +\note Qt for the Symbian platform has some requirements that are given in more detail +in the \l{Qt for Symbian platform Requirements} document. -\note \bold {This document describes how to install and configure Qt for S60 from scratch. +\note \bold {This document describes how to install and configure Qt for +the Symbian platform from scratch. If you are using pre-built binaries, follow the instructions -\l{Installing Qt on S60 using binary package}{here}.} +\l{Installing Qt on the Symbian platform using binary package}{here}.} \list 1 @@ -586,7 +588,7 @@ If you are using pre-built binaries, follow the instructions \o Configure Qt - To configure Qt for S60, do: + To configure Qt for the Symbian platform, do: \snippet doc/src/snippets/code/doc_src_installation.qdoc 23 to build the tools using MinGW, and the libraries using abld. @@ -633,8 +635,8 @@ If you are using pre-built binaries, follow the instructions \snippet doc/src/snippets/code/doc_src_installation.qdoc 27 - For more information about building and running Qt programs on S60, - see \l{S60 - Introduction to using Qt}. + For more information about building and running Qt programs on the +Symbian platform, see \l{Symbian platform - Introduction to using Qt}. We hope you will enjoy using Qt. @@ -669,7 +671,7 @@ If you are using pre-built binaries, follow the instructions \list \o \l{Qt for Embedded Linux Requirements} \o \l{Qt for Mac OS X Requirements} - \o \l{Qt for S60 Requirements} + \o \l{Qt for Symbian platform Requirements} \o \l{Qt for Windows CE Requirements} \o \l{Qt for Windows Requirements} \o \l{Qt for X11 Requirements} @@ -953,13 +955,13 @@ If you are using pre-built binaries, follow the instructions */ /*! - \page requirements-s60.html - \title Qt for S60 Requirements + \page requirements-symbian.html + \title Qt for Symbian platform Requirements \ingroup installation - \brief Setting up the S60 environment for Qt. + \brief Setting up the Symbian platform environment for Qt. \previouspage General Qt Requirements - Qt for S60 requires the following software installed on your development PC: + Qt for Symbian platform requires the following software installed on your development PC: \list \o \l{http://www.mingw.org/}{MinGW 3.4.5 or higher}, or another windows compiler to build the tools. \o \l{http://www.forum.nokia.com/main/resources/tools_and_sdks/carbide_cpp/}{Carbide.c++ v2.0.0 or higher} diff --git a/doc/src/howtos/appicon.qdoc b/doc/src/howtos/appicon.qdoc index ece2dcf..4108c11 100644 --- a/doc/src/howtos/appicon.qdoc +++ b/doc/src/howtos/appicon.qdoc @@ -213,9 +213,9 @@ The GNOME developer website is at \l{http://developer.gnome.org/}. - \section1 Setting the Application Icon on S60 platforms + \section1 Setting the Application Icon on the Symbian platform - In order to set the application icon for S60 applications, you need + In order to set the application icon for Symbian platform applications, you need an SVG-T icon. For information on how to create SVG-T compliant icons, please refer to \l{http://wiki.forum.nokia.com/index.php/How_to_create_application_icon(SVG)_in_S60_3rd_edition/} diff --git a/doc/src/platforms/qt-embedded.qdoc b/doc/src/platforms/qt-embedded.qdoc index 0b2c2ac..c39a967 100644 --- a/doc/src/platforms/qt-embedded.qdoc +++ b/doc/src/platforms/qt-embedded.qdoc @@ -54,7 +54,7 @@ Currently, three embedded platforms are supported by Qt: \table 90% - \header \o Embedded Linux \o Windows CE \o S60 + \header \o Embedded Linux \o Windows CE \o Symbian platform \row \o \l{Qt for Embedded Linux} is designed to be used on Linux devices without X11 or existing graphical environments. This flavor of @@ -67,8 +67,9 @@ Applications use the appropriate style for the embedded environment and use native features, such as menus, to conform to the native style guidelines. - \o \l{S60 - Introduction to using Qt}{Qt for S60} is used to create - applications running in existing S60 environments. + \o \l{Symbian platform - Introduction to using Qt}{Qt for the Symbian +platform} is used to create + applications running in existing Symbian platform environments. Applications use the appropriate style for the embedded environment and use native features, such as menus, to conform to the native style guidelines. diff --git a/doc/src/platforms/s60-introduction.qdoc b/doc/src/platforms/s60-introduction.qdoc index 086ee52..d145a82 100644 --- a/doc/src/platforms/s60-introduction.qdoc +++ b/doc/src/platforms/s60-introduction.qdoc @@ -40,10 +40,10 @@ ****************************************************************************/ /*! - \page s60-with-qt-introduction.html + \page symbian-with-qt-introduction.html - \title S60 - Introduction to using Qt - \brief An introduction to Qt for S60 developers. + \title Symbian platform - Introduction to using Qt + \brief An introduction to Qt for Symbian platform developers. \ingroup howto \ingroup qts60 @@ -51,21 +51,22 @@ \section1 Required tools - See \l{Qt for S60 Requirements} to see what tools are required to use Qt for S60. + See \l{Qt for Symbian platform Requirements} to see what tools are +required to use Qt for Symbian platform. \section1 Installing Qt and running demos - Follow the instructions found in \l{Installing Qt on S60 using binary package} to learn how + Follow the instructions found in \l{Installing Qt on the Symbian platform using binary package} to learn how to install Qt using binary package and how to build and run Qt demos. - Follow the instructions found in \l{Installing Qt on S60} to learn how to install Qt using + Follow the instructions found in \l{Installing Qt on the Symbian platform} to learn how to install Qt using using source package and how to build and run the Qt demos. \section1 Building your own applications If you are new to Qt development, have a look at \l{How to Learn Qt}. In general, the difference between developing a - Qt application on S60 compared to any of the other platforms supported + Qt application on the Symbian platform compared to any of the other platforms supported by Qt is not that big. Once you have crated a \c .pro file for your project, generate the @@ -76,10 +77,10 @@ For more information on how to use qmake have a look at the \l {qmake Tutorial}. - Now you can build the Qt on S60 application with standard build - tools. By default, running \c make will produce binaries for the - emulator. However, S60 comes with several alternative build targets, - as shown in the table below: + Now you can build the Qt for the Symbian platform application with +standard build tools. By default, running \c make will produce binaries for +the emulator. However, the Symbian platform comes with several alternative +build targets, as shown in the table below: \table \row \o \c debug-winscw \o Build debug binaries for the emulator (default). @@ -121,8 +122,8 @@ \row \o \c QT_SIS_OPTIONS \o Options accepted by \c .sis creation. -i, install the package right away using PC suite. -c=, read certificate information from a file. - Execute \c{createpackage.pl} script without any - parameters for more information about options. + Execute \c{perl createpackage.pl} for more information + about options. By default no otions are given. \row \o \c QT_SIS_TARGET \o Target for which \c .sis file is created. Accepted values are build targets listed in -- cgit v0.12 From 7d75f1427f80df87b728baa8c7f63f7a7762d280 Mon Sep 17 00:00:00 2001 From: Morten Engvoldsen Date: Thu, 8 Oct 2009 12:27:37 +0200 Subject: Changing S60 to Symbian in the Docs Changing names to Symbian platform Task-number: QT-2268 Rev-by: Espen Riskedal --- doc/src/images/qt-embedded-architecture.png | Bin 22388 -> 8511 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/doc/src/images/qt-embedded-architecture.png b/doc/src/images/qt-embedded-architecture.png index d3f8edc..20b3e7f 100644 Binary files a/doc/src/images/qt-embedded-architecture.png and b/doc/src/images/qt-embedded-architecture.png differ -- cgit v0.12 From 1040ba2fd850196234424f769e28d513a6eb0948 Mon Sep 17 00:00:00 2001 From: Prasanth Ullattil Date: Thu, 8 Oct 2009 12:11:32 +0200 Subject: Fix compile errors on mingw (The version supplied with Qt 4.5) Added the missing defines Reviewed-by: Denis --- src/gui/dialogs/qprintdialog_win.cpp | 7 +++++++ src/gui/inputmethod/qwininputcontext_p.h | 13 +++++++++++++ src/gui/kernel/qapplication_win.cpp | 5 ++++- src/gui/util/qdesktopservices_win.cpp | 5 +++++ 4 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/gui/dialogs/qprintdialog_win.cpp b/src/gui/dialogs/qprintdialog_win.cpp index f66c27f..843c4e2 100644 --- a/src/gui/dialogs/qprintdialog_win.cpp +++ b/src/gui/dialogs/qprintdialog_win.cpp @@ -52,6 +52,13 @@ #include #include +#if defined(Q_CC_MINGW) && !defined(PD_NOCURRENTPAGE) +#define PD_NOCURRENTPAGE 0x00800000 +#define PD_RESULT_PRINT 1 +#define PD_RESULT_APPLY 2 +#define START_PAGE_GENERAL 0XFFFFFFFF +#endif + QT_BEGIN_NAMESPACE extern void qt_win_eatMouseMove(); diff --git a/src/gui/inputmethod/qwininputcontext_p.h b/src/gui/inputmethod/qwininputcontext_p.h index 39d50fd..dd0490d 100644 --- a/src/gui/inputmethod/qwininputcontext_p.h +++ b/src/gui/inputmethod/qwininputcontext_p.h @@ -56,6 +56,19 @@ #include "QtGui/qinputcontext.h" #include "QtCore/qt_windows.h" +#if defined(Q_CC_MINGW) && !defined(IMR_RECONVERTSTRING) +typedef struct tagRECONVERTSTRING { + DWORD dwSize; + DWORD dwVersion; + DWORD dwStrLen; + DWORD dwStrOffset; + DWORD dwCompStrLen; + DWORD dwCompStrOffset; + DWORD dwTargetStrLen; + DWORD dwTargetStrOffset; +} RECONVERTSTRING, *PRECONVERTSTRING; +#endif + QT_BEGIN_NAMESPACE class QWinInputContext : public QInputContext diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp index 44f82b6..270562f 100644 --- a/src/gui/kernel/qapplication_win.cpp +++ b/src/gui/kernel/qapplication_win.cpp @@ -171,10 +171,13 @@ typedef struct tagTOUCHINPUT #include #endif +#ifndef IMR_RECONVERTSTRING +#define IMR_RECONVERTSTRING 4 +#endif + #ifndef IMR_CONFIRMRECONVERTSTRING #define IMR_CONFIRMRECONVERTSTRING 0x0005 #endif - QT_BEGIN_NAMESPACE #ifdef Q_WS_WINCE diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp index 4ecef97..c0bd5e7 100644 --- a/src/gui/util/qdesktopservices_win.cpp +++ b/src/gui/util/qdesktopservices_win.cpp @@ -59,6 +59,11 @@ # endif #endif +#if defined(Q_CC_MINGW) && !defined(CSIDL_MYMUSIC) +#define CSIDL_MYMUSIC 13 +#define CSIDL_MYVIDEO 14 +#endif + #ifndef QT_NO_DESKTOPSERVICES QT_BEGIN_NAMESPACE -- cgit v0.12 From 9e59f3e021e78a5b825b7673248e0bf37ac935f1 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Thu, 8 Oct 2009 12:55:21 +0200 Subject: Revert "Ensure that qmake doesn't lose the error code when processing subdirs" This reverts commit c15b370c9db16fdbfd9e7bec89ee9bf8c1110827 since it is causing a problem with the autotests so that will be investigated further before this is resubmitted. --- qmake/generators/metamakefile.cpp | 14 ++++++-------- qmake/generators/metamakefile.h | 2 +- qmake/main.cpp | 5 +---- 3 files changed, 8 insertions(+), 13 deletions(-) diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index 3acb2dd..69dd627 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -291,7 +291,7 @@ SubdirsMetaMakefileGenerator::init() if(init_flag) return false; init_flag = true; - bool hasError = false; + if(Option::recursive) { QString old_output_dir = Option::output_dir; QString old_output = Option::output.fileName(); @@ -336,7 +336,7 @@ SubdirsMetaMakefileGenerator::init() } qmake_setpwd(sub->input_dir); Option::output_dir = sub->output_dir; - hasError |= !sub_proj->read(subdir.fileName()); + sub_proj->read(subdir.fileName()); if(!sub_proj->variables()["QMAKE_FAILED_REQUIREMENTS"].isEmpty()) { fprintf(stderr, "Project file(%s) not recursed because all requirements not met:\n\t%s\n", subdir.fileName().toLatin1().constData(), @@ -351,7 +351,7 @@ SubdirsMetaMakefileGenerator::init() } else { const QString output_name = Option::output.fileName(); Option::output.setFileName(sub->output_file); - hasError |= !sub->makefile->write(sub->output_dir); + sub->makefile->write(sub->output_dir); delete sub; qmakeClearCaches(); sub = 0; @@ -376,7 +376,7 @@ SubdirsMetaMakefileGenerator::init() self->makefile->init(); subs.append(self); - return !hasError; + return true; } bool @@ -745,7 +745,7 @@ MetaMakefileGenerator::createMakefileGenerator(QMakeProject *proj, bool noIO) } MetaMakefileGenerator * -MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op, bool *success) +MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &name, bool op) { MetaMakefileGenerator *ret = 0; if ((Option::qmake_mode == Option::QMAKE_GENERATE_MAKEFILE || @@ -758,9 +758,7 @@ MetaMakefileGenerator::createMetaGenerator(QMakeProject *proj, const QString &na } if (!ret) ret = new BuildsMetaMakefileGenerator(proj, name, op); - bool res = ret->init(); - if (success) - *success = res; + ret->init(); return ret; } diff --git a/qmake/generators/metamakefile.h b/qmake/generators/metamakefile.h index f74f4a2..e69304a 100644 --- a/qmake/generators/metamakefile.h +++ b/qmake/generators/metamakefile.h @@ -62,7 +62,7 @@ public: virtual ~MetaMakefileGenerator(); - static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true, bool *success = 0); + static MetaMakefileGenerator *createMetaGenerator(QMakeProject *proj, const QString &name, bool op=true); static MakefileGenerator *createMakefileGenerator(QMakeProject *proj, bool noIO = false); inline QMakeProject *projectFile() const { return project; } diff --git a/qmake/main.cpp b/qmake/main.cpp index 8117a4c..73fdda9 100644 --- a/qmake/main.cpp +++ b/qmake/main.cpp @@ -168,10 +168,7 @@ int runQMake(int argc, char **argv) continue; } - bool success = true; - MetaMakefileGenerator *mkfile = MetaMakefileGenerator::createMetaGenerator(&project, QString(), false, &success); - if (!success) - exit_val = 3; + MetaMakefileGenerator *mkfile = MetaMakefileGenerator::createMetaGenerator(&project, QString(), false); if(mkfile && !mkfile->write(oldpwd)) { if(Option::qmake_mode == Option::QMAKE_GENERATE_PROJECT) fprintf(stderr, "Unable to generate project file.\n"); -- cgit v0.12 From 8050a8ea1b30b0d35fc20e9d09ff48c242a924cd Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 7 Oct 2009 14:41:33 +0200 Subject: Mac: fix auto test to reflect recent changes in wheel event handling ...on mac. Since mouse wheel events are accelerated by the OS on mac, we cannot multiply the delta with QApplication::wheelScrollLines, since this will make scrolling behave far to fast. To change the speed of wheel events on Mac, one should use system preferences. This patch updates the test to reflect his difference. Rev-By: ogoffart --- tests/auto/qabstractslider/tst_qabstractslider.cpp | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/tests/auto/qabstractslider/tst_qabstractslider.cpp b/tests/auto/qabstractslider/tst_qabstractslider.cpp index 9f7a78e..5c70bde 100644 --- a/tests/auto/qabstractslider/tst_qabstractslider.cpp +++ b/tests/auto/qabstractslider/tst_qabstractslider.cpp @@ -714,7 +714,11 @@ void tst_QAbstractSlider::wheelEvent_data() << 1 // delta << int(Qt::Vertical) // orientation of slider << int(Qt::Vertical) // orientation of wheel +#ifdef Q_WS_MAC + << 1 // expected position after +#else << 20 // expected position after +#endif << QPoint(0,0); QTest::newRow("Normal data page") << 0 // initial position @@ -773,7 +777,11 @@ void tst_QAbstractSlider::wheelEvent_data() << 1 // delta << int(Qt::Horizontal) // orientation of slider << int(Qt::Horizontal) // orientation of wheel +#ifdef Q_WS_MAC + << 49 // expected position after +#else << 30 // expected position after +#endif << QPoint(1,1); QTest::newRow("Past end") << 50 // initial position @@ -784,7 +792,11 @@ void tst_QAbstractSlider::wheelEvent_data() << false // inverted controls << 1 // wheel scroll lines << false // with modifiers +#ifdef Q_WS_MAC + << 60 // delta +#else << 2 // delta +#endif << int(Qt::Horizontal) // orientation of slider << int(Qt::Horizontal) // orientation of wheel << 100 // expected position after @@ -798,7 +810,11 @@ void tst_QAbstractSlider::wheelEvent_data() << false // inverted controls << 1 // wheel scroll lines << false // with modifiers - << -2 // delta +#ifdef Q_WS_MAC + << -60 // delta +#else + << -2 // delta +#endif << int(Qt::Horizontal) // orientation of slider << int(Qt::Horizontal) // orientation of wheel << 0 // expected position after -- cgit v0.12 From 52aaffaf17c4d1bf11a469fe3cc692c3bea6cfe2 Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Wed, 7 Oct 2009 14:46:43 +0200 Subject: Carbon: better wheel acceleration patch It turns out that scrolling appears to be slow when using non-mac mice with the carbon build. This patch introduces a an acceleration algorithm that closer resembles the one used by Cocoa. Rev-By: prasanth --- src/gui/kernel/qapplication_mac.mm | 26 ++++++++++++++++++++++---- src/gui/widgets/qabstractslider.cpp | 3 +-- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm index a95ae9d..f9c8aa3 100644 --- a/src/gui/kernel/qapplication_mac.mm +++ b/src/gui/kernel/qapplication_mac.mm @@ -1708,12 +1708,30 @@ QApplicationPrivate::globalEventProcessor(EventHandlerCallRef er, EventRef event sizeof(axis), 0, &axis); // The 'new' event has acceleration applied by the OS, while the old (on - // Carbon only), has not. So we introduce acceleration here to be consistent: - int scrollFactor = 120 * qMin(5, qAbs(mdelt)); + // Carbon only), has not. So we introduce acceleration here to be consistent. + // The acceleration is trying to respect both pixel based and line scrolling, + // which turns out to be rather difficult. + int linesToScroll = mdelt > 0 ? 1 : -1; + static QTime t; + int elapsed = t.elapsed(); + t.restart(); + if (elapsed < 20) + linesToScroll *= 120; + else if (elapsed < 30) + linesToScroll *= 60; + else if (elapsed < 50) + linesToScroll *= 30; + else if (elapsed < 100) + linesToScroll *= 6; + else if (elapsed < 200) + linesToScroll *= 3; + else if (elapsed < 300) + linesToScroll *= 2; + if (axis == kEventMouseWheelAxisX) - wheel_deltaX = mdelt * scrollFactor; + wheel_deltaX = linesToScroll * 120; else - wheel_deltaY = mdelt * scrollFactor; + wheel_deltaY = linesToScroll * 120; } } diff --git a/src/gui/widgets/qabstractslider.cpp b/src/gui/widgets/qabstractslider.cpp index 19a8b63..588a48e 100644 --- a/src/gui/widgets/qabstractslider.cpp +++ b/src/gui/widgets/qabstractslider.cpp @@ -715,8 +715,7 @@ void QAbstractSlider::wheelEvent(QWheelEvent * e) #else stepsToScroll = int(d->offset_accumulated) * QApplication::wheelScrollLines() * d->singleStep; #endif - if (qAbs(stepsToScroll) > d->pageStep) - stepsToScroll = currentOffset > 0 ? d->pageStep : -d->pageStep; + stepsToScroll = qBound(-d->pageStep, stepsToScroll, d->pageStep); } if (d->invertedControls) -- cgit v0.12 From e1f7d33dcd8267fd2fc9658df6245ca30df3741e Mon Sep 17 00:00:00 2001 From: ninerider Date: Thu, 8 Oct 2009 14:05:54 +0200 Subject: Comparison tolerance increased for handhelds The 'fuzzy' value for the was not relaxed enoough for small devices such as Windows Mobile and the like. Reviewed-by: Joerg --- tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp index e8979ea..b407fef 100644 --- a/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp +++ b/tests/auto/qgraphicstransform/tst_qgraphicstransform.cpp @@ -159,7 +159,11 @@ void tst_QGraphicsTransform::scale() // definitions correct for the difference. static inline bool fuzzyCompare(qreal p1, qreal p2) { - return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); + // increase delta on small machines using float instead of double + if (sizeof(qreal) == sizeof(float)) + return (qAbs(p1 - p2) <= 0.00002f * qMin(qAbs(p1), qAbs(p2))); + else + return (qAbs(p1 - p2) <= 0.00001f * qMin(qAbs(p1), qAbs(p2))); } static bool fuzzyCompare(const QTransform& t1, const QTransform& t2) { -- cgit v0.12 From cbd0020a4db3c67bb73f6c42ec2ce06a710b00db Mon Sep 17 00:00:00 2001 From: ninerider Date: Thu, 8 Oct 2009 14:16:05 +0200 Subject: Non-Zero timer livelock test expected to fail on Windows CE Timing issues prevent this test from working correctly on Windows CE. Reviewed-by: Joerg --- tests/auto/qtimer/tst_qtimer.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/tests/auto/qtimer/tst_qtimer.cpp b/tests/auto/qtimer/tst_qtimer.cpp index 0877500..01a6317 100644 --- a/tests/auto/qtimer/tst_qtimer.cpp +++ b/tests/auto/qtimer/tst_qtimer.cpp @@ -46,10 +46,6 @@ #include #include - - - - #if defined Q_OS_UNIX #include #endif @@ -242,7 +238,6 @@ public: // sleep for 2ms QTest::qSleep(2); - killTimer(te->timerId()); } @@ -277,9 +272,11 @@ void tst_QTimer::livelock() #elif defined(Q_OS_UNIX) && !defined(Q_OS_SYMBIAN) QEXPECT_FAIL("zero timer", "", Continue); QEXPECT_FAIL("non-zero timer", "", Continue); -#elif defined(Q_OS_WIN) +#elif defined(Q_OS_WIN) && !defined(Q_OS_WINCE) if (QSysInfo::WindowsVersion < QSysInfo::WV_XP) QEXPECT_FAIL("non-zero timer", "Multimedia timers are not available on Windows 2000", Continue); +#elif defined(Q_OS_WINCE) + QEXPECT_FAIL("non-zero timer", "Windows CE devices often too slow", Continue); #endif QVERIFY(tester.postEventAtRightTime); } -- cgit v0.12 From 00b198b1cdf48bd88d61bb256ec3ff455735e38c Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 8 Oct 2009 11:46:05 +0200 Subject: Conservative fix for link error with ARM RVCT compiler on symbian sbsv2 Not exporting the whole class prevents the capabilities example from linking, because the vtable is not exported. However windows builds don't support export of templated class, and export the vtable implicitly when there is an exported member function. Task-number: QTBUG-4593 Reviewed-by: Thierry Bastian --- .../phonon/phonon/objectdescriptionmodel.h | 23 ++++++++++++++++++---- src/s60installs/eabi/phononu.def | 20 +++++++++---------- 2 files changed, 29 insertions(+), 14 deletions(-) diff --git a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h index ba3cb42..a3c72b2 100644 --- a/src/3rdparty/phonon/phonon/objectdescriptionmodel.h +++ b/src/3rdparty/phonon/phonon/objectdescriptionmodel.h @@ -139,6 +139,21 @@ namespace Phonon ObjectDescriptionModelDataPrivate *const d; }; +/* Required to ensure template class vtables are exported on both symbian +and existing builds. */ +#if defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT) +// RVCT compiler (2.2.686) requires the export declaration to be on the class to export vtables +// MWC compiler works both ways +// GCCE compiler is unknown (it can't compile QtCore yet) +#define PHONON_TEMPLATE_CLASS_EXPORT PHONON_EXPORT +#define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT +#else +// Windows builds (at least) do not support export declaration on templated class +// But if you export a member function, the vtable is implicitly exported +#define PHONON_TEMPLATE_CLASS_EXPORT +#define PHONON_TEMPLATE_CLASS_MEMBER_EXPORT PHONON_EXPORT +#endif + /** \class ObjectDescriptionModel objectdescriptionmodel.h Phonon/ObjectDescriptionModel * \short The ObjectDescriptionModel class provides a model from * a list of ObjectDescription objects. @@ -175,7 +190,7 @@ namespace Phonon * \author Matthias Kretz */ template - class ObjectDescriptionModel : public QAbstractListModel + class PHONON_TEMPLATE_CLASS_EXPORT ObjectDescriptionModel : public QAbstractListModel { public: Q_OBJECT_CHECK @@ -188,11 +203,11 @@ namespace Phonon */ #if !defined(Q_CC_MINGW) || __MINGW32_MAJOR_VERSION >= 4 /** \internal */ - static PHONON_EXPORT const QMetaObject staticMetaObject; + static PHONON_TEMPLATE_CLASS_MEMBER_EXPORT const QMetaObject staticMetaObject; /** \internal */ - PHONON_EXPORT const QMetaObject *metaObject() const; + PHONON_TEMPLATE_CLASS_MEMBER_EXPORT const QMetaObject *metaObject() const; /** \internal */ - PHONON_EXPORT void *qt_metacast(const char *_clname); + PHONON_TEMPLATE_CLASS_MEMBER_EXPORT void *qt_metacast(const char *_clname); //int qt_metacall(QMetaObject::Call _c, int _id, void **_a); #endif diff --git a/src/s60installs/eabi/phononu.def b/src/s60installs/eabi/phononu.def index d407ba4..d70942c 100644 --- a/src/s60installs/eabi/phononu.def +++ b/src/s60installs/eabi/phononu.def @@ -495,11 +495,11 @@ EXPORTS _ZTIN6Phonon19AbstractVideoOutputE @ 494 NONAME _ZTIN6Phonon19BackendCapabilities8NotifierE @ 495 NONAME ABSENT _ZTIN6Phonon22MediaControllerPrivateE @ 496 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 497 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 498 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 499 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 500 NONAME ABSENT - _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 501 NONAME ABSENT + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 497 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 498 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 499 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 500 NONAME + _ZTIN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 501 NONAME _ZTIN6Phonon24VolumeFaderEffectPrivateE @ 502 NONAME ABSENT _ZTIN6Phonon26AbstractAudioOutputPrivateE @ 503 NONAME ABSENT _ZTIN6Phonon26AbstractMediaStreamPrivateE @ 504 NONAME @@ -532,11 +532,11 @@ EXPORTS _ZTVN6Phonon19AbstractVideoOutputE @ 531 NONAME _ZTVN6Phonon19BackendCapabilities8NotifierE @ 532 NONAME ABSENT _ZTVN6Phonon22MediaControllerPrivateE @ 533 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 534 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 535 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 536 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 537 NONAME ABSENT - _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 538 NONAME ABSENT + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE0EEE @ 534 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE1EEE @ 535 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE2EEE @ 536 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE3EEE @ 537 NONAME + _ZTVN6Phonon22ObjectDescriptionModelILNS_21ObjectDescriptionTypeE4EEE @ 538 NONAME _ZTVN6Phonon24VolumeFaderEffectPrivateE @ 539 NONAME ABSENT _ZTVN6Phonon26AbstractAudioOutputPrivateE @ 540 NONAME ABSENT _ZTVN6Phonon26AbstractMediaStreamPrivateE @ 541 NONAME -- cgit v0.12 From 77eceb53ee6fc7f20570f070124cd4a5f79698ab Mon Sep 17 00:00:00 2001 From: Shane Kearns Date: Thu, 8 Oct 2009 14:51:04 +0200 Subject: Remove incorrect optimisation in S60 widget / control stack sync Incorrect optimisation - for popup windows, Qt's focus is moved before hide_sys is called, resulting in the popup window keeping its elevated position in the CONE control stack. This can result in keyboard focus being in an invisible widget in some conditions - e.g. QTBUG-4733 Task-number: QTBUG-4733 Reviewed-by: axis --- src/gui/kernel/qwidget_s60.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 3328cee..b0d405a 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -434,7 +434,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de void QWidgetPrivate::show_sys() { Q_Q(QWidget); - + if (q->testAttribute(Qt::WA_OutsideWSRange)) return; @@ -490,7 +490,12 @@ void QWidgetPrivate::hide_sys() QSymbianControl *id = static_cast(q->internalWinId()); if (id) { - if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() + //Incorrect optimisation - for popup windows, Qt's focus is moved before + //hide_sys is called, resulting in the popup window keeping its elevated + //position in the CONE control stack. + //This can result in keyboard focus being in an invisible widget in some + //conditions - e.g. QTBUG-4733 + //if(id->IsFocused()) // Avoid unnecessary calls to FocusChanged() id->setFocusSafely(false); id->MakeVisible(false); if (QWidgetBackingStore *bs = maybeBackingStore()) @@ -1253,7 +1258,7 @@ void QWidget::grabMouse() WId id = effectiveWinId(); id->SetPointerCapture(true); QWidgetPrivate::mouseGrabber = this; - + #ifndef QT_NO_CURSOR QApplication::setOverrideCursor(cursor()); #endif -- cgit v0.12 From d64c806a7876937cceffd3d3185cf44510ec554e Mon Sep 17 00:00:00 2001 From: ninerider Date: Thu, 8 Oct 2009 15:27:05 +0200 Subject: Skipped test for Windows Mobile involving mouse move events. Events caused by dragging a mouse are currently unavailable in Windows Mobile. Reviewed-by: Joerg --- tests/auto/qmenu/tst_qmenu.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/auto/qmenu/tst_qmenu.cpp b/tests/auto/qmenu/tst_qmenu.cpp index 726ca55..4eb149f 100644 --- a/tests/auto/qmenu/tst_qmenu.cpp +++ b/tests/auto/qmenu/tst_qmenu.cpp @@ -812,6 +812,9 @@ public: void tst_QMenu::task258920_mouseBorder() { +#ifdef Q_OS_WINCE_WM + QSKIP("Mouse move related signals for Windows Mobile unavailable", SkipAll); +#endif Menu258920 menu; QAction *action = menu.addAction("test"); -- cgit v0.12 From dc69ddd069d687c748027790660818d2c79d3dfc Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 8 Oct 2009 16:01:22 +0200 Subject: doc: Changed the format of the since list. This is a big change from the original, and I expect we will want modifications. --- doc/src/qt4-intro.qdoc | 5 +- tools/qdoc3/codemarker.h | 2 + tools/qdoc3/cppcodeparser.cpp | 6 +- tools/qdoc3/htmlgenerator.cpp | 380 +++++++++++++++++++++++++++++++----------- tools/qdoc3/htmlgenerator.h | 59 +++++-- tools/qdoc3/node.cpp | 106 ++++++++++-- tools/qdoc3/node.h | 22 ++- 7 files changed, 433 insertions(+), 147 deletions(-) diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc index 6224cd4..38f346f 100644 --- a/doc/src/qt4-intro.qdoc +++ b/doc/src/qt4-intro.qdoc @@ -661,10 +661,9 @@ See the \l{QtMultimedia Module} documentation for more information. - \section1 Classes, functions, and other items introduced in 4.6 + \section1 Classes, functions, etc new in 4.6 - Links to classes, function, and other items that were added in - 4.6. + Links to classes, functions, and other items that are new in 4.6. \sincelist 4.6 diff --git a/tools/qdoc3/codemarker.h b/tools/qdoc3/codemarker.h index e400f8a..9858484 100644 --- a/tools/qdoc3/codemarker.h +++ b/tools/qdoc3/codemarker.h @@ -71,6 +71,8 @@ struct Section : name(name0), singularMember(singularMember0), pluralMember(pluralMember0) { } + void appendMember(Node* node) { members.append(node); } + void appendReimpMember(Node* node) { reimpMembers.append(node); } }; struct FastSection diff --git a/tools/qdoc3/cppcodeparser.cpp b/tools/qdoc3/cppcodeparser.cpp index ec5ce96..d93e24c 100644 --- a/tools/qdoc3/cppcodeparser.cpp +++ b/tools/qdoc3/cppcodeparser.cpp @@ -541,9 +541,10 @@ Node *CppCodeParser::processTopicCommand(const Doc& doc, else { lastPath = parentPath; } - - if (func) + if (func) { func->borrowParameterNames(clone); + func->setParentPath(clone->parentPath()); + } delete clone; } return func; @@ -1371,6 +1372,7 @@ bool CppCodeParser::matchFunctionDecl(InnerNode *parent, func->setAccess(access); func->setLocation(location()); func->setReturnType(returnType.toString()); + func->setParentPath(parentPath); func->setTemplateStuff(templateStuff); if (compat) func->setStatus(Node::Compat); diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index 291f60b..e883dfa 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -59,6 +59,24 @@ QT_BEGIN_NAMESPACE #define COMMAND_VERSION Doc::alias("version") +QString HtmlGenerator::sinceTitles[] = + { + " New Namespaces", + " New Classes", + " New Member Functions", + " New Functions in Namespaces", + " New Global Functions", + " New Macros", + " New Enum Types", + " New Typedefs", + " New Properties", + " New Variables", + " New Qml Properties", + " New Qml Signals", + " New Qml Methods", + "" + }; + static bool showBrokenLinks = false; static QRegExp linkTag("(<@link node=\"([^\"]+)\">).*()"); @@ -186,7 +204,7 @@ HtmlGenerator::HtmlGenerator() : helpProjectWriter(0), inLink(false), inContents(false), inSectionHeading(false), inTableHeader(false), numTableRows(0), threeColumnEnumValueTable(true), funcLeftParen("\\S(\\()"), - tre(0), slow(false), obsoleteLinks(false) + myTree(0), slow(false), obsoleteLinks(false) { } @@ -313,7 +331,7 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) ++styleIter; } - tre = tree; + myTree = tree; nonCompatClasses.clear(); mainClasses.clear(); compatClasses.clear(); @@ -433,7 +451,7 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) projectUrl, projectDescription); - helpProjectWriter->generate(tre); + helpProjectWriter->generate(myTree); } void HtmlGenerator::startText(const Node * /* relative */, @@ -598,13 +616,12 @@ int HtmlGenerator::generateAtom(const Atom *atom, break; case Atom::AnnotatedList: { - QList values = tre->groups().values(atom->string()); - QMap nodeMap; + QList values = myTree->groups().values(atom->string()); + NodeMap nodeMap; for (int i = 0; i < values.size(); ++i) { const Node* n = values.at(i); if ((n->status() != Node::Internal) && (n->access() != Node::Private)) { nodeMap.insert(n->nameForLists(),n); - //qDebug() << " " << n->nameForLists(); } } generateAnnotatedList(relative, marker, nodeMap); @@ -633,7 +650,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, if (editionModuleMap.contains(editionName)) { // Add all classes in the modules listed for that edition. - QMap editionClasses; + NodeMap editionClasses; foreach (const QString &moduleName, editionModuleMap[editionName]) { if (moduleClassMap.contains(moduleName)) editionClasses.unite(moduleClassMap[moduleName]); @@ -642,7 +659,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, // Add additional groups and remove groups of classes that // should be excluded from the edition. - QMultiMap groups = tre->groups(); + QMultiMap groups = myTree->groups(); foreach (const QString &groupName, editionGroupMap[editionName]) { QList groupClasses; if (groupName.startsWith("-")) { @@ -689,7 +706,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, else if (atom->string() == "related") { const FakeNode *fake = static_cast(relative); if (fake && !fake->groupMembers().isEmpty()) { - QMap groupMembersMap; + NodeMap groupMembersMap; foreach (const Node *node, fake->groupMembers()) { if (node->type() == Node::Fake) groupMembersMap[fullName(node, relative, marker)] = node; @@ -713,18 +730,125 @@ int HtmlGenerator::generateAtom(const Atom *atom, break; case Atom::SinceList: { - QList nodes; - SinceVersionMap::const_iterator v; - v = sinceVersions.find(atom->string()); - if ((v != sinceVersions.constEnd()) && !v.value().isEmpty()) { + NodeMultiMapMap::const_iterator v; + v = nodeMultiMapMap.find(atom->string()); + NodeMapMap::const_iterator nc; + nc = nodeMapMap.find(atom->string()); + if ((v != nodeMultiMapMap.constEnd()) && !v.value().isEmpty()) { + QList
sections; + QList
::ConstIterator s; + for (int i=0; itype()) { + case Node::Namespace: + sections[Namespace].appendMember((Node*)node); + break; + case Node::Class: + sections[Class].appendMember((Node*)node); + break; + case Node::Enum: + sections[Enum].appendMember((Node*)node); + break; + case Node::Typedef: + sections[Typedef].appendMember((Node*)node); + break; + case Node::Function: + const FunctionNode* fn = static_cast(node); + if (fn->isMacro()) + sections[Macro].appendMember((Node*)node); + else { + Node* p = fn->parent(); + if (p) { + if (p->type() == Node::Class) + sections[MemberFunction].appendMember((Node*)node); + else if (p->type() == Node::Namespace) { + if (p->name().isEmpty()) + sections[GlobalFunction].appendMember((Node*)node); + else + sections[NamespaceFunction].appendMember((Node*)node); + } + else + sections[GlobalFunction].appendMember((Node*)node); + } + else + sections[GlobalFunction].appendMember((Node*)node); + } + break; + case Node::Property: + sections[Property].appendMember((Node*)node); + break; + case Node::Variable: + sections[Variable].appendMember((Node*)node); + break; + case Node::QmlProperty: + sections[QmlProperty].appendMember((Node*)node); + break; + case Node::QmlSignal: + sections[QmlSignal].appendMember((Node*)node); + break; + case Node::QmlMethod: + sections[QmlMethod].appendMember((Node*)node); + break; + default: + break; + } + ++n; + } + int idx = 0; + s = sections.constBegin(); + while (s != sections.constEnd()) { + if (!(*s).members.isEmpty()) { + out() << "\n"; + out() << "

" << protect((*s).name) << "

\n"; + if (idx == Class) + generateCompactList(0, marker, nc.value(), QString("Q")); + else if (idx == MemberFunction) { + NodeMultiMapMap nodemultimapmap; + NodeMultiMapMap::iterator nmmap; + NodeList::const_iterator i = s->members.constBegin(); + while (i != s->members.constEnd()) { + Node* p = (*i)->parent(); + nmmap = nodemultimapmap.find(p->name()); + if (nmmap == nodemultimapmap.end()) + nmmap = nodemultimapmap.insert(p->name(),NodeMultiMap()); + nmmap->insert((*i)->name(),(*i)); + ++i; + } + nmmap = nodemultimapmap.begin(); + while (nmmap != nodemultimapmap.end()) { + NodeList nlist = nmmap->values(); + out() << "

New functions in " << protect(nmmap.key()) << ":

\n"; + generateSection(nlist, 0, marker, CodeMarker::Summary); + out() << "
"; + ++nmmap; + } + } + else + generateSection(s->members, 0, marker, CodeMarker::Summary); + } + ++idx; + ++s; + } +#if 0 for (int i=0; !Node::typeName(i).isEmpty(); i++) { Node::Type t = (Node::Type) i; SinceNodeMultiMap::const_iterator n=v.value().constBegin(); QMultiMap nodeMap; while (n != v.value().constEnd()) { const Node* node = n.value(); - if (node->type() == t) + if (node->type() == t) { nodeMap.insert(node->nameForLists(),node); + if (node->type() == Node::Function) { + const FunctionNode* fn = static_cast(node); + qDebug() << "SIGNATURE:" << fn->signature(); + } + } ++n; } if (!nodeMap.isEmpty()) { @@ -737,10 +861,11 @@ int HtmlGenerator::generateAtom(const Atom *atom, nodeMap.clear(); } } +#endif } } break; -case Atom::Image: + case Atom::Image: case Atom::InlineImage: { QString fileName = imageFileName(relative, atom->string()); @@ -1151,7 +1276,7 @@ void HtmlGenerator::generateClassLikeNode(const InnerNode *inner, subtitleText << "[" << Atom(Atom::AutoLink, fixedModule) << " module]"; if (fixedModule.isEmpty()) { - QMultiMap publicGroups = tre->publicGroups(); + QMultiMap publicGroups = myTree->publicGroups(); QList groupNames = publicGroups.values(inner->name()); if (!groupNames.isEmpty()) { qSort(groupNames.begin(), groupNames.end()); @@ -1492,7 +1617,7 @@ void HtmlGenerator::generateFakeNode(const FakeNode *fake, CodeMarker *marker) generateAlsoList(fake, marker); if (!fake->groupMembers().isEmpty()) { - QMap groupMembersMap; + NodeMap groupMembersMap; foreach (const Node *node, fake->groupMembers()) { if (node->type() == Node::Class || node->type() == Node::Namespace) groupMembersMap[node->name()] = node; @@ -1564,7 +1689,7 @@ void HtmlGenerator::generateHeader(const QString& title, if (node && !node->doc().location().isEmpty()) out() << "\n"; - shortVersion = tre->version(); + shortVersion = myTree->version(); if (shortVersion.count(QChar('.')) == 2) shortVersion.truncate(shortVersion.lastIndexOf(QChar('.'))); if (!shortVersion.isEmpty()) { @@ -1686,7 +1811,7 @@ void HtmlGenerator::generateHeader(const QString& title, "\n"; if (mainPage) generateMacRef(node, marker); - out() << QString(postHeader).replace("\\" + COMMAND_VERSION, tre->version()); + out() << QString(postHeader).replace("\\" + COMMAND_VERSION, myTree->version()); if (node && !node->links().empty()) @@ -1717,8 +1842,8 @@ void HtmlGenerator::generateFooter(const Node *node) if (node && !node->links().empty()) out() << "

\n" << navigationLinks << "

\n"; - out() << QString(footer).replace("\\" + COMMAND_VERSION, tre->version()) - << QString(address).replace("\\" + COMMAND_VERSION, tre->version()) + out() << QString(footer).replace("\\" + COMMAND_VERSION, myTree->version()) + << QString(address).replace("\\" + COMMAND_VERSION, myTree->version()) << "\n" "\n"; } @@ -1970,8 +2095,8 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, if (classMap.isEmpty()) return; - QMap topLevel; - QMap::ConstIterator c = classMap.begin(); + NodeMap topLevel; + NodeMap::ConstIterator c = classMap.begin(); while (c != classMap.end()) { const ClassNode *classe = static_cast(*c); if (classe->baseClasses().isEmpty()) @@ -1979,7 +2104,7 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, ++c; } - QStack > stack; + QStack stack; stack.push(topLevel); out() << "
    \n"; @@ -1996,7 +2121,7 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, out() << "\n"; stack.top().erase(stack.top().begin()); - QMap newTop; + NodeMap newTop; foreach (const RelatedClass &d, child->derivedClasses()) { if (d.access != Node::Private) newTop.insert(d.node->name(), d.node); @@ -2011,7 +2136,7 @@ void HtmlGenerator::generateClassHierarchy(const Node *relative, void HtmlGenerator::generateAnnotatedList(const Node *relative, CodeMarker *marker, - const QMap &nodeMap) + const NodeMap &nodeMap) { out() << "

    \n"; @@ -2049,9 +2174,19 @@ void HtmlGenerator::generateAnnotatedList(const Node *relative, out() << "

    \n"; } +/*! + This function finds the common prefix of the names of all + the classes in \a classMap and then generates a compact + list of the class names alphabetized on the part of the + name not including the common prefix. You can tell the + function to use \a comonPrefix as the common prefix, but + normally you let it figure it out itself by looking at + the name of the first and last classes in \a classMap. + */ void HtmlGenerator::generateCompactList(const Node *relative, CodeMarker *marker, - const QMap &classMap) + const NodeMap &classMap, + QString commonPrefix) { const int NumParagraphs = 37; // '0' to '9', 'A' to 'Z', '_' const int NumColumns = 4; // number of columns in the result @@ -2060,67 +2195,78 @@ void HtmlGenerator::generateCompactList(const Node *relative, return; /* - First, find out the common prefix of all non-namespaced classes. - For Qt, the prefix is Q. It can easily be derived from the first - and last classes in alphabetical order (QAccel and QXtWidget in Qt 2.1). - */ - int commonPrefixLen = 0; - QString commonPrefix; - QString first; - QString last; - - QMap::const_iterator iter = classMap.begin(); - while (iter != classMap.end()) { - if (!iter.key().contains("::")) { - first = iter.key(); - break; + If commonPrefix is not empty, then the caller knows what + the common prefix is, so just use that. + */ + int commonPrefixLen = commonPrefix.length(); + if (commonPrefixLen == 0) { + QString first; + QString last; + + /* + First, find out the common prefix of all non-namespaced + classes. For Qt, the prefix is Q. It can easily be derived + from the first and last classes in alphabetical order + (QAccel and QXtWidget in Qt 2.1). + */ + + NodeMap::const_iterator iter = classMap.begin(); + while (iter != classMap.end()) { + if (!iter.key().contains("::")) { + first = iter.key(); + break; + } + ++iter; } - ++iter; - } - if (first.isEmpty()) - first = classMap.begin().key(); + if (first.isEmpty()) + first = classMap.begin().key(); - iter = classMap.end(); - while (iter != classMap.begin()) { - --iter; - if (!iter.key().contains("::")) { - last = iter.key(); - break; + iter = classMap.end(); + while (iter != classMap.begin()) { + --iter; + if (!iter.key().contains("::")) { + last = iter.key(); + break; + } } - } - if (last.isEmpty()) - last = classMap.begin().key(); + if (last.isEmpty()) + last = classMap.begin().key(); - if (classMap.size() > 1) { - while (commonPrefixLen < first.length() + 1 && - commonPrefixLen < last.length() + 1 && - first[commonPrefixLen] == last[commonPrefixLen]) - ++commonPrefixLen; - } + if (classMap.size() > 1) { + while (commonPrefixLen < first.length() + 1 && + commonPrefixLen < last.length() + 1 && + first[commonPrefixLen] == last[commonPrefixLen]) + ++commonPrefixLen; + } - commonPrefix = first.left(commonPrefixLen); + commonPrefix = first.left(commonPrefixLen); + } /* Divide the data into 37 paragraphs: 0, ..., 9, A, ..., Z, underscore (_). QAccel will fall in paragraph 10 (A) and QXtWidget in paragraph 33 (X). This is the only place where we assume that NumParagraphs is 37. Each paragraph is a - QMap. + NodeMap. */ - QMap paragraph[NumParagraphs+1]; + NodeMap paragraph[NumParagraphs+1]; QString paragraphName[NumParagraphs+1]; - QMap::ConstIterator c = classMap.begin(); + qDebug() << "START COMPACT LIST"; + NodeMap::ConstIterator c = classMap.begin(); while (c != classMap.end()) { QStringList pieces = c.key().split("::"); QString key; + int idx = commonPrefixLen; + if (!pieces.last().startsWith(commonPrefix)) + idx = 0; if (pieces.size() == 1) - key = pieces.last().mid(commonPrefixLen).toLower(); + key = pieces.last().mid(idx).toLower(); else key = pieces.last().toLower(); - + qDebug() << " KEY:" << key; int paragraphNo = NumParagraphs - 1; if (key[0].digitValue() != -1) { @@ -2134,6 +2280,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, paragraph[paragraphNo].insert(key, c.value()); ++c; } + qDebug() << "END COMPACT LIST"; /* Each paragraph j has a size: paragraph[j].count(). In the @@ -2206,7 +2353,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, if ((currentParagraphNo[i] < NumParagraphs) && !paragraphName[currentParagraphNo[i]].isEmpty()) { - QMap::Iterator it; + NodeMap::Iterator it; it = paragraph[currentParagraphNo[i]].begin(); for (j = 0; j < currentOffsetInParagraph[i]; j++) ++it; @@ -2253,7 +2400,7 @@ void HtmlGenerator::generateFunctionIndex(const Node *relative, #if 1 out() << "
      \n"; #endif - QMap >::ConstIterator f = funcIndex.begin(); + QMap::ConstIterator f = funcIndex.begin(); while (f != funcIndex.end()) { #if 1 out() << "
    • "; @@ -2268,7 +2415,7 @@ void HtmlGenerator::generateFunctionIndex(const Node *relative, nextLetter++; } - QMap::ConstIterator s = (*f).begin(); + NodeMap::ConstIterator s = (*f).begin(); while (s != (*f).end()) { out() << " "; generateFullName((*s)->parent(), relative, marker, *s); @@ -2384,7 +2531,7 @@ void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* m QMap uncategorizedNodeMap; QRegExp singleDigit("\\b([0-9])\\b"); - const NodeList children = tre->root()->childNodes(); + const NodeList children = myTree->root()->childNodes(); foreach (Node *child, children) { if (child->type() == Node::Fake && child != relative) { FakeNode *fakeNode = static_cast(child); @@ -2436,7 +2583,7 @@ void HtmlGenerator::generateOverviewList(const Node *relative, CodeMarker * /* m else if (!isGroupPage) { // If we encounter a page that belongs to a group then // we add that page to the list for that group. - const FakeNode *groupNode = static_cast(tre->root()->findNode(group, Node::Fake)); + const FakeNode *groupNode = static_cast(myTree->root()->findNode(group, Node::Fake)); if (groupNode) fakeNodeMap[groupNode].insert(sortKey, fakeNode); //else @@ -2748,7 +2895,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, if (parseArg(src, funcTag, &i, n, &arg, &par1)) { QString link = linkForNode( marker->resolveTarget(par1.toString(), - tre, + myTree, relative), relative); addLink(link, arg, &html); @@ -2777,7 +2924,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) { par1 = QStringRef(); QString link = linkForNode( - marker->resolveTarget(arg.toString(), tre, relative), + marker->resolveTarget(arg.toString(), myTree, relative), relative); addLink(link, arg, &html); handled = true; @@ -3018,7 +3165,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, if (parseArg(src, funcTag, &i, n, &arg, &par1)) { QString link = linkForNode( marker->resolveTarget(par1.toString(), - tre, + myTree, relative), relative); addLink(link, arg, &html); @@ -3047,7 +3194,7 @@ QString HtmlGenerator::highlightedCode(const QString& markedCode, if (parseArg(src, typeTags[k], &i, n, &arg, &par1)) { par1 = QStringRef(); QString link = linkForNode( - marker->resolveTarget(arg.toString(), tre, relative), + marker->resolveTarget(arg.toString(), myTree, relative), relative); addLink(link, arg, &html); handled = true; @@ -3591,15 +3738,44 @@ void HtmlGenerator::findAllSince(const InnerNode *node) while (c != node->childNodes().constEnd()) { QString sinceVersion = (*c)->since(); if (((*c)->access() != Node::Private) && !sinceVersion.isEmpty()) { - SinceVersionMap::iterator vmap = sinceVersions.find(sinceVersion); - if (vmap == sinceVersions.end()) - vmap = sinceVersions.insert(sinceVersion,SinceNodeMultiMap()); + NodeMultiMapMap::iterator vmap = nodeMultiMapMap.find(sinceVersion); + if (vmap == nodeMultiMapMap.end()) + vmap = nodeMultiMapMap.insert(sinceVersion,NodeMultiMap()); + NodeMapMap::iterator ncmap = nodeMapMap.find(sinceVersion); + if (ncmap == nodeMapMap.end()) + ncmap = nodeMapMap.insert(sinceVersion,NodeMap()); + if ((*c)->type() == Node::Function) { FunctionNode *func = static_cast(*c); if ((func->status() > Node::Obsolete) && (func->metaness() != FunctionNode::Ctor) && (func->metaness() != FunctionNode::Dtor)) { vmap.value().insert(func->name(),(*c)); +#if 0 + qDebug() << "FUNCTION:" << func->name(); + Node* p = func->parent(); + if (p) { + if (p->type() == Node::Namespace) { + if (p->name().isEmpty()) + qDebug() << " Global namespace"; + else + qDebug() << " Namespace:" << p->name(); + } + else if (p->type() == Node::Class) + qDebug() << " Class:" << p->name(); + Node* q = p->parent(); + if (q) { + if (q->type() == Node::Namespace) { + if (q->name().isEmpty()) + qDebug() << " Grandparent Global namespace"; + else + qDebug() << " Grandparent Namespace:" << q->name(); + } + else if (q->type() == Node::Class) + qDebug() << " Grandparent Class:" << q->name(); + } + } +#endif } } else if ((*c)->url().isEmpty()) { @@ -3610,6 +3786,7 @@ void HtmlGenerator::findAllSince(const InnerNode *node) !(*c)->parent()->name().isEmpty()) className = (*c)->parent()->name()+"::"+className; vmap.value().insert(className,(*c)); + ncmap.value().insert(className,(*c)); } } else { @@ -3619,7 +3796,6 @@ void HtmlGenerator::findAllSince(const InnerNode *node) !(*c)->parent()->name().isEmpty()) name = (*c)->parent()->name()+"::"+name; vmap.value().insert(name,(*c)); - qDebug() << "GOT HEAH" << name; } if ((*c)->isInnerNode()) { findAllSince(static_cast(*c)); @@ -3646,9 +3822,10 @@ void HtmlGenerator::findAllFunctions(const InnerNode *node) } else if ((*c)->type() == Node::Function) { const FunctionNode *func = static_cast(*c); - if (func->status() > Node::Obsolete && func->metaness() != FunctionNode::Ctor - && func->metaness() != FunctionNode::Dtor) { - funcIndex[(*c)->name()].insert(tre->fullDocumentName((*c)->parent()), *c); + if ((func->status() > Node::Obsolete) && + (func->metaness() != FunctionNode::Ctor) && + (func->metaness() != FunctionNode::Dtor)) { + funcIndex[(*c)->name()].insert(myTree->fullDocumentName((*c)->parent()), *c); } } } @@ -3762,14 +3939,14 @@ const Node *HtmlGenerator::findNodeForTarget(const QString &target, node = relative; } else if (target.endsWith(".html")) { - node = tre->root()->findNode(target, Node::Fake); + node = myTree->root()->findNode(target, Node::Fake); } else if (marker) { - node = marker->resolveTarget(target, tre, relative); + node = marker->resolveTarget(target, myTree, relative); if (!node) - node = tre->findFakeNodeByTitle(target); + node = myTree->findFakeNodeByTitle(target); if (!node && atom) { - node = tre->findUnambiguousTarget(target, + node = myTree->findUnambiguousTarget(target, *const_cast(&atom)); } } @@ -3827,14 +4004,14 @@ QString HtmlGenerator::getLink(const Atom *atom, *node = relative; } else if (first.endsWith(".html")) { - *node = tre->root()->findNode(first, Node::Fake); + *node = myTree->root()->findNode(first, Node::Fake); } else { - *node = marker->resolveTarget(first, tre, relative); + *node = marker->resolveTarget(first, myTree, relative); if (!*node) - *node = tre->findFakeNodeByTitle(first); + *node = myTree->findFakeNodeByTitle(first); if (!*node) - *node = tre->findUnambiguousTarget(first, targetAtom); + *node = myTree->findUnambiguousTarget(first, targetAtom); } if (*node) { @@ -3886,7 +4063,7 @@ QString HtmlGenerator::getLink(const Atom *atom, } while (!path.isEmpty()) { - targetAtom = tre->findTarget(path.first(), *node); + targetAtom = myTree->findTarget(path.first(), *node); if (targetAtom == 0) break; path.removeFirst(); @@ -3915,7 +4092,7 @@ void HtmlGenerator::generateIndex(const QString &fileBase, const QString &url, const QString &title) { - tre->generateIndex(outputDir() + "/" + fileBase + ".index", url, title); + myTree->generateIndex(outputDir() + "/" + fileBase + ".index", url, title); } void HtmlGenerator::generateStatus(const Node *node, CodeMarker *marker) @@ -3930,18 +4107,21 @@ void HtmlGenerator::generateStatus(const Node *node, CodeMarker *marker) case Node::Compat: if (node->isInnerNode()) { text << Atom::ParaLeft - << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) << "This " - << typeString(node) << " is part of the Qt 3 support library." + << Atom(Atom::FormattingLeft,ATOM_FORMATTING_BOLD) + << "This " + << typeString(node) + << " is part of the Qt 3 support library." << Atom(Atom::FormattingRight, ATOM_FORMATTING_BOLD) - << " It is provided to keep old source code working. We strongly advise against " + << " It is provided to keep old source code working. " + << "We strongly advise against " << "using it in new code. See "; - const FakeNode *fakeNode = tre->findFakeNodeByTitle("Porting To Qt 4"); + const FakeNode *fakeNode = myTree->findFakeNodeByTitle("Porting To Qt 4"); Atom *targetAtom = 0; if (fakeNode && node->type() == Node::Class) { QString oldName(node->name()); - targetAtom = tre->findTarget(oldName.replace("3", ""), - fakeNode); + targetAtom = myTree->findTarget(oldName.replace("3", ""), + fakeNode); } if (targetAtom) { @@ -4151,7 +4331,7 @@ void HtmlGenerator::generateQmlInherits(const QmlClassNode* cn, QPair linkPair; linkPair = cn->links()[Node::InheritsLink]; QStringList strList(linkPair.first); - const Node* n = tre->findNode(strList,Node::Fake); + const Node* n = myTree->findNode(strList,Node::Fake); if (n && n->subType() == Node::QmlClass) { const QmlClassNode* qcn = static_cast(n); out() << "

      "; @@ -4210,7 +4390,7 @@ void HtmlGenerator::generateInstantiatedBy(const ClassNode* cn, CodeMarker* marker) { if (cn && cn->status() != Node::Internal && !cn->qmlElement().isEmpty()) { - const Node* n = tre->root()->findNode(cn->qmlElement(),Node::Fake); + const Node* n = myTree->root()->findNode(cn->qmlElement(),Node::Fake); if (n && n->subType() == Node::QmlClass) { out() << "

      "; Text text; diff --git a/tools/qdoc3/htmlgenerator.h b/tools/qdoc3/htmlgenerator.h index 3f6e564..fabfed1 100644 --- a/tools/qdoc3/htmlgenerator.h +++ b/tools/qdoc3/htmlgenerator.h @@ -67,14 +67,34 @@ struct NavigationBar }; #endif -typedef QMultiMap SinceNodeMultiMap; -typedef QMap SinceVersionMap; +typedef QMultiMap NodeMultiMap; +typedef QMap NodeMultiMapMap; +typedef QMap NodeMap; +typedef QMap NodeMapMap; class HelpProjectWriter; class HtmlGenerator : public PageGenerator { public: + enum SinceType { + Namespace, + Class, + MemberFunction, + NamespaceFunction, + GlobalFunction, + Macro, + Enum, + Typedef, + Property, + Variable, + QmlProperty, + QmlSignal, + QmlMethod, + LastSinceType + }; + + public: HtmlGenerator(); ~HtmlGenerator(); @@ -85,6 +105,7 @@ class HtmlGenerator : public PageGenerator static QString protect(const QString& string); static QString cleanRef(const QString& ref); + static QString sinceTitle(int i) { return sinceTitles[i]; } protected: virtual void startText(const Node *relative, CodeMarker *marker); @@ -134,13 +155,14 @@ class HtmlGenerator : public PageGenerator CodeMarker::Status status); void generateClassHierarchy(const Node *relative, CodeMarker *marker, - const QMap &classMap); + const NodeMap &classMap); void generateAnnotatedList(const Node *relative, CodeMarker *marker, - const QMap &nodeMap); + const NodeMap &nodeMap); void generateCompactList(const Node *relative, CodeMarker *marker, - const QMap &classMap); + const NodeMap &classMap, + QString commonPrefix = QString()); void generateFunctionIndex(const Node *relative, CodeMarker *marker); void generateLegaleseList(const Node *relative, CodeMarker *marker); void generateOverviewList(const Node *relative, CodeMarker *marker); @@ -273,23 +295,25 @@ class HtmlGenerator : public PageGenerator QString navigationLinks; QStringList stylesheets; QStringList customHeadElements; - const Tree *tre; + const Tree *myTree; bool slow; bool obsoleteLinks; - QMap > moduleClassMap; - QMap > moduleNamespaceMap; - QMap nonCompatClasses; - QMap mainClasses; - QMap compatClasses; - QMap obsoleteClasses; - QMap namespaceIndex; - QMap serviceClasses; + QMap moduleClassMap; + QMap moduleNamespaceMap; + NodeMap nonCompatClasses; + NodeMap mainClasses; + NodeMap compatClasses; + NodeMap obsoleteClasses; + NodeMap namespaceIndex; + NodeMap serviceClasses; #ifdef QDOC_QML - QMap qmlClasses; + NodeMap qmlClasses; #endif - QMap > funcIndex; + QMap funcIndex; QMap legaleseTexts; - SinceVersionMap sinceVersions; + NodeMultiMapMap nodeMultiMapMap; + static QString sinceTitles[]; + NodeMapMap nodeMapMap; }; #define HTMLGENERATOR_ADDRESS "address" @@ -303,3 +327,4 @@ class HtmlGenerator : public PageGenerator QT_END_NAMESPACE #endif + diff --git a/tools/qdoc3/node.cpp b/tools/qdoc3/node.cpp index d547d20..558808f 100644 --- a/tools/qdoc3/node.cpp +++ b/tools/qdoc3/node.cpp @@ -48,29 +48,17 @@ QT_BEGIN_NAMESPACE -QString Node::typeNames[] = - { - "Namespaces", - "Classes", - "Fake", - "Enums", - "Typedefs", - "Functions and Macros", - "Properties", - "Variables", - "Targets", - "Qml Properties", - "Qml Signals", - "Qml Methods", - "" - }; - /*! \class Node - \brief A node in a Tree. + \brief The Node class is a node in the Tree. + + A Node represents a class or function or something else + from the source code.. */ /*! + When this Node is destroyed, if it has a parent Node, it + removes itself from the parent node's child list. */ Node::~Node() { @@ -81,6 +69,11 @@ Node::~Node() } /*! + Sets this Node's Doc to \a doc. If \a replace is false and + this Node already has a Doc, a warning is reported that the + Doc is being overridden, and it reports where the previous + Doc was found. If \a replace is true, the Doc is replaced + silently. */ void Node::setDoc(const Doc& doc, bool replace) { @@ -840,9 +833,17 @@ void TypedefNode::setAssociatedEnum(const EnumNode *enume) /*! \class Parameter + \brief The class Parameter contains one parameter. + + A parameter can be a function parameter or a macro + parameter. */ /*! + Constructs this parameter from the left and right types + \a leftType and rightType, the parameter \a name, and the + \a defaultValue. In practice, \a rightType is not used, + and I don't know what is was meant for. */ Parameter::Parameter(const QString& leftType, const QString& rightType, @@ -853,6 +854,7 @@ Parameter::Parameter(const QString& leftType, } /*! + The standard copy constructor copies the strings from \a p. */ Parameter::Parameter(const Parameter& p) : lef(p.lef), rig(p.rig), nam(p.nam), def(p.def) @@ -860,6 +862,8 @@ Parameter::Parameter(const Parameter& p) } /*! + Assigning Parameter \a p to this Parameter copies the + strings across. */ Parameter& Parameter::operator=(const Parameter& p) { @@ -871,6 +875,23 @@ Parameter& Parameter::operator=(const Parameter& p) } /*! + Reconstructs the text describing the parameter and + returns it. If \a value is true, the default value + will be included, if there is one. + */ +QString Parameter::reconstruct(bool value) const +{ + QString p = lef + rig; + if (!p.endsWith(QChar('*')) && !p.endsWith(QChar('&')) && !p.endsWith(QChar(' '))) + p += " "; + p += nam; + if (value) + p += def; + return p; +} + + +/*! \class FunctionNode */ @@ -924,6 +945,8 @@ void FunctionNode::borrowParameterNames(const FunctionNode *source) } /*! + If this function is a reimplementation, \a from points + to the FunctionNode of the function being reimplemented. */ void FunctionNode::setReimplementedFrom(FunctionNode *from) { @@ -932,6 +955,8 @@ void FunctionNode::setReimplementedFrom(FunctionNode *from) } /*! + Sets the "associated" property to \a property. The function + might be the setter or getter for a property, for example. */ void FunctionNode::setAssociatedProperty(PropertyNode *property) { @@ -939,6 +964,8 @@ void FunctionNode::setAssociatedProperty(PropertyNode *property) } /*! + Returns the overload number for this function obtained + from the parent. */ int FunctionNode::overloadNumber() const { @@ -946,6 +973,8 @@ int FunctionNode::overloadNumber() const } /*! + Returns the number of times this function name has been + overloaded, obtained from the parent. */ int FunctionNode::numOverloads() const { @@ -953,6 +982,7 @@ int FunctionNode::numOverloads() const } /*! + Returns the list of parameter names. */ QStringList FunctionNode::parameterNames() const { @@ -966,6 +996,46 @@ QStringList FunctionNode::parameterNames() const } /*! + Returns the list of reconstructed parameters. If \a values + is true, the default values are included, if any are present. + */ +QStringList FunctionNode::reconstructParams(bool values) const +{ + QStringList params; + QList::ConstIterator p = parameters().begin(); + while (p != parameters().end()) { + params << (*p).reconstruct(values); + ++p; + } + return params; +} + +/*! + Reconstructs and returns the function's signature. If \a values + is true, the default values of the parameters are included, if + present. + */ +QString FunctionNode::signature(bool values) const +{ + QString s; + if (!returnType().isEmpty()) + s = returnType() + " "; + s += name() + "("; + QStringList params = reconstructParams(values); + int p = params.size(); + if (p > 0) { + for (int i=0; i &reimplementedBy() const { return rb; } const PropertyNode *associatedProperty() const { return ap; } + const QStringList& parentPath() const { return pp; } + + QStringList reconstructParams(bool values = false) const; + QString signature(bool values = false) const; private: void setAssociatedProperty(PropertyNode *property); @@ -576,9 +583,10 @@ class FunctionNode : public LeafNode friend class InnerNode; friend class PropertyNode; - QString rt; + QString rt; + QStringList pp; #ifdef Q_WS_WIN - Metaness met; + Metaness met; Virtualness vir; #else Metaness met : 4; -- cgit v0.12 From 712bdb01662a5724fa593937cfbb447f936998d4 Mon Sep 17 00:00:00 2001 From: Martin Smith Date: Thu, 8 Oct 2009 16:07:10 +0200 Subject: qdoc: Removed some debug code and #if 0 code. --- tools/qdoc3/htmlgenerator.cpp | 114 +----------------------------------------- 1 file changed, 1 insertion(+), 113 deletions(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index e883dfa..ed3a485 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -350,64 +350,6 @@ void HtmlGenerator::generateTree(const Tree *tree, CodeMarker *marker) #endif findAllSince(tree->root()); -#if 0 - if (!sinceVersions.isEmpty()) { - SinceVersionMap::const_iterator v = sinceVersions.constEnd(); - do { - --v; - qDebug() << "SINCE:" << v.key(); - if (!v.value().isEmpty()) { - QString type; - SinceNodeMultiMap::const_iterator n = v.value().constBegin(); - while (n != v.value().constEnd()) { - switch (n.value()->type()) { - case Node::Namespace: - type = "namespace"; - break; - case Node::Class: - type = "class"; - break; - case Node::Fake: - type = "fake"; - break; - case Node::Enum: - type = "enum"; - break; - case Node::Typedef: - type = "typedef"; - break; - case Node::Function: - type = "function"; - break; - case Node::Property: - type = "property"; - break; - case Node::Variable: - type = "variable"; - break; - case Node::Target: - type = "target"; - break; - case Node::QmlProperty: - type = "QML property"; - break; - case Node::QmlSignal: - type = "QML signal"; - break; - case Node::QmlMethod: - type = "QML method"; - break; - default: - type = "No type"; - } - qDebug() << " " << type << n.key(); - ++n; - } - } - } while (v != sinceVersions.constBegin()); - } -#endif - PageGenerator::generateTree(tree, marker); dcfClassesRoot.ref = "classes.html"; @@ -835,33 +777,6 @@ int HtmlGenerator::generateAtom(const Atom *atom, ++idx; ++s; } -#if 0 - for (int i=0; !Node::typeName(i).isEmpty(); i++) { - Node::Type t = (Node::Type) i; - SinceNodeMultiMap::const_iterator n=v.value().constBegin(); - QMultiMap nodeMap; - while (n != v.value().constEnd()) { - const Node* node = n.value(); - if (node->type() == t) { - nodeMap.insert(node->nameForLists(),node); - if (node->type() == Node::Function) { - const FunctionNode* fn = static_cast(node); - qDebug() << "SIGNATURE:" << fn->signature(); - } - } - ++n; - } - if (!nodeMap.isEmpty()) { - out() << "

      " - << Node::typeName(i) - << " new in Qt " - << atom->string() - << "

      "; - generateAnnotatedList(relative, marker, nodeMap); - nodeMap.clear(); - } - } -#endif } } break; @@ -2254,7 +2169,6 @@ void HtmlGenerator::generateCompactList(const Node *relative, NodeMap paragraph[NumParagraphs+1]; QString paragraphName[NumParagraphs+1]; - qDebug() << "START COMPACT LIST"; NodeMap::ConstIterator c = classMap.begin(); while (c != classMap.end()) { QStringList pieces = c.key().split("::"); @@ -2266,7 +2180,7 @@ void HtmlGenerator::generateCompactList(const Node *relative, key = pieces.last().mid(idx).toLower(); else key = pieces.last().toLower(); - qDebug() << " KEY:" << key; + int paragraphNo = NumParagraphs - 1; if (key[0].digitValue() != -1) { @@ -2280,7 +2194,6 @@ void HtmlGenerator::generateCompactList(const Node *relative, paragraph[paragraphNo].insert(key, c.value()); ++c; } - qDebug() << "END COMPACT LIST"; /* Each paragraph j has a size: paragraph[j].count(). In the @@ -3751,31 +3664,6 @@ void HtmlGenerator::findAllSince(const InnerNode *node) (func->metaness() != FunctionNode::Ctor) && (func->metaness() != FunctionNode::Dtor)) { vmap.value().insert(func->name(),(*c)); -#if 0 - qDebug() << "FUNCTION:" << func->name(); - Node* p = func->parent(); - if (p) { - if (p->type() == Node::Namespace) { - if (p->name().isEmpty()) - qDebug() << " Global namespace"; - else - qDebug() << " Namespace:" << p->name(); - } - else if (p->type() == Node::Class) - qDebug() << " Class:" << p->name(); - Node* q = p->parent(); - if (q) { - if (q->type() == Node::Namespace) { - if (q->name().isEmpty()) - qDebug() << " Grandparent Global namespace"; - else - qDebug() << " Grandparent Namespace:" << q->name(); - } - else if (q->type() == Node::Class) - qDebug() << " Grandparent Class:" << q->name(); - } - } -#endif } } else if ((*c)->url().isEmpty()) { -- cgit v0.12 From e38529caa8e188b83c529e3eaca4eab8b8ab393d Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 8 Oct 2009 13:52:15 +0200 Subject: Stabilize Tests --- tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 8 +++----- tests/auto/qspinbox/tst_qspinbox.cpp | 10 ++++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 8459331..f5e9acb 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -2819,17 +2819,15 @@ void tst_QGraphicsScene::update2() CustomView view; view.setScene(&scene); view.show(); -#ifdef Q_WS_X11 - qt_x11_wait_for_window_manager(&view); -#endif - QTest::qWait(250); + QTest::qWaitForWindowShown(&view); + QTRY_VERIFY(view.repaints >= 1); view.repaints = 0; // Make sure QGraphicsScene::update only requires one event-loop iteration // before the view is updated. scene.update(); qApp->processEvents(); - QCOMPARE(view.repaints, 1); + QTRY_COMPARE(view.repaints, 1); view.repaints = 0; // The same for partial scene updates. diff --git a/tests/auto/qspinbox/tst_qspinbox.cpp b/tests/auto/qspinbox/tst_qspinbox.cpp index 4829b6b..2389060 100644 --- a/tests/auto/qspinbox/tst_qspinbox.cpp +++ b/tests/auto/qspinbox/tst_qspinbox.cpp @@ -980,26 +980,28 @@ void tst_QSpinBox::sizeHint() sizeHint_SpinBox *spinBox = new sizeHint_SpinBox; layout->addWidget(spinBox); widget->show(); - QTest::qWait(100); + QTest::qWaitForWindowShown(widget); // Prefix spinBox->sizeHintRequests = 0; spinBox->setPrefix(QLatin1String("abcdefghij")); qApp->processEvents(); - QVERIFY(spinBox->sizeHintRequests > 0); + QTRY_VERIFY(spinBox->sizeHintRequests > 0); // Suffix spinBox->sizeHintRequests = 0; spinBox->setSuffix(QLatin1String("abcdefghij")); qApp->processEvents(); - QVERIFY(spinBox->sizeHintRequests > 0); + QTRY_VERIFY(spinBox->sizeHintRequests > 0); // Range spinBox->sizeHintRequests = 0; spinBox->setRange(0, 1234567890); spinBox->setValue(spinBox->maximum()); qApp->processEvents(); - QVERIFY(spinBox->sizeHintRequests > 0); + QTRY_VERIFY(spinBox->sizeHintRequests > 0); + + delete widget; } QTEST_MAIN(tst_QSpinBox) -- cgit v0.12 From dbf0d8c50fce24d36dd5e6eac853a1242ad89455 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 8 Oct 2009 17:46:48 +0200 Subject: Skip the crashing selftest on Mac The signal handler does seem to work on Mac for segfault Reviewed-by: Rohan McGovern --- tests/auto/selftests/tst_selftests.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/auto/selftests/tst_selftests.cpp b/tests/auto/selftests/tst_selftests.cpp index 1a2de65..579f4eb 100644 --- a/tests/auto/selftests/tst_selftests.cpp +++ b/tests/auto/selftests/tst_selftests.cpp @@ -299,7 +299,7 @@ void tst_Selftests::runSubTest() void tst_Selftests::initTestCase() { -#ifndef Q_OS_UNIX +#if !defined(Q_OS_UNIX) || defined(Q_WS_MAC) m_checkXMLBlacklist.append("crashes"); // This test crashes (XML valid on Unix only) #endif m_checkXMLBlacklist.append("waitwithoutgui"); // This test is not a QTestLib test. -- cgit v0.12 From f7e13aefc24b98299d8fd44cad60cc13b16e4114 Mon Sep 17 00:00:00 2001 From: Rohan McGovern Date: Thu, 8 Oct 2009 17:47:24 +0200 Subject: Fixed compile. --- tools/qdoc3/htmlgenerator.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tools/qdoc3/htmlgenerator.cpp b/tools/qdoc3/htmlgenerator.cpp index ed3a485..033c62c 100644 --- a/tools/qdoc3/htmlgenerator.cpp +++ b/tools/qdoc3/htmlgenerator.cpp @@ -698,7 +698,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, case Node::Typedef: sections[Typedef].appendMember((Node*)node); break; - case Node::Function: + case Node::Function: { const FunctionNode* fn = static_cast(node); if (fn->isMacro()) sections[Macro].appendMember((Node*)node); @@ -720,6 +720,7 @@ int HtmlGenerator::generateAtom(const Atom *atom, sections[GlobalFunction].appendMember((Node*)node); } break; + } case Node::Property: sections[Property].appendMember((Node*)node); break; -- cgit v0.12