summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar@trolltech.com>2009-11-16 12:37:25 (GMT)
committerGunnar Sletta <gunnar@trolltech.com>2009-11-16 12:37:25 (GMT)
commit116af8e05ffae348c8236f02bcc9b642f156d3e8 (patch)
tree97942f4e3e72cc31dd6772a162344683bac46441
parentde43f6f89e1344045f0fb5a319a44e5d604d414e (diff)
parent7e1f19c3e3036f166a84dbaa916ec1da1cc818c6 (diff)
downloadQt-116af8e05ffae348c8236f02bcc9b642f156d3e8.zip
Qt-116af8e05ffae348c8236f02bcc9b642f156d3e8.tar.gz
Qt-116af8e05ffae348c8236f02bcc9b642f156d3e8.tar.bz2
Merge branch '4.6' of git@scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6
-rw-r--r--dist/changes-4.6.09
-rw-r--r--examples/graphicsview/anchorlayout/main.cpp4
-rw-r--r--examples/opengl/pbuffers/glwidget.cpp8
-rw-r--r--mkspecs/linux-g++-maemo/qmake.conf32
-rw-r--r--mkspecs/linux-g++-maemo/qplatformdefs.h42
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.cpp3
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout.h1
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.cpp482
-rw-r--r--src/gui/graphicsview/qgraphicsanchorlayout_p.h64
-rw-r--r--src/gui/image/qpixmap_x11.cpp5
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp5
-rw-r--r--src/gui/kernel/qapplication_s60.cpp20
-rw-r--r--src/gui/kernel/qt_s60_p.h1
-rw-r--r--src/gui/kernel/qwidget_s60.cpp16
-rw-r--r--src/gui/painting/qpaintbuffer_p.h2
-rw-r--r--src/gui/styles/qs60style.cpp12
-rw-r--r--src/gui/text/qtextdocument_p.cpp4
-rw-r--r--src/gui/widgets/qdockarealayout.cpp5
-rw-r--r--src/gui/widgets/qlineedit.cpp4
-rw-r--r--src/gui/widgets/qtextedit.cpp4
-rw-r--r--src/opengl/gl2paintengineex/qtriangulatingstroker.cpp12
-rw-r--r--src/opengl/gl2paintengineex/qtriangulatingstroker_p.h4
-rw-r--r--src/opengl/qgl.cpp2
-rw-r--r--src/opengl/qgl_p.h1
-rw-r--r--src/opengl/qglpixelbuffer_egl.cpp65
-rw-r--r--src/s60installs/bwins/QtCoreu.def3
-rw-r--r--src/s60installs/eabi/QtCoreu.def15
-rw-r--r--src/s60installs/qt.iby2
-rw-r--r--src/s60installs/s60installs.pro4
-rw-r--r--tests/auto/bic/tst_bic.cpp4
-rw-r--r--tests/auto/collections/tst_collections.cpp2
-rw-r--r--tests/auto/linguist/lconvert/tst_lconvert.cpp8
-rw-r--r--tests/auto/linguist/lrelease/tst_lrelease.cpp8
-rw-r--r--tests/auto/linguist/lupdate/testlupdate.cpp4
-rw-r--r--tests/auto/linguist/lupdate/tst_lupdate.cpp12
-rw-r--r--tests/auto/qabstractslider/tst_qabstractslider.cpp4
-rw-r--r--tests/auto/qcombobox/tst_qcombobox.cpp4
-rw-r--r--tests/auto/qdockwidget/tst_qdockwidget.cpp5
-rw-r--r--tests/auto/qfile/qfile.pro2
-rw-r--r--tests/auto/qgl/tst_qgl.cpp5
-rw-r--r--tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp26
-rw-r--r--tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp4
-rw-r--r--tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp65
-rw-r--r--tests/auto/qlibrary/lib2/lib2.pro6
-rw-r--r--tests/auto/qtextdocument/tst_qtextdocument.cpp11
-rw-r--r--tests/auto/qtreewidget/tst_qtreewidget.cpp28
-rw-r--r--tests/auto/qworkspace/tst_qworkspace.cpp3
-rw-r--r--tools/assistant/lib/qhelp_global.cpp2
48 files changed, 545 insertions, 489 deletions
diff --git a/dist/changes-4.6.0 b/dist/changes-4.6.0
index 7ca724c..24d8fc0 100644
--- a/dist/changes-4.6.0
+++ b/dist/changes-4.6.0
@@ -15,10 +15,6 @@ Qt Bug Tracker: http://bugreports.qt.nokia.com
Task Tracker: http://qt.nokia.com/developer/task-tracker
Merge Request: http://qt.gitorious.org
-QTBUG-1234 - Qt Bug Tracker: http://bugreports.qt.nokia.com
-MR#1234 - Merge Request: http://qt.gitorious.org
-123456 - Task Tracker: http://qt.nokia.com/developer/task-tracker
-
****************************************************************************
* General *
****************************************************************************
@@ -56,7 +52,10 @@ MR#1234 - Merge Request: http://qt.gitorious.org
* New abstract video output classes.
- New state machine framework added to QtCore.
-
+
+ - QtTest now supports outputting XUnit XML documents, for integrating
+ with existing continuous integration systems. This is enabled by
+ running the test program with the -xunitxml option.
Third party components
----------------------
diff --git a/examples/graphicsview/anchorlayout/main.cpp b/examples/graphicsview/anchorlayout/main.cpp
index 3e19f18..f898d1d 100644
--- a/examples/graphicsview/anchorlayout/main.cpp
+++ b/examples/graphicsview/anchorlayout/main.cpp
@@ -76,8 +76,8 @@ int main(int argc, char **argv)
QGraphicsProxyWidget *c = createItem(minSize, prefSize, maxSize, "C");
QGraphicsProxyWidget *d = createItem(minSize, prefSize, maxSize, "D");
QGraphicsProxyWidget *e = createItem(minSize, prefSize, maxSize, "E");
- QGraphicsProxyWidget *f = createItem(QSizeF(30, 50), QSizeF(150, 50), maxSize, "F");
- QGraphicsProxyWidget *g = createItem(QSizeF(30, 50), QSizeF(30, 100), maxSize, "G");
+ QGraphicsProxyWidget *f = createItem(QSizeF(30, 50), QSizeF(150, 50), maxSize, "F (overflow)");
+ QGraphicsProxyWidget *g = createItem(QSizeF(30, 50), QSizeF(30, 100), maxSize, "G (overflow)");
QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout;
l->setSpacing(0);
diff --git a/examples/opengl/pbuffers/glwidget.cpp b/examples/opengl/pbuffers/glwidget.cpp
index 56ba65b..d843a73 100644
--- a/examples/opengl/pbuffers/glwidget.cpp
+++ b/examples/opengl/pbuffers/glwidget.cpp
@@ -175,7 +175,11 @@ void GLWidget::perspectiveProjection()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
+#ifdef QT_OPENGL_ES
+ glFrustumf(-aspect, +aspect, -1.0, +1.0, 4.0, 15.0);
+#else
glFrustum(-aspect, +aspect, -1.0, +1.0, 4.0, 15.0);
+#endif
glMatrixMode(GL_MODELVIEW);
}
@@ -183,7 +187,11 @@ void GLWidget::orthographicProjection()
{
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
+#ifdef QT_OPENGL_ES
+ glOrthof(-1.0, +1.0, -1.0, +1.0, -90.0, +90.0);
+#else
glOrtho(-1.0, +1.0, -1.0, +1.0, -90.0, +90.0);
+#endif
glMatrixMode(GL_MODELVIEW);
}
diff --git a/mkspecs/linux-g++-maemo/qmake.conf b/mkspecs/linux-g++-maemo/qmake.conf
new file mode 100644
index 0000000..c39ba2c
--- /dev/null
+++ b/mkspecs/linux-g++-maemo/qmake.conf
@@ -0,0 +1,32 @@
+#
+# qmake configuration for Maemo 5 & 6
+#
+
+MAKEFILE_GENERATOR = UNIX
+TEMPLATE = app
+CONFIG += qt warn_on release incremental link_prl
+QT += core gui
+QMAKE_INCREMENTAL_STYLE = sublib
+
+include(../common/g++.conf)
+include(../common/linux.conf)
+
+# Work round scratchbox not having standard paths in it's default search path
+QMAKE_LFLAGS += -Wl,-rpath-link=/lib
+QMAKE_LFLAGS += -Wl,-rpath-link=/usr/lib
+
+# Override the default lib/include directories for scratchbox:
+QMAKE_INCDIR_X11 = /usr/include/X11
+QMAKE_INCDIR_OPENGL = /usr/include
+QMAKE_LIBDIR_X11 = /usr/lib
+QMAKE_LIBDIR_OPENGL = /usr/lib
+
+# We still need to generate debug symbols in release mode to put into the *-dbg packages:
+QMAKE_CFLAGS_RELEASE += -g -fno-omit-frame-pointer -fno-optimize-sibling-calls
+QMAKE_CXXFLAGS_RELEASE += -g -fno-omit-frame-pointer -fno-optimize-sibling-calls
+
+# Work round PowerVR SGX 1.3 driver bug with glScissor & FBOs:
+DEFINES += QT_GL_NO_SCISSOR_TEST
+
+
+load(qt_config)
diff --git a/mkspecs/linux-g++-maemo/qplatformdefs.h b/mkspecs/linux-g++-maemo/qplatformdefs.h
new file mode 100644
index 0000000..857eaf3
--- /dev/null
+++ b/mkspecs/linux-g++-maemo/qplatformdefs.h
@@ -0,0 +1,42 @@
+/****************************************************************************
+**
+** 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 qmake spec 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 "../linux-g++/qplatformdefs.h"
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.cpp b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
index 872ec3c..7e5929e 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.cpp
@@ -477,9 +477,6 @@ void QGraphicsAnchorLayout::removeAt(int index)
return;
// Removing an item affects both horizontal and vertical graphs
- d->restoreSimplifiedGraph(QGraphicsAnchorLayoutPrivate::Horizontal);
- d->restoreSimplifiedGraph(QGraphicsAnchorLayoutPrivate::Vertical);
-
d->removeCenterConstraints(item, QGraphicsAnchorLayoutPrivate::Horizontal);
d->removeCenterConstraints(item, QGraphicsAnchorLayoutPrivate::Vertical);
d->removeAnchors(item);
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout.h b/src/gui/graphicsview/qgraphicsanchorlayout.h
index 01c3a86..063639e 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout.h
@@ -76,6 +76,7 @@ private:
Q_DECLARE_PRIVATE(QGraphicsAnchor)
friend class QGraphicsAnchorLayoutPrivate;
+ friend struct AnchorData;
};
class Q_GUI_EXPORT QGraphicsAnchorLayout : public QGraphicsLayout
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
index 594a205..fb67278 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
@@ -55,14 +55,13 @@ QT_BEGIN_NAMESPACE
QGraphicsAnchorPrivate::QGraphicsAnchorPrivate(int version)
: QObjectPrivate(version), layoutPrivate(0), data(0),
- sizePolicy(QSizePolicy::Fixed)
+ sizePolicy(QSizePolicy::Fixed), preferredSize(0),
+ hasSize(true), reversed(false)
{
}
QGraphicsAnchorPrivate::~QGraphicsAnchorPrivate()
{
- // ###
- layoutPrivate->restoreSimplifiedGraph(QGraphicsAnchorLayoutPrivate::Orientation(data->orientation));
layoutPrivate->removeAnchor(data->from, data->to);
}
@@ -76,31 +75,60 @@ void QGraphicsAnchorPrivate::setSizePolicy(QSizePolicy::Policy policy)
void QGraphicsAnchorPrivate::setSpacing(qreal value)
{
- if (data) {
- layoutPrivate->setAnchorSize(data, &value);
- } else {
+ if (!data) {
qWarning("QGraphicsAnchor::setSpacing: The anchor does not exist.");
+ return;
+ }
+
+ const qreal rawValue = reversed ? -preferredSize : preferredSize;
+ if (hasSize && (rawValue == value))
+ return;
+
+ // The anchor has an user-defined size
+ hasSize = true;
+
+ // The simplex solver cannot handle negative sizes. To workaround that,
+ // if value is less than zero, we reverse the anchor and set the absolute
+ // value;
+ if (value >= 0) {
+ preferredSize = value;
+ if (reversed)
+ qSwap(data->from, data->to);
+ reversed = false;
+ } else {
+ preferredSize = -value;
+ if (!reversed)
+ qSwap(data->from, data->to);
+ reversed = true;
}
+
+ layoutPrivate->q_func()->invalidate();
}
void QGraphicsAnchorPrivate::unsetSpacing()
{
- if (data) {
- layoutPrivate->setAnchorSize(data, 0);
- } else {
+ if (!data) {
qWarning("QGraphicsAnchor::setSpacing: The anchor does not exist.");
+ return;
}
+
+ // Return to standard direction
+ hasSize = false;
+ if (reversed)
+ qSwap(data->from, data->to);
+ reversed = false;
+
+ layoutPrivate->q_func()->invalidate();
}
qreal QGraphicsAnchorPrivate::spacing() const
{
- qreal size = 0;
- if (data) {
- layoutPrivate->anchorSize(data, 0, &size, 0);
- } else {
+ if (!data) {
qWarning("QGraphicsAnchor::setSpacing: The anchor does not exist.");
+ return 0;
}
- return size;
+
+ return reversed ? -preferredSize : preferredSize;
}
@@ -139,22 +167,22 @@ static void internalSizeHints(QSizePolicy::Policy policy,
*prefSize = prefSizeHint;
}
-bool AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
+void AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
{
QSizePolicy::Policy policy;
qreal minSizeHint;
qreal prefSizeHint;
qreal maxSizeHint;
- // It is an internal anchor
if (item) {
+ // It is an internal anchor, fetch size information from the item
if (isLayoutAnchor) {
minSize = 0;
prefSize = 0;
maxSize = QWIDGETSIZE_MAX;
if (isCenterAnchor)
maxSize /= 2;
- return true;
+ return;
} else {
if (orientation == QGraphicsAnchorLayoutPrivate::Horizontal) {
policy = item->sizePolicy().horizontalPolicy();
@@ -175,14 +203,16 @@ bool AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
}
}
} else {
+ // It is a user-created anchor, fetch size information from the associated QGraphicsAnchor
Q_ASSERT(graphicsAnchor);
- policy = graphicsAnchor->sizePolicy();
+ QGraphicsAnchorPrivate *anchorPrivate = graphicsAnchor->d_func();
+ policy = anchorPrivate->sizePolicy;
minSizeHint = 0;
- if (hasSize) {
+ if (anchorPrivate->hasSize) {
// One can only configure the preferred size of a normal anchor. Their minimum and
// maximum "size hints" are always 0 and QWIDGETSIZE_MAX, correspondingly. However,
// their effective size hints might be narrowed down due to their size policies.
- prefSizeHint = prefSize;
+ prefSizeHint = anchorPrivate->preferredSize;
} else {
const Qt::Orientation orient = Qt::Orientation(QGraphicsAnchorLayoutPrivate::edgeOrientation(from->m_edge) + 1);
qreal s = styleInfo->defaultSpacing(orient);
@@ -214,8 +244,6 @@ bool AnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
sizeAtMinimum = prefSize;
sizeAtPreferred = prefSize;
sizeAtMaximum = prefSize;
-
- return true;
}
void ParallelAnchorData::updateChildrenSizes()
@@ -224,8 +252,13 @@ void ParallelAnchorData::updateChildrenSizes()
firstEdge->sizeAtPreferred = sizeAtPreferred;
firstEdge->sizeAtMaximum = sizeAtMaximum;
- const bool secondFwd = (secondEdge->from == from);
- if (secondFwd) {
+ // We have the convention that the first children will define the direction of the
+ // pararell group. So we can check whether the second edge is "forward" in relation
+ // to the group if it have the same direction as the first edge. Note that we don't
+ // use 'this->from' because it might be changed by vertex simplification.
+ const bool secondForward = (firstEdge->from == secondEdge->from);
+
+ if (secondForward) {
secondEdge->sizeAtMinimum = sizeAtMinimum;
secondEdge->sizeAtPreferred = sizeAtPreferred;
secondEdge->sizeAtMaximum = sizeAtMaximum;
@@ -239,26 +272,21 @@ void ParallelAnchorData::updateChildrenSizes()
secondEdge->updateChildrenSizes();
}
-bool ParallelAnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
+bool ParallelAnchorData::calculateSizeHints()
{
- return refreshSizeHints_helper(styleInfo);
-}
-
-bool ParallelAnchorData::refreshSizeHints_helper(const QLayoutStyleInfo *styleInfo,
- bool refreshChildren)
-{
- if (refreshChildren && (!firstEdge->refreshSizeHints(styleInfo)
- || !secondEdge->refreshSizeHints(styleInfo))) {
- return false;
- }
+ // Note that parallel groups can lead to unfeasibility, so during calculation, we can
+ // find out one unfeasibility. Because of that this method return boolean. This can't
+ // happen in sequential, so there the method is void.
// Account for parallel anchors where the second edge is backwards.
// We rely on the fact that a forward anchor of sizes min, pref, max is equivalent
// to a backwards anchor of size (-max, -pref, -min)
- const bool secondFwd = (secondEdge->from == from);
- const qreal secondMin = secondFwd ? secondEdge->minSize : -secondEdge->maxSize;
- const qreal secondPref = secondFwd ? secondEdge->prefSize : -secondEdge->prefSize;
- const qreal secondMax = secondFwd ? secondEdge->maxSize : -secondEdge->minSize;
+
+ // Also see comments in updateChildrenSizes().
+ const bool secondForward = (firstEdge->from == secondEdge->from);
+ const qreal secondMin = secondForward ? secondEdge->minSize : -secondEdge->maxSize;
+ const qreal secondPref = secondForward ? secondEdge->prefSize : -secondEdge->prefSize;
+ const qreal secondMax = secondForward ? secondEdge->maxSize : -secondEdge->minSize;
minSize = qMax(firstEdge->minSize, secondMin);
maxSize = qMin(firstEdge->maxSize, secondMax);
@@ -386,13 +414,7 @@ void SequentialAnchorData::updateChildrenSizes()
}
}
-bool SequentialAnchorData::refreshSizeHints(const QLayoutStyleInfo *styleInfo)
-{
- return refreshSizeHints_helper(styleInfo);
-}
-
-bool SequentialAnchorData::refreshSizeHints_helper(const QLayoutStyleInfo *styleInfo,
- bool refreshChildren)
+void SequentialAnchorData::calculateSizeHints()
{
minSize = 0;
prefSize = 0;
@@ -400,11 +422,6 @@ bool SequentialAnchorData::refreshSizeHints_helper(const QLayoutStyleInfo *style
for (int i = 0; i < m_edges.count(); ++i) {
AnchorData *edge = m_edges.at(i);
-
- // If it's the case refresh children information first
- if (refreshChildren && !edge->refreshSizeHints(styleInfo))
- return false;
-
minSize += edge->minSize;
prefSize += edge->prefSize;
maxSize += edge->maxSize;
@@ -414,8 +431,6 @@ bool SequentialAnchorData::refreshSizeHints_helper(const QLayoutStyleInfo *style
sizeAtMinimum = prefSize;
sizeAtPreferred = prefSize;
sizeAtMaximum = prefSize;
-
- return true;
}
#ifdef QT_DEBUG
@@ -490,7 +505,6 @@ QGraphicsAnchorLayoutPrivate::QGraphicsAnchorLayoutPrivate()
interpolationProgress[i] = -1;
spacings[i] = -1;
- graphSimplified[i] = false;
graphHasConflicts[i] = false;
layoutFirstVertex[i] = 0;
@@ -591,7 +605,7 @@ AnchorData *QGraphicsAnchorLayoutPrivate::addAnchorMaybeParallel(AnchorData *new
// At this point we can identify that the parallel anchor is not feasible, e.g. one
// anchor minimum size is bigger than the other anchor maximum size.
- *feasible = parallel->refreshSizeHints_helper(0, false);
+ *feasible = parallel->calculateSizeHints();
newAnchor = parallel;
}
@@ -652,7 +666,7 @@ static AnchorData *createSequence(Graph<AnchorVertex, AnchorData> *graph,
sequence->from = before;
sequence->to = after;
- sequence->refreshSizeHints_helper(0, false);
+ sequence->calculateSizeHints();
return sequence;
}
@@ -696,16 +710,18 @@ static AnchorData *createSequence(Graph<AnchorVertex, AnchorData> *graph,
*/
bool QGraphicsAnchorLayoutPrivate::simplifyGraph(Orientation orientation)
{
- static bool noSimplification = !qgetenv("QT_ANCHORLAYOUT_NO_SIMPLIFICATION").isEmpty();
- if (noSimplification || items.isEmpty())
+ if (items.isEmpty())
return true;
- if (graphSimplified[orientation])
- return true;
-
-#if 0
+#if defined(QT_DEBUG) && 0
qDebug("Simplifying Graph for %s",
orientation == Horizontal ? "Horizontal" : "Vertical");
+
+ static int count = 0;
+ if (orientation == Horizontal) {
+ count++;
+ dumpGraph(QString::fromAscii("%1-full").arg(count));
+ }
#endif
// Vertex simplification
@@ -723,13 +739,16 @@ bool QGraphicsAnchorLayoutPrivate::simplifyGraph(Orientation orientation)
// Note that if we are not feasible, we fallback and make sure that the graph is fully restored
if (!feasible) {
- graphSimplified[orientation] = true;
restoreSimplifiedGraph(orientation);
restoreVertices(orientation);
return false;
}
- graphSimplified[orientation] = true;
+#if defined(QT_DEBUG) && 0
+ dumpGraph(QString::fromAscii("%1-simplified-%2").arg(count).arg(
+ QString::fromAscii(orientation == Horizontal ? "Horizontal" : "Vertical")));
+#endif
+
return true;
}
@@ -1134,10 +1153,6 @@ void QGraphicsAnchorLayoutPrivate::restoreSimplifiedConstraints(ParallelAnchorDa
void QGraphicsAnchorLayoutPrivate::restoreSimplifiedGraph(Orientation orientation)
{
- if (!graphSimplified[orientation])
- return;
- graphSimplified[orientation] = false;
-
#if 0
qDebug("Restoring Simplified Graph for %s",
orientation == Horizontal ? "Horizontal" : "Vertical");
@@ -1292,19 +1307,17 @@ void QGraphicsAnchorLayoutPrivate::deleteLayoutEdges()
void QGraphicsAnchorLayoutPrivate::createItemEdges(QGraphicsLayoutItem *item)
{
- Q_ASSERT(!graphSimplified[Horizontal] && !graphSimplified[Vertical]);
-
items.append(item);
// 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
+ data->refreshSizeHints();
data = new AnchorData;
addAnchor_helper(item, Qt::AnchorTop, item, Qt::AnchorBottom, data);
- data->refreshSizeHints(0); // 0 = effectiveSpacing, will not be used
+ data->refreshSizeHints();
}
/*!
@@ -1336,8 +1349,6 @@ void QGraphicsAnchorLayoutPrivate::createCenterAnchors(
return;
}
- Q_ASSERT(!graphSimplified[orientation]);
-
// Check if vertex already exists
if (internalVertex(item, centerEdge))
return;
@@ -1366,14 +1377,14 @@ void QGraphicsAnchorLayoutPrivate::createCenterAnchors(
addAnchor_helper(item, firstEdge, item, centerEdge, data);
data->isCenterAnchor = true;
data->dependency = AnchorData::Master;
- data->refreshSizeHints(0);
+ data->refreshSizeHints();
data = new AnchorData;
c->variables.insert(data, -1.0);
addAnchor_helper(item, centerEdge, item, lastEdge, data);
data->isCenterAnchor = true;
data->dependency = AnchorData::Slave;
- data->refreshSizeHints(0);
+ data->refreshSizeHints();
itemCenterConstraints[orientation].append(c);
@@ -1404,8 +1415,6 @@ void QGraphicsAnchorLayoutPrivate::removeCenterAnchors(
return;
}
- Q_ASSERT(!graphSimplified[orientation]);
-
// Orientation code
Qt::AnchorPoint firstEdge;
Qt::AnchorPoint lastEdge;
@@ -1442,7 +1451,7 @@ void QGraphicsAnchorLayoutPrivate::removeCenterAnchors(
// Create the new anchor that should substitute the left-center-right anchors.
AnchorData *data = new AnchorData;
addAnchor_helper(item, firstEdge, item, lastEdge, data);
- data->refreshSizeHints(0);
+ data->refreshSizeHints();
// Remove old anchors
removeAnchor_helper(first, center);
@@ -1473,8 +1482,6 @@ void QGraphicsAnchorLayoutPrivate::removeCenterAnchors(
void QGraphicsAnchorLayoutPrivate::removeCenterConstraints(QGraphicsLayoutItem *item,
Orientation orientation)
{
- Q_ASSERT(!graphSimplified[orientation]);
-
// Remove the item center constraints associated to this item
// ### This is a temporary solution. We should probably use a better
// data structure to hold items and/or their associated constraints
@@ -1505,15 +1512,21 @@ void QGraphicsAnchorLayoutPrivate::removeCenterConstraints(QGraphicsLayoutItem *
/*!
* \internal
+ * Implements the high level "addAnchor" feature. Called by the public API
+ * addAnchor method.
*
- * Helper function that is called from the anchor functions in the public API.
- * If \a spacing is 0, it will pick up the spacing defined by the style.
+ * The optional \a spacing argument defines the size of the anchor. If not provided,
+ * the anchor size is either 0 or not-set, depending on type of anchor created (see
+ * matrix below).
+ *
+ * All anchors that remain with size not-set will assume the standard spacing,
+ * set either by the layout style or through the "setSpacing" layout API.
*/
QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *firstItem,
- Qt::AnchorPoint firstEdge,
- QGraphicsLayoutItem *secondItem,
- Qt::AnchorPoint secondEdge,
- qreal *spacing)
+ Qt::AnchorPoint firstEdge,
+ QGraphicsLayoutItem *secondItem,
+ Qt::AnchorPoint secondEdge,
+ qreal *spacing)
{
Q_Q(QGraphicsAnchorLayout);
if ((firstItem == 0) || (secondItem == 0)) {
@@ -1534,10 +1547,6 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi
return 0;
}
- // Guarantee that the graph is no simplified when adding this anchor,
- // anchor manipulation always happen in the full graph
- restoreSimplifiedGraph(edgeOrientation(firstEdge));
-
// In QGraphicsAnchorLayout, items are represented in its internal
// graph as four anchors that connect:
// - Left -> HCenter
@@ -1547,12 +1556,10 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi
// Ensure that the internal anchors have been created for both items.
if (firstItem != q && !items.contains(firstItem)) {
- restoreSimplifiedGraph(edgeOrientation(firstEdge) == Horizontal ? Vertical : Horizontal);
createItemEdges(firstItem);
addChildLayoutItem(firstItem);
}
if (secondItem != q && !items.contains(secondItem)) {
- restoreSimplifiedGraph(edgeOrientation(firstEdge) == Horizontal ? Vertical : Horizontal);
createItemEdges(secondItem);
addChildLayoutItem(secondItem);
}
@@ -1565,7 +1572,13 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi
correctEdgeDirection(firstItem, firstEdge, secondItem, secondEdge);
AnchorData *data = new AnchorData;
- if (!spacing) {
+ QGraphicsAnchor *graphicsAnchor = acquireGraphicsAnchor(data);
+
+ addAnchor_helper(firstItem, firstEdge, secondItem, secondEdge, data);
+
+ if (spacing) {
+ graphicsAnchor->setSpacing(*spacing);
+ } else {
// 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
// is queried from the style):
@@ -1578,45 +1591,39 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::addAnchor(QGraphicsLayoutItem *fi
|| secondItem == q
|| pickEdge(firstEdge, Horizontal) == Qt::AnchorHorizontalCenter
|| oppositeEdge(firstEdge) != secondEdge) {
- data->setPreferredSize(0);
+ graphicsAnchor->setSpacing(0);
} else {
- data->unsetSize();
+ graphicsAnchor->unsetSpacing();
}
- addAnchor_helper(firstItem, firstEdge, secondItem, secondEdge, data);
-
- } else if (*spacing >= 0) {
- data->setPreferredSize(*spacing);
- addAnchor_helper(firstItem, firstEdge, secondItem, secondEdge, data);
-
- } else {
- data->setPreferredSize(-*spacing);
- addAnchor_helper(secondItem, secondEdge, firstItem, firstEdge, data);
}
- return acquireGraphicsAnchor(data);
+ return graphicsAnchor;
}
+/*
+ \internal
+
+ This method adds an AnchorData to the internal graph. It is responsible for doing
+ the boilerplate part of such task.
+
+ If another AnchorData exists between the mentioned vertices, it is deleted and
+ the new one is inserted.
+*/
void QGraphicsAnchorLayoutPrivate::addAnchor_helper(QGraphicsLayoutItem *firstItem,
- Qt::AnchorPoint firstEdge,
- QGraphicsLayoutItem *secondItem,
- Qt::AnchorPoint secondEdge,
- AnchorData *data)
+ Qt::AnchorPoint firstEdge,
+ QGraphicsLayoutItem *secondItem,
+ Qt::AnchorPoint secondEdge,
+ AnchorData *data)
{
Q_Q(QGraphicsAnchorLayout);
const Orientation orientation = edgeOrientation(firstEdge);
- // Guarantee that the graph is no simplified when adding this anchor,
- // anchor manipulation always happen in the full graph
- restoreSimplifiedGraph(orientation);
-
- // Is the Vertex (firstItem, firstEdge) already represented in our
- // internal structure?
+ // Create or increase the reference count for the related vertices.
AnchorVertex *v1 = addInternalVertex(firstItem, firstEdge);
AnchorVertex *v2 = addInternalVertex(secondItem, secondEdge);
// Remove previous anchor
- // ### Could we update the existing edgeData rather than creating a new one?
if (graph[orientation].edgeData(v1, v2)) {
removeAnchor_helper(v1, v2);
}
@@ -1647,15 +1654,13 @@ QGraphicsAnchor *QGraphicsAnchorLayoutPrivate::getAnchor(QGraphicsLayoutItem *fi
QGraphicsLayoutItem *secondItem,
Qt::AnchorPoint secondEdge)
{
- Orientation orient = edgeOrientation(firstEdge);
- restoreSimplifiedGraph(orient);
-
+ const Orientation orientation = edgeOrientation(firstEdge);
AnchorVertex *v1 = internalVertex(firstItem, firstEdge);
AnchorVertex *v2 = internalVertex(secondItem, secondEdge);
QGraphicsAnchor *graphicsAnchor = 0;
- AnchorData *data = graph[orient].edgeData(v1, v2);
+ AnchorData *data = graph[orientation].edgeData(v1, v2);
if (data)
graphicsAnchor = acquireGraphicsAnchor(data);
return graphicsAnchor;
@@ -1740,12 +1745,9 @@ void QGraphicsAnchorLayoutPrivate::removeAnchor(AnchorVertex *firstVertex,
void QGraphicsAnchorLayoutPrivate::removeAnchor_helper(AnchorVertex *v1, AnchorVertex *v2)
{
Q_ASSERT(v1 && v2);
- // Guarantee that the graph is no simplified when removing this anchor,
- // anchor manipulation always happen in the full graph
- Orientation o = edgeOrientation(v1->m_edge);
- restoreSimplifiedGraph(o);
// Remove edge from graph
+ const Orientation o = edgeOrientation(v1->m_edge);
graph[o].removeEdge(v1, v2);
// Decrease vertices reference count (may trigger a deletion)
@@ -1753,67 +1755,6 @@ void QGraphicsAnchorLayoutPrivate::removeAnchor_helper(AnchorVertex *v1, AnchorV
removeInternalVertex(v2->m_item, v2->m_edge);
}
-/*!
- \internal
- Only called from outside. (calls invalidate())
-*/
-void QGraphicsAnchorLayoutPrivate::setAnchorSize(AnchorData *data, const qreal *anchorSize)
-{
- Q_Q(QGraphicsAnchorLayout);
- // ### we can avoid restoration if we really want to, but we would have to
- // search recursively through all composite anchors
- Q_ASSERT(data);
- restoreSimplifiedGraph(edgeOrientation(data->from->m_edge));
-
- QGraphicsLayoutItem *firstItem = data->from->m_item;
- QGraphicsLayoutItem *secondItem = data->to->m_item;
- Qt::AnchorPoint firstEdge = data->from->m_edge;
- Qt::AnchorPoint secondEdge = data->to->m_edge;
-
- // Use heuristics to find out what the user meant with this anchor.
- correctEdgeDirection(firstItem, firstEdge, secondItem, secondEdge);
- if (data->from->m_item != firstItem)
- qSwap(data->from, data->to);
-
- if (anchorSize) {
- // ### The current implementation makes "setAnchorSize" behavior
- // dependent on the argument order for cases where we have
- // no heuristic. Ie. two widgets, same anchor point.
-
- // We cannot have negative sizes inside the graph. This would cause
- // the simplex solver to fail because all simplex variables are
- // positive by definition.
- // "negative spacing" is handled by inverting the standard item order.
- if (*anchorSize >= 0) {
- data->setPreferredSize(*anchorSize);
- } else {
- data->setPreferredSize(-*anchorSize);
- qSwap(data->from, data->to);
- }
- } else {
- data->unsetSize();
- }
- q->invalidate();
-}
-
-void QGraphicsAnchorLayoutPrivate::anchorSize(const AnchorData *data,
- qreal *minSize,
- qreal *prefSize,
- qreal *maxSize) const
-{
- Q_ASSERT(minSize || prefSize || maxSize);
- Q_ASSERT(data);
- QGraphicsAnchorLayoutPrivate *that = const_cast<QGraphicsAnchorLayoutPrivate *>(this);
- that->restoreSimplifiedGraph(Orientation(data->orientation));
-
- if (minSize)
- *minSize = data->minSize;
- if (prefSize)
- *prefSize = data->prefSize;
- if (maxSize)
- *maxSize = data->maxSize;
-}
-
AnchorVertex *QGraphicsAnchorLayoutPrivate::addInternalVertex(QGraphicsLayoutItem *item,
Qt::AnchorPoint edge)
{
@@ -1879,8 +1820,6 @@ void QGraphicsAnchorLayoutPrivate::removeVertex(QGraphicsLayoutItem *item, Qt::A
void QGraphicsAnchorLayoutPrivate::removeAnchors(QGraphicsLayoutItem *item)
{
- Q_ASSERT(!graphSimplified[Horizontal] && !graphSimplified[Vertical]);
-
// remove the center anchor first!!
removeCenterAnchors(item, Qt::AnchorHorizontalCenter, false);
removeVertex(item, Qt::AnchorLeft);
@@ -1983,20 +1922,8 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs()
{
if (!calculateGraphCacheDirty)
return;
-
-#if defined(QT_DEBUG) && 0
- static int count = 0;
- count++;
- dumpGraph(QString::fromAscii("%1-before").arg(count));
-#endif
-
calculateGraphs(Horizontal);
calculateGraphs(Vertical);
-
-#if defined(QT_DEBUG) && 0
- dumpGraph(QString::fromAscii("%1-after").arg(count));
-#endif
-
calculateGraphCacheDirty = false;
}
@@ -2044,26 +1971,13 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs(
lastCalculationUsedSimplex[orientation] = false;
#endif
- // ### This is necessary because now we do vertex simplification, we still don't know
- // differentiate between invalidate()s that doesn't need resimplification and those which
- // need. For example, when size hint of an item changes, this may cause an anchor to reach 0 or to
- // leave 0 and get a size. In both cases we need resimplify.
- //
- // ### one possible solution would be tracking all the 0-sized anchors, if this set change, we need
- // resimplify.
- restoreSimplifiedGraph(orientation);
-
- // Reset the nominal sizes of each anchor based on the current item sizes. This function
- // works with both simplified and non-simplified graphs, so it'll work when the
- // simplification is going to be reused.
- if (!refreshAllSizeHints(orientation)) {
- qWarning("QGraphicsAnchorLayout: anchor setup is not feasible.");
- graphHasConflicts[orientation] = true;
- return;
- }
+ static bool simplificationEnabled = qgetenv("QT_ANCHORLAYOUT_NO_SIMPLIFICATION").isEmpty();
+
+ // Reset the nominal sizes of each anchor based on the current item sizes
+ refreshAllSizeHints(orientation);
// Simplify the graph
- if (!simplifyGraph(orientation)) {
+ if (simplificationEnabled && !simplifyGraph(orientation)) {
qWarning("QGraphicsAnchorLayout: anchor setup is not feasible.");
graphHasConflicts[orientation] = true;
return;
@@ -2127,6 +2041,9 @@ void QGraphicsAnchorLayoutPrivate::calculateGraphs(
qDeleteAll(constraints[orientation]);
constraints[orientation].clear();
graphPaths[orientation].clear(); // ###
+
+ if (simplificationEnabled)
+ restoreSimplifiedGraph(orientation);
}
/*!
@@ -2226,29 +2143,19 @@ bool QGraphicsAnchorLayoutPrivate::calculateNonTrunk(const QList<QSimplexConstra
/*!
\internal
- Traverse the graph refreshing the size hints. Complex anchors will call the
- refresh method of their children anchors. Simple anchors, if are internal
- anchors, will query the associated item for their size hints.
-
- Returns false if some unfeasibility was found in the graph regarding the
- complex anchors.
+ Traverse the graph refreshing the size hints. Edges will query their associated
+ item or graphicsAnchor for their size hints.
*/
-bool QGraphicsAnchorLayoutPrivate::refreshAllSizeHints(Orientation orientation)
+void QGraphicsAnchorLayoutPrivate::refreshAllSizeHints(Orientation orientation)
{
Graph<AnchorVertex, AnchorData> &g = graph[orientation];
QList<QPair<AnchorVertex *, AnchorVertex *> > vertices = g.connections();
QLayoutStyleInfo styleInf = styleInfo();
for (int i = 0; i < vertices.count(); ++i) {
- AnchorData *data = g.edgeData(vertices.at(i).first, vertices.at(i).second);;
- Q_ASSERT(data->from && data->to);
-
- // During the traversal we check the feasibility of the complex anchors.
- if (!data->refreshSizeHints(&styleInf))
- return false;
+ AnchorData *data = g.edgeData(vertices.at(i).first, vertices.at(i).second);
+ data->refreshSizeHints(&styleInf);
}
-
- return true;
}
/*!
@@ -2621,21 +2528,6 @@ void QGraphicsAnchorLayoutPrivate::setItemsGeometries(const QRectF &geom)
}
/*!
- \internal
-
- Fill the distance in the vertex and in the sub-vertices if its a combined vertex.
-*/
-static void setVertexDistance(AnchorVertex *v, qreal distance)
-{
- v->distance = distance;
- if (v->m_type == AnchorVertex::Pair) {
- AnchorVertexPair *pair = static_cast<AnchorVertexPair *>(v);
- setVertexDistance(pair->m_first, distance);
- setVertexDistance(pair->m_second, distance);
- }
-}
-
-/*!
\internal
Calculate the position of each vertex based on the paths to each of
@@ -2650,7 +2542,7 @@ void QGraphicsAnchorLayoutPrivate::calculateVertexPositions(
// Get root vertex
AnchorVertex *root = layoutFirstVertex[orientation];
- setVertexDistance(root, 0);
+ root->distance = 0;
visited.insert(root);
// Add initial edges to the queue
@@ -2661,16 +2553,12 @@ void QGraphicsAnchorLayoutPrivate::calculateVertexPositions(
// Do initial calculation required by "interpolateEdge()"
setupEdgesInterpolation(orientation);
- // Traverse the graph and calculate vertex positions, we need to
- // visit all pairs since each of them could have a sequential
- // anchor inside, which hides more vertices.
+ // Traverse the graph and calculate vertex positions
while (!queue.isEmpty()) {
QPair<AnchorVertex *, AnchorVertex *> pair = queue.dequeue();
AnchorData *edge = graph[orientation].edgeData(pair.first, pair.second);
- // Both vertices were interpolated, and the anchor itself can't have other
- // anchors inside (it's not a complex anchor).
- if (edge->type == AnchorData::Normal && visited.contains(pair.second))
+ if (visited.contains(pair.second))
continue;
visited.insert(pair.second);
@@ -2710,24 +2598,20 @@ 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 the layout is at its:
+ \internal
- - minimum size,
- - preferred size,
- - maximum size.
+ Calculate the current Edge size based on the current Layout size and the
+ size the edge is supposed to have when the layout is at its:
- These three key values are calculated in advance using linear
- programming (more expensive) or the simplification algorithm, then
- subsequential resizes of the parent layout require a simple
- interpolation.
+ - minimum size,
+ - preferred size,
+ - maximum size.
- If the edge is sequential or parallel, it's possible to have more
- vertices to be initalized, so it calls specialized functions that
- will recurse back to interpolateEdge().
- */
+ These three key values are calculated in advance using linear
+ programming (more expensive) or the simplification algorithm, then
+ subsequential resizes of the parent layout require a simple
+ interpolation.
+*/
void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base, AnchorData *edge)
{
const Orientation orientation = Orientation(edge->orientation);
@@ -2741,64 +2625,10 @@ void QGraphicsAnchorLayoutPrivate::interpolateEdge(AnchorVertex *base, AnchorDat
// Calculate the distance for the vertex opposite to the base
if (edge->from == base) {
- setVertexDistance(edge->to, base->distance + edgeDistance);
+ edge->to->distance = base->distance + edgeDistance;
} else {
- setVertexDistance(edge->from, base->distance - edgeDistance);
- }
-
- // Process child anchors
- if (edge->type == AnchorData::Sequential)
- interpolateSequentialEdges(static_cast<SequentialAnchorData *>(edge));
- else if (edge->type == AnchorData::Parallel)
- interpolateParallelEdges(static_cast<ParallelAnchorData *>(edge));
-}
-
-void QGraphicsAnchorLayoutPrivate::interpolateParallelEdges(ParallelAnchorData *data)
-{
- // In parallels the boundary vertices are already calculate, we
- // just need to look for sequential groups inside, because only
- // them may have new vertices associated.
-
- // First edge
- if (data->firstEdge->type == AnchorData::Sequential)
- interpolateSequentialEdges(static_cast<SequentialAnchorData *>(data->firstEdge));
- else if (data->firstEdge->type == AnchorData::Parallel)
- interpolateParallelEdges(static_cast<ParallelAnchorData *>(data->firstEdge));
-
- // Second edge
- if (data->secondEdge->type == AnchorData::Sequential)
- interpolateSequentialEdges(static_cast<SequentialAnchorData *>(data->secondEdge));
- else if (data->secondEdge->type == AnchorData::Parallel)
- interpolateParallelEdges(static_cast<ParallelAnchorData *>(data->secondEdge));
-}
-
-void QGraphicsAnchorLayoutPrivate::interpolateSequentialEdges(SequentialAnchorData *data)
-{
- // This method is supposed to handle any sequential anchor, even out-of-order
- // ones. However, in the current QGAL implementation we should get only the
- // well behaved ones.
- Q_ASSERT(data->m_edges.first()->from == data->from);
- Q_ASSERT(data->m_edges.last()->to == data->to);
-
- // At this point, the two outter vertices already have their distance
- // calculated.
- // We use the first as the base to calculate the internal ones
-
- AnchorVertex *prev = data->from;
-
- for (int i = 0; i < data->m_edges.count() - 1; ++i) {
- AnchorData *edge = data->m_edges.at(i);
- interpolateEdge(prev, edge);
-
- // Use the recently calculated vertex as the base for the next one
- const bool edgeIsForward = (edge->from == prev);
- prev = edgeIsForward ? edge->to : edge->from;
+ edge->from->distance = base->distance - edgeDistance;
}
-
- // Treat the last specially, since we already calculated it's end
- // vertex, so it's only interesting if it's a complex one
- if (data->m_edges.last()->type != AnchorData::Normal)
- interpolateEdge(prev, data->m_edges.last());
}
bool QGraphicsAnchorLayoutPrivate::solveMinMax(const QList<QSimplexConstraint *> &constraints,
diff --git a/src/gui/graphicsview/qgraphicsanchorlayout_p.h b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
index 5f50c85..2b365fb 100644
--- a/src/gui/graphicsview/qgraphicsanchorlayout_p.h
+++ b/src/gui/graphicsview/qgraphicsanchorlayout_p.h
@@ -121,17 +121,17 @@ struct AnchorData : public QSimplexVariable {
};
AnchorData()
- : QSimplexVariable(), item(0), from(0), to(0),
+ : QSimplexVariable(), from(0), to(0),
minSize(0), prefSize(0), maxSize(0),
sizeAtMinimum(0), sizeAtPreferred(0),
- sizeAtMaximum(0),
+ sizeAtMaximum(0), item(0),
graphicsAnchor(0), skipInPreferred(0),
- type(Normal), hasSize(true), isLayoutAnchor(false),
+ type(Normal), isLayoutAnchor(false),
isCenterAnchor(false), orientation(0),
dependency(Independent) {}
virtual void updateChildrenSizes() {}
- virtual bool refreshSizeHints(const QLayoutStyleInfo *styleInfo);
+ void refreshSizeHints(const QLayoutStyleInfo *styleInfo = 0);
virtual ~AnchorData() {}
@@ -141,43 +141,36 @@ struct AnchorData : public QSimplexVariable {
QString name;
#endif
- inline void setPreferredSize(qreal size)
- {
- prefSize = size;
- hasSize = true;
- }
-
- inline void unsetSize()
- {
- hasSize = false;
- }
-
- // Internal anchors have associated items
- QGraphicsLayoutItem *item;
-
// Anchor is semantically directed
AnchorVertex *from;
AnchorVertex *to;
- // Size restrictions of this edge. For anchors internal to items, these
- // values are derived from the respective item size hints. For anchors
- // that were added by users, these values are equal to the specified anchor
- // size.
+ // Nominal sizes
+ // These are the intrinsic size restrictions for a given item. They are
+ // used as input for the calculation of the actual sizes.
+ // These values are filled by the refreshSizeHints method, based on the
+ // anchor size policy, the size hints of the item it (possibly) represents
+ // and the layout spacing information.
qreal minSize;
qreal prefSize;
qreal maxSize;
+ // Calculated sizes
// These attributes define which sizes should that anchor be in when the
// layout is at its minimum, preferred or maximum sizes. Values are
// calculated by the Simplex solver based on the current layout setup.
qreal sizeAtMinimum;
qreal sizeAtPreferred;
qreal sizeAtMaximum;
+
+ // References to the classes that represent this anchor in the public world
+ // An anchor may represent a LayoutItem, it may also be acessible externally
+ // through a GraphicsAnchor "handler".
+ QGraphicsLayoutItem *item;
QGraphicsAnchor *graphicsAnchor;
uint skipInPreferred : 1;
uint type : 2; // either Normal, Sequential or Parallel
- uint hasSize : 1; // if false, get size from style.
uint isLayoutAnchor : 1; // if this anchor is an internal layout anchor
uint isCenterAnchor : 1;
uint orientation : 1;
@@ -204,9 +197,7 @@ struct SequentialAnchorData : public AnchorData
}
virtual void updateChildrenSizes();
- virtual bool refreshSizeHints(const QLayoutStyleInfo *styleInfo);
-
- bool refreshSizeHints_helper(const QLayoutStyleInfo *styleInfo, bool refreshChildren = true);
+ void calculateSizeHints();
QVector<AnchorVertex*> m_children; // list of vertices in the sequence
QVector<AnchorData*> m_edges; // keep the list of edges too.
@@ -233,9 +224,7 @@ struct ParallelAnchorData : public AnchorData
}
virtual void updateChildrenSizes();
- virtual bool refreshSizeHints(const QLayoutStyleInfo *styleInfo);
-
- bool refreshSizeHints_helper(const QLayoutStyleInfo *styleInfo, bool refreshChildren = true);
+ bool calculateSizeHints();
AnchorData* firstEdge;
AnchorData* secondEdge;
@@ -350,7 +339,13 @@ public:
QGraphicsAnchorLayoutPrivate *layoutPrivate;
AnchorData *data;
+
+ // Size information for user controlled anchor
QSizePolicy::Policy sizePolicy;
+ qreal preferredSize;
+
+ uint hasSize : 1; // if false, get size from style.
+ uint reversed : 1; // if true, the anchor was inverted to keep its value positive
};
@@ -445,11 +440,6 @@ public:
void removeAnchor(AnchorVertex *firstVertex, AnchorVertex *secondVertex);
void removeAnchor_helper(AnchorVertex *v1, AnchorVertex *v2);
- void setAnchorSize(AnchorData *data, const qreal *anchorSize);
- void anchorSize(const AnchorData *data,
- qreal *minSize = 0,
- qreal *prefSize = 0,
- qreal *maxSize = 0) const;
void removeAnchors(QGraphicsLayoutItem *item);
@@ -489,7 +479,7 @@ public:
const QList<AnchorData *> &variables);
// Support functions for calculateGraph()
- bool refreshAllSizeHints(Orientation orientation);
+ void refreshAllSizeHints(Orientation orientation);
void findPaths(Orientation orientation);
void constraintsFromPaths(Orientation orientation);
void updateAnchorSizes(Orientation orientation);
@@ -528,8 +518,6 @@ public:
void calculateVertexPositions(Orientation orientation);
void setupEdgesInterpolation(Orientation orientation);
void interpolateEdge(AnchorVertex *base, AnchorData *edge);
- void interpolateSequentialEdges(SequentialAnchorData *edge);
- void interpolateParallelEdges(ParallelAnchorData *edge);
// Linear Programming solver methods
bool solveMinMax(const QList<QSimplexConstraint *> &constraints,
@@ -576,8 +564,6 @@ public:
Interval interpolationInterval[2];
qreal interpolationProgress[2];
- // ###
- bool graphSimplified[2];
bool graphHasConflicts[2];
QSet<QGraphicsLayoutItem *> m_floatItems[2];
diff --git a/src/gui/image/qpixmap_x11.cpp b/src/gui/image/qpixmap_x11.cpp
index 3f297df..7008fbd 100644
--- a/src/gui/image/qpixmap_x11.cpp
+++ b/src/gui/image/qpixmap_x11.cpp
@@ -416,6 +416,11 @@ void QX11PixmapData::fromImage(const QImage &img,
d = img.depth();
is_null = (w <= 0 || h <= 0);
+ if (is_null) {
+ w = h = 0;
+ return;
+ }
+
if (defaultScreen >= 0 && defaultScreen != xinfo.screen()) {
QX11InfoData* xd = xinfo.getX11Data(true);
xd->screen = defaultScreen;
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index c6e02a6..2e4a602 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -730,13 +730,14 @@ void QItemSelectionModelPrivate::_q_layoutAboutToBeChanged()
savedPersistentIndexes.clear();
savedPersistentCurrentIndexes.clear();
- // special case for when all indexes are selected
+ // optimisation for when all indexes are selected
+ // (only if there is lots of items (1000) because this is not entirely correct)
if (ranges.isEmpty() && currentSelection.count() == 1) {
QItemSelectionRange range = currentSelection.first();
QModelIndex parent = range.parent();
tableRowCount = model->rowCount(parent);
tableColCount = model->columnCount(parent);
- if (tableRowCount * tableColCount > 100
+ if (tableRowCount * tableColCount > 1000
&& range.top() == 0
&& range.left() == 0
&& range.bottom() == tableRowCount - 1
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 04e4b31..c7f0c00 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -323,7 +323,6 @@ QSymbianControl::QSymbianControl(QWidget *w)
, qwidget(w)
, m_longTapDetector(0)
, m_ignoreFocusChanged(0)
- , m_previousEventLongTap(0)
, m_symbianPopupIsOpen(0)
{
}
@@ -362,9 +361,6 @@ QSymbianControl::~QSymbianControl()
setFocusSafely(false);
S60->appUi()->RemoveFromStack(this);
delete m_longTapDetector;
-
- if(m_previousEventLongTap)
- QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons & ~Qt::RightButton;
}
void QSymbianControl::setWidget(QWidget *w)
@@ -379,19 +375,11 @@ void QSymbianControl::HandleLongTapEventL( const TPoint& aPenEventLocation, cons
alienWidget = qwidget->childAt(widgetPos);
if (!alienWidget)
alienWidget = qwidget;
- QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons &(~Qt::LeftButton);
- QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons | Qt::RightButton;
- QMouseEvent mEvent(QEvent::MouseButtonPress, alienWidget->mapFrom(qwidget, widgetPos), globalPos,
- Qt::RightButton, QApplicationPrivate::mouse_buttons, Qt::NoModifier);
-
- bool res = sendMouseEvent(alienWidget, &mEvent);
#if !defined(QT_NO_CONTEXTMENU)
- QContextMenuEvent contextMenuEvent(QContextMenuEvent::Mouse, widgetPos, globalPos, mEvent.modifiers());
+ QContextMenuEvent contextMenuEvent(QContextMenuEvent::Mouse, widgetPos, globalPos, Qt::NoModifier);
qt_sendSpontaneousEvent(alienWidget, &contextMenuEvent);
#endif
-
- m_previousEventLongTap = true;
}
#ifdef QT_SYMBIAN_SUPPORTS_ADVANCED_POINTER
@@ -515,12 +503,6 @@ void QSymbianControl::HandlePointerEvent(const TPointerEvent& pEvent)
mapS60MouseEventTypeToQt(&type, &button, &pEvent);
Qt::KeyboardModifiers modifiers = mapToQtModifiers(pEvent.iModifiers);
- if (m_previousEventLongTap)
- if (type == QEvent::MouseButtonRelease){
- button = Qt::RightButton;
- QApplicationPrivate::mouse_buttons = QApplicationPrivate::mouse_buttons & ~Qt::RightButton;
- m_previousEventLongTap = false;
- }
if (type == QMouseEvent::None)
return;
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index ec8c9cb..08f8bb5 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -204,7 +204,6 @@ private:
QWidget *qwidget;
QLongTapTimer* m_longTapDetector;
bool m_ignoreFocusChanged : 1;
- bool m_previousEventLongTap : 1;
bool m_symbianPopupIsOpen : 1;
#ifdef Q_WS_S60
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 629af8f..b1c37d3 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -213,6 +213,15 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
if ((q->windowType() == Qt::Desktop))
return;
+
+ QPoint oldPos(q->pos());
+ QSize oldSize(q->size());
+ QRect oldGeom(data.crect);
+
+ // Lose maximized status if deliberate resize
+ if (w != oldSize.width() || h != oldSize.height())
+ data.window_state &= ~Qt::WindowMaximized;
+
if (extra) { // any size restrictions?
w = qMin(w,extra->maxw);
h = qMin(h,extra->maxh);
@@ -228,17 +237,10 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
data.window_state = s;
}
- QPoint oldPos(q->pos());
- QSize oldSize(q->size());
- QRect oldGeom(data.crect);
-
bool isResize = w != oldSize.width() || h != oldSize.height();
if (!isMove && !isResize)
return;
- if (isResize)
- data.window_state &= ~Qt::WindowMaximized;
-
if (q->isWindow()) {
if (w == 0 || h == 0) {
q->setAttribute(Qt::WA_OutsideWSRange, true);
diff --git a/src/gui/painting/qpaintbuffer_p.h b/src/gui/painting/qpaintbuffer_p.h
index adf0564..e100512 100644
--- a/src/gui/painting/qpaintbuffer_p.h
+++ b/src/gui/painting/qpaintbuffer_p.h
@@ -66,7 +66,7 @@ class QPaintBufferPlayback;
class Q_GUI_EXPORT QPaintBuffer : public QPaintDevice
{
- Q_DECLARE_PRIVATE(QPaintBuffer);
+ Q_DECLARE_PRIVATE(QPaintBuffer)
public:
QPaintBuffer();
QPaintBuffer(const QPaintBuffer &other);
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index df4b87e..7c3e11f 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -668,7 +668,7 @@ void QS60StylePrivate::setThemePalette(QPalette *palette) const
s60Color(QS60StyleEnums::CL_QsnTextColors, 55, 0));
palette->setColor(QPalette::BrightText, palette->color(QPalette::WindowText).lighter());
palette->setColor(QPalette::HighlightedText,
- s60Color(QS60StyleEnums::CL_QsnTextColors, 10, 0));
+ s60Color(QS60StyleEnums::CL_QsnTextColors, 24, 0));
palette->setColor(QPalette::Link,
s60Color(QS60StyleEnums::CL_QsnHighlightColors, 3, 0));
palette->setColor(QPalette::LinkVisited, palette->color(QPalette::Link).darker());
@@ -783,6 +783,14 @@ void QS60StylePrivate::setThemePaletteHash(QPalette *palette) const
widgetPalette.setBrush(QPalette::Window, QBrush());
QApplication::setPalette(widgetPalette, "QScrollArea");
widgetPalette = *palette;
+
+ //Webpages should not use S60 theme colors as they are designed to work
+ //with themeBackground and do not generally mesh well with web page backgrounds.
+ QPalette webPalette = *palette;
+ webPalette.setColor(QPalette::WindowText, Qt::black);
+ webPalette.setColor(QPalette::Text, Qt::black);
+ QApplication::setPalette(webPalette, "QWebView");
+ QApplication::setPalette(webPalette, "QGraphicsWebView");
}
QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlags flags)
@@ -2007,7 +2015,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
buttonRect.adjust(0,-newY,0,-newY);
painter->save();
- QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnIconColors, 13, option);
+ QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnTextColors, 6, option);
QColor buttonTextColor = option->palette.buttonText().color();
if (themeColor != buttonTextColor)
painter->setPen(buttonTextColor);
diff --git a/src/gui/text/qtextdocument_p.cpp b/src/gui/text/qtextdocument_p.cpp
index 2ad6512..18e1ffc 100644
--- a/src/gui/text/qtextdocument_p.cpp
+++ b/src/gui/text/qtextdocument_p.cpp
@@ -1114,9 +1114,11 @@ void QTextDocumentPrivate::endEditBlock()
return;
if (undoEnabled && undoState > 0) {
+ const bool wasBlocking = !undoStack[undoState - 1].block_end;
if (undoStack[undoState - 1].block_part) {
undoStack[undoState - 1].block_end = true;
- emit document()->undoCommandAdded();
+ if (wasBlocking)
+ emit document()->undoCommandAdded();
}
}
diff --git a/src/gui/widgets/qdockarealayout.cpp b/src/gui/widgets/qdockarealayout.cpp
index 953edab..07914b2 100644
--- a/src/gui/widgets/qdockarealayout.cpp
+++ b/src/gui/widgets/qdockarealayout.cpp
@@ -1931,9 +1931,6 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
item_list.append(item);
} else {
QDockAreaLayoutItem item(new QDockWidgetItem(widget));
- if (!testing) {
- item_list.append(item);
- }
if (flags & StateFlagFloating) {
bool drawer = false;
#ifdef Q_WS_MAC // drawer support
@@ -1971,11 +1968,13 @@ bool QDockAreaLayoutInfo::restoreState(QDataStream &stream, QList<QDockWidget*>
if (!testing) {
widget->setVisible(flags & StateFlagVisible);
+ item_list.append(item);
}
} else {
int dummy;
stream >> item.pos >> item.size >> dummy >> dummy;
if (!testing) {
+ item_list.append(item);
widget->setFloating(false);
widget->setVisible(flags & StateFlagVisible);
emit widget->dockLocationChanged(toDockWidgetArea(dockPos));
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index f5dbe1c..9372ddd 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1594,7 +1594,9 @@ void QLineEdit::keyPressEvent(QKeyEvent *event)
&& !isReadOnly())
{
setEditFocus(true);
+#ifndef Q_OS_SYMBIAN
clear();
+#endif
} else {
event->ignore();
return;
@@ -1651,7 +1653,9 @@ void QLineEdit::inputMethodEvent(QInputMethodEvent *e)
&& hasFocus() && !hasEditFocus()
&& !e->preeditString().isEmpty()) {
setEditFocus(true);
+#ifndef Q_OS_SYMBIAN
selectAll(); // so text is replaced rather than appended to
+#endif
}
#endif
diff --git a/src/gui/widgets/qtextedit.cpp b/src/gui/widgets/qtextedit.cpp
index 88502e3..14de719 100644
--- a/src/gui/widgets/qtextedit.cpp
+++ b/src/gui/widgets/qtextedit.cpp
@@ -1210,7 +1210,9 @@ void QTextEdit::keyPressEvent(QKeyEvent *e)
if (!hasEditFocus() && !(e->modifiers() & Qt::ControlModifier)) {
if (e->text()[0].isPrint()) {
setEditFocus(true);
+#ifndef Q_OS_SYMBIAN
clear();
+#endif
} else {
e->ignore();
return;
@@ -1672,7 +1674,9 @@ void QTextEdit::inputMethodEvent(QInputMethodEvent *e)
&& QApplication::keypadNavigationEnabled()
&& !hasEditFocus()) {
setEditFocus(true);
+#ifndef Q_OS_SYMBIAN
selectAll(); // so text is replaced rather than appended to
+#endif
}
#endif
d->sendControlEvent(e);
diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
index 1163eba..1478b09 100644
--- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
+++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp
@@ -61,6 +61,9 @@ void QTriangulatingStroker::endCapOrJoinClosed(const qreal *start, const qreal *
} else {
endCap(cur);
}
+ int count = m_vertices.size();
+ m_vertices.add(m_vertices.at(count-2));
+ m_vertices.add(m_vertices.at(count-1));
}
@@ -144,7 +147,6 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen)
bool endsAtStart = startPts[0] == *(endPts-2) && startPts[1] == *(endPts-1);
- Qt::PenCapStyle cap = m_cap_style;
if (endsAtStart || path.hasImplicitClose())
m_cap_style = Qt::FlatCap;
moveTo(pts);
@@ -166,7 +168,7 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen)
switch (*types) {
case QPainterPath::MoveToElement: {
if (pts != path.points())
- endCapOrJoinClosed(startPts, pts, path.hasImplicitClose(), endsAtStart);
+ endCapOrJoinClosed(startPts, pts-2, path.hasImplicitClose(), endsAtStart);
startPts = pts;
int end = (endPts - pts) / 2;
@@ -244,8 +246,6 @@ void QTriangulatingStroker::cubicTo(const qreal *pts)
m_nvy = vy;
}
-
-
static void qdashprocessor_moveTo(qreal x, qreal y, void *data)
{
((QDashedStrokeProcessor *) data)->addElement(QPainterPath::MoveToElement, x, y);
@@ -279,12 +279,12 @@ void QDashedStrokeProcessor::process(const QVectorPath &path, const QPen &pen)
m_points.reset();
m_types.reset();
- qreal width = pen.width();
+ qreal width = qpen_widthf(pen);
if (width == 0)
width = 1;
m_dash_stroker.setDashPattern(pen.dashPattern());
- m_dash_stroker.setStrokeWidth(width);
+ m_dash_stroker.setStrokeWidth(pen.isCosmetic() ? width * m_inv_scale : width);
m_dash_stroker.setMiterLimit(pen.miterLimit());
qreal curvyness = sqrt(width) * m_inv_scale / 8;
diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h
index defa3f1..a0117d5 100644
--- a/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h
+++ b/src/opengl/gl2paintengineex/qtriangulatingstroker_p.h
@@ -188,10 +188,6 @@ inline void QTriangulatingStroker::endCap(const qreal *pts)
break;
default: break; // to shut gcc up...
}
-
- int count = m_vertices.size();
- m_vertices.add(m_vertices.at(count-2));
- m_vertices.add(m_vertices.at(count-1));
}
diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp
index 8063fc8..f8a2ea4 100644
--- a/src/opengl/qgl.cpp
+++ b/src/opengl/qgl.cpp
@@ -3030,7 +3030,7 @@ void QGLContext::setValid(bool valid)
bool QGLContext::isSharing() const
{
Q_D(const QGLContext);
- return d->sharing;
+ return d->group->isSharing();
}
QGLFormat QGLContext::format() const
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 9a17c67..45b2942 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -233,6 +233,7 @@ public:
QGLExtensionFuncs &extensionFuncs() {return m_extensionFuncs;}
const QGLContext *context() const {return m_context;}
+ bool isSharing() const { return m_shares.size() >= 2; }
void addGuard(QGLSharedResourceGuard *guard);
void removeGuard(QGLSharedResourceGuard *guard);
diff --git a/src/opengl/qglpixelbuffer_egl.cpp b/src/opengl/qglpixelbuffer_egl.cpp
index 744fbd4..de08655 100644
--- a/src/opengl/qglpixelbuffer_egl.cpp
+++ b/src/opengl/qglpixelbuffer_egl.cpp
@@ -72,37 +72,53 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
return false;
}
+ // Find the shared context.
+ QEglContext *shareContext = 0;
+ if (shareWidget && shareWidget->d_func()->glcx)
+ shareContext = shareWidget->d_func()->glcx->d_func()->eglContext;
+
// Choose an appropriate configuration. We use the best format
// we can find, even if it is greater than the requested format.
// We try for a pbuffer that is capable of texture rendering if possible.
- QEglProperties configProps;
- qt_egl_set_format(configProps, QInternal::Pbuffer, f);
- configProps.setRenderableType(ctx->api());
- bool ok = false;
+ textureFormat = EGL_NONE;
+ if (shareContext) {
+ // Use the same configuration as the widget we are sharing with.
+ ctx->setConfig(shareContext->config());
+#if QGL_RENDER_TEXTURE
+ EGLint value = EGL_FALSE;
+ if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGBA, &value) && value)
+ textureFormat = EGL_TEXTURE_RGBA;
+ else if (ctx->configAttrib(EGL_BIND_TO_TEXTURE_RGB, &value) && value)
+ textureFormat = EGL_TEXTURE_RGB;
+#endif
+ } else {
+ QEglProperties configProps;
+ qt_egl_set_format(configProps, QInternal::Pbuffer, f);
+ configProps.setRenderableType(ctx->api());
+ bool ok = false;
#if QGL_RENDER_TEXTURE
- textureFormat = EGL_TEXTURE_RGBA;
- configProps.setValue(EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE);
- ok = ctx->chooseConfig(configProps, QEgl::BestPixelFormat);
- if (!ok) {
- // Try again with RGB texture rendering.
- textureFormat = EGL_TEXTURE_RGB;
- configProps.removeValue(EGL_BIND_TO_TEXTURE_RGBA);
- configProps.setValue(EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE);
+ textureFormat = EGL_TEXTURE_RGBA;
+ configProps.setValue(EGL_BIND_TO_TEXTURE_RGBA, EGL_TRUE);
ok = ctx->chooseConfig(configProps, QEgl::BestPixelFormat);
if (!ok) {
- // One last try for a pbuffer with no texture rendering.
- configProps.removeValue(EGL_BIND_TO_TEXTURE_RGB);
- textureFormat = EGL_NONE;
+ // Try again with RGB texture rendering.
+ textureFormat = EGL_TEXTURE_RGB;
+ configProps.removeValue(EGL_BIND_TO_TEXTURE_RGBA);
+ configProps.setValue(EGL_BIND_TO_TEXTURE_RGB, EGL_TRUE);
+ ok = ctx->chooseConfig(configProps, QEgl::BestPixelFormat);
+ if (!ok) {
+ // One last try for a pbuffer with no texture rendering.
+ configProps.removeValue(EGL_BIND_TO_TEXTURE_RGB);
+ textureFormat = EGL_NONE;
+ }
}
- }
-#else
- textureFormat = EGL_NONE;
#endif
- if (!ok) {
- if (!ctx->chooseConfig(configProps, QEgl::BestPixelFormat)) {
- delete ctx;
- ctx = 0;
- return false;
+ if (!ok) {
+ if (!ctx->chooseConfig(configProps, QEgl::BestPixelFormat)) {
+ delete ctx;
+ ctx = 0;
+ return false;
+ }
}
}
@@ -137,9 +153,6 @@ bool QGLPixelBufferPrivate::init(const QSize &size, const QGLFormat &f, QGLWidge
}
// Create a new context for the configuration.
- QEglContext *shareContext = 0;
- if (shareWidget && shareWidget->d_func()->glcx)
- shareContext = shareWidget->d_func()->glcx->d_func()->eglContext;
if (!ctx->createContext(shareContext)) {
delete ctx;
ctx = 0;
diff --git a/src/s60installs/bwins/QtCoreu.def b/src/s60installs/bwins/QtCoreu.def
index 146d47e..1218b75 100644
--- a/src/s60installs/bwins/QtCoreu.def
+++ b/src/s60installs/bwins/QtCoreu.def
@@ -4384,4 +4384,7 @@ EXPORTS
?staticMetaObject@QAbstractTableModel@@2UQMetaObject@@B @ 4383 NONAME ; struct QMetaObject const QAbstractTableModel::staticMetaObject
?staticMetaObject@QFile@@2UQMetaObject@@B @ 4384 NONAME ; struct QMetaObject const QFile::staticMetaObject
?staticMetaObject@QHistoryState@@2UQMetaObject@@B @ 4385 NONAME ; struct QMetaObject const QHistoryState::staticMetaObject
+ ?QBasicAtomicPointer_isFetchAndAddNative@@YA_NXZ @ 4386 NONAME ; bool QBasicAtomicPointer_isFetchAndAddNative(void)
+ ?QBasicAtomicPointer_isFetchAndStoreNative@@YA_NXZ @ 4387 NONAME ; bool QBasicAtomicPointer_isFetchAndStoreNative(void)
+ ?QBasicAtomicPointer_isTestAndSetNative@@YA_NXZ @ 4388 NONAME ; bool QBasicAtomicPointer_isTestAndSetNative(void)
diff --git a/src/s60installs/eabi/QtCoreu.def b/src/s60installs/eabi/QtCoreu.def
index faf8b1e..99be68e 100644
--- a/src/s60installs/eabi/QtCoreu.def
+++ b/src/s60installs/eabi/QtCoreu.def
@@ -13,7 +13,7 @@ EXPORTS
_Z11qt_int_sqrtj @ 12 NONAME
_Z12noforcepointR11QTextStream @ 13 NONAME
_Z12qSharedBuildv @ 14 NONAME
- _Z12q_atomic_swpPVcc @ 15 NONAME
+ _Z12q_atomic_swpPVcc @ 15 NONAME ABSENT
_Z12qt_s60GetRFsv @ 16 NONAME
_Z13lowercasebaseR11QTextStream @ 17 NONAME
_Z13qErrnoWarningPKcz @ 18 NONAME
@@ -24,7 +24,7 @@ EXPORTS
_Z15lowercasedigitsR11QTextStream @ 23 NONAME
_Z15qAddPostRoutinePFvvE @ 24 NONAME
_Z15qInitResourceIOv @ 25 NONAME
- _Z15qt_atomic_yieldPi @ 26 NONAME
+ _Z15qt_atomic_yieldPi @ 26 NONAME ABSENT
_Z15qt_error_stringi @ 27 NONAME
_Z15uppercasedigitsR11QTextStream @ 28 NONAME
_Z16qt_QString2HBufCRK7QString @ 29 NONAME
@@ -706,7 +706,7 @@ EXPORTS
_ZN15QAnimationGroupD0Ev @ 705 NONAME
_ZN15QAnimationGroupD1Ev @ 706 NONAME
_ZN15QAnimationGroupD2Ev @ 707 NONAME
- _ZN15QBasicAtomicInt20fetchAndStoreOrderedEi @ 708 NONAME
+ _ZN15QBasicAtomicInt20fetchAndStoreOrderedEi @ 708 NONAME ABSENT
_ZN15QDateTimeParser11parseFormatERK7QString @ 709 NONAME
_ZN15QLinkedListData11shared_nullE @ 710 NONAME DATA 20
_ZN15QObjectUserDataD0Ev @ 711 NONAME
@@ -3566,7 +3566,7 @@ EXPORTS
inflateSync @ 3565 NONAME
inflateSyncPoint @ 3566 NONAME
qMetaTypeGuiHelper @ 3567 NONAME DATA 4
- q_atomic_lock @ 3568 NONAME DATA 1
+ q_atomic_lock @ 3568 NONAME DATA 1 ABSENT
qt_addObject @ 3569 NONAME
qt_global_mutexpool @ 3570 NONAME DATA 4
qt_locale_initialized @ 3571 NONAME DATA 1
@@ -3612,4 +3612,11 @@ EXPORTS
_ZNK13QStateMachine10isAnimatedEv @ 3611 NONAME
_ZNK18QAbstractAnimation15currentLoopTimeEv @ 3612 NONAME
_ZNK7QRegExp12captureCountEv @ 3613 NONAME
+ _Z38QBasicAtomicPointer_isTestAndSetNativev @ 3614 NONAME
+ _Z39QBasicAtomicPointer_isFetchAndAddNativev @ 3615 NONAME
+ _Z41QBasicAtomicPointer_isFetchAndStoreNativev @ 3616 NONAME
+ _ZN15QBasicAtomicInt18isTestAndSetNativeEv @ 3617 NONAME
+ _ZN15QBasicAtomicInt19isFetchAndAddNativeEv @ 3618 NONAME
+ _ZN15QBasicAtomicInt21isFetchAndStoreNativeEv @ 3619 NONAME
+ _ZN15QBasicAtomicInt25isReferenceCountingNativeEv @ 3620 NONAME
diff --git a/src/s60installs/qt.iby b/src/s60installs/qt.iby
index bc69dce..41eb562 100644
--- a/src/s60installs/qt.iby
+++ b/src/s60installs/qt.iby
@@ -57,6 +57,8 @@ file=ABI_DIR\BUILD_DIR\QtTest.dll SHARED_LIB_DIR\QtTest.dll PAG
file=ABI_DIR\BUILD_DIR\QtWebKit.dll SHARED_LIB_DIR\QtWebKit.dll PAGED
file=ABI_DIR\BUILD_DIR\phonon.dll SHARED_LIB_DIR\phonon.dll PAGED
file=ABI_DIR\BUILD_DIR\QtMultimedia.dll SHARED_LIB_DIR\QtMultimedia.dll PAGED
+file=ABI_DIR\BUILD_DIR\QtXmlPatterns.dll SHARED_LIB_DIR\QtXmlPatterns.dll PAGED
+file=ABI_DIR\BUILD_DIR\QtDeclarative.dll SHARED_LIB_DIR\QtDeclarative.dll PAGED
// imageformats
file=ABI_DIR\BUILD_DIR\qgif.dll SHARED_LIB_DIR\qgif.dll PAGED
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index 90c9f27..2d9c489 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -101,6 +101,10 @@ symbian: {
qtlibraries.sources += QtXmlPatterns.dll
}
+ contains(QT_CONFIG, declarative): {
+ qtlibraries.sources += QtDeclarative.dll
+ }
+
contains(QT_CONFIG, webkit): {
qtlibraries.sources += QtWebKit.dll
}
diff --git a/tests/auto/bic/tst_bic.cpp b/tests/auto/bic/tst_bic.cpp
index 8c6056e..b7c79cf 100644
--- a/tests/auto/bic/tst_bic.cpp
+++ b/tests/auto/bic/tst_bic.cpp
@@ -96,6 +96,9 @@ tst_Bic::tst_Bic()
/* QtOpenGL includes qt_windows.h, and some SDKs dont have these structs present */
bic.addBlacklistedClass(QLatin1String("tagTITLEBARINFO"));
+ bic.addBlacklistedClass(QLatin1String("tagMENUITEMINFOA"));
+ bic.addBlacklistedClass(QLatin1String("tagMENUITEMINFOW"));
+ bic.addBlacklistedClass(QLatin1String("tagENHMETAHEADER"));
/* some bug in gcc also reported template instanciations */
bic.addBlacklistedClass(QLatin1String("QTypeInfo<*>"));
@@ -115,6 +118,7 @@ tst_Bic::tst_Bic()
bic.addBlacklistedClass(QLatin1String("QObjectData"));
bic.addBlacklistedClass(QLatin1String("QAtomic"));
bic.addBlacklistedClass(QLatin1String("QBasicAtomic"));
+ bic.addBlacklistedClass(QLatin1String("QRegion::QRegionData"));
/* Jambi-related classes in Designer */
bic.addBlacklistedClass(QLatin1String("QDesignerLanguageExtension"));
diff --git a/tests/auto/collections/tst_collections.cpp b/tests/auto/collections/tst_collections.cpp
index f97805e..84f466b 100644
--- a/tests/auto/collections/tst_collections.cpp
+++ b/tests/auto/collections/tst_collections.cpp
@@ -3586,7 +3586,7 @@ void tst_Collections::alignment()
#else
void tst_Collections::alignment()
{
- QSKIP("Compiler doesn't support necessary extension keywords", SkipAll)
+ QSKIP("Compiler doesn't support necessary extension keywords", SkipAll);
}
#endif
diff --git a/tests/auto/linguist/lconvert/tst_lconvert.cpp b/tests/auto/linguist/lconvert/tst_lconvert.cpp
index e38e22c..10098a4 100644
--- a/tests/auto/linguist/lconvert/tst_lconvert.cpp
+++ b/tests/auto/linguist/lconvert/tst_lconvert.cpp
@@ -105,7 +105,7 @@ void tst_lconvert::doCompare(QIODevice *actualDev, const QString &expectedFn)
QList<QByteArray> actual = actualDev->readAll().split('\n');
QFile file(expectedFn);
- QVERIFY(file.open(QIODevice::ReadOnly));
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
QList<QByteArray> expected = file.readAll().split('\n');
int i = 0, ei = expected.size(), gi = actual.size();
@@ -179,7 +179,7 @@ void tst_lconvert::convertChain(const QString &_inFileName, const QString &_outF
if (!argList.isEmpty())
args += argList[i];
args << "-if" << stations[i] << "-i" << "-" << "-of" << stations[i + 1];
- cvts.at(i)->start(binDir + "/lconvert", args);
+ cvts.at(i)->start(binDir + "/lconvert", args, QIODevice::ReadWrite | QIODevice::Text);
}
int st = 0;
foreach (QProcess *cvt, cvts)
@@ -243,7 +243,9 @@ void tst_lconvert::converts()
QString outFileNameFq = dataDir + outFileName;
QProcess cvt;
- cvt.start(binDir + "/lconvert", QStringList() << "-i" << (dataDir + inFileName) << "-of" << format);
+ cvt.start(binDir + "/lconvert",
+ QStringList() << "-i" << (dataDir + inFileName) << "-of" << format,
+ QIODevice::ReadWrite | QIODevice::Text);
doWait(&cvt, 0);
if (QTest::currentTestFailed())
return;
diff --git a/tests/auto/linguist/lrelease/tst_lrelease.cpp b/tests/auto/linguist/lrelease/tst_lrelease.cpp
index 93cb97c..c9e774f 100644
--- a/tests/auto/linguist/lrelease/tst_lrelease.cpp
+++ b/tests/auto/linguist/lrelease/tst_lrelease.cpp
@@ -72,8 +72,8 @@ private:
void tst_lrelease::doCompare(const QStringList &actual, const QString &expectedFn)
{
QFile file(expectedFn);
- QVERIFY(file.open(QIODevice::ReadOnly));
- QStringList expected = QString(file.readAll()).trimmed().remove('\r').split('\n');
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
+ QStringList expected = QString(file.readAll()).trimmed().split('\n');
int i = 0, ei = expected.size(), gi = actual.size();
for (; ; i++) {
@@ -226,10 +226,10 @@ void tst_lrelease::markuntranslated()
void tst_lrelease::dupes()
{
QProcess proc;
- proc.start(binDir + "/lrelease testdata/dupes.ts");
+ proc.start(binDir + "/lrelease testdata/dupes.ts", QIODevice::ReadWrite | QIODevice::Text);
QVERIFY(proc.waitForFinished());
QVERIFY(proc.exitStatus() == QProcess::NormalExit);
- doCompare(QString(proc.readAllStandardError()).trimmed().remove('\r').split('\n'), "testdata/dupes.errors");
+ doCompare(QString(proc.readAllStandardError()).trimmed().split('\n'), "testdata/dupes.errors");
}
QTEST_MAIN(tst_lrelease)
diff --git a/tests/auto/linguist/lupdate/testlupdate.cpp b/tests/auto/linguist/lupdate/testlupdate.cpp
index 8e57323..d43fbc4 100644
--- a/tests/auto/linguist/lupdate/testlupdate.cpp
+++ b/tests/auto/linguist/lupdate/testlupdate.cpp
@@ -98,9 +98,9 @@ bool TestLUpdate::runChild( bool showOutput, const QString &program, const QStri
connect(childProc, SIGNAL(finished(int)), this, SLOT(childReady(int)));
childProc->setProcessChannelMode(QProcess::MergedChannels);
if (argList.isEmpty()) {
- childProc->start( program );
+ childProc->start( program, QIODevice::ReadWrite | QIODevice::Text );
} else {
- childProc->start( program, argList );
+ childProc->start( program, argList, QIODevice::ReadWrite | QIODevice::Text );
}
bool ok;
diff --git a/tests/auto/linguist/lupdate/tst_lupdate.cpp b/tests/auto/linguist/lupdate/tst_lupdate.cpp
index 230392c..7140ede 100644
--- a/tests/auto/linguist/lupdate/tst_lupdate.cpp
+++ b/tests/auto/linguist/lupdate/tst_lupdate.cpp
@@ -80,8 +80,8 @@ private:
void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn, bool err)
{
QFile file(expectedFn);
- QVERIFY(file.open(QIODevice::ReadOnly));
- QStringList expected = QString(file.readAll()).trimmed().remove('\r').split('\n');
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
+ QStringList expected = QString(file.readAll()).trimmed().split('\n');
int i = 0, ei = expected.size(), gi = actual.size();
for (; ; i++) {
@@ -141,8 +141,8 @@ void tst_lupdate::doCompare(const QStringList &actual, const QString &expectedFn
void tst_lupdate::doCompare(const QString &actualFn, const QString &expectedFn, bool err)
{
QFile afile(actualFn);
- QVERIFY(afile.open(QIODevice::ReadOnly));
- QStringList actual = QString(afile.readAll()).trimmed().remove('\r').split('\n');
+ QVERIFY(afile.open(QIODevice::ReadOnly | QIODevice::Text));
+ QStringList actual = QString(afile.readAll()).trimmed().split('\n');
doCompare(actual, expectedFn, err);
}
@@ -180,7 +180,7 @@ void tst_lupdate::good()
QString lupdatecmd;
QFile file(dir + "/lupdatecmd");
if (file.exists()) {
- QVERIFY(file.open(QIODevice::ReadOnly));
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
while (!file.atEnd()) {
QByteArray cmdstring = file.readLine().simplified();
if (cmdstring.startsWith('#'))
@@ -226,7 +226,7 @@ void tst_lupdate::output_ts()
QString lupdatecmd;
QFile file(dir + "/lupdatecmd");
if (file.exists()) {
- QVERIFY(file.open(QIODevice::ReadOnly));
+ QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text));
while (!file.atEnd()) {
QByteArray cmdstring = file.readLine().simplified();
if (cmdstring.startsWith('#'))
diff --git a/tests/auto/qabstractslider/tst_qabstractslider.cpp b/tests/auto/qabstractslider/tst_qabstractslider.cpp
index d9574df..ee1ba19 100644
--- a/tests/auto/qabstractslider/tst_qabstractslider.cpp
+++ b/tests/auto/qabstractslider/tst_qabstractslider.cpp
@@ -742,11 +742,9 @@ void tst_QAbstractSlider::wheelEvent_data()
<< 1 // delta
<< int(Qt::Horizontal) // orientation of slider
<< int(Qt::Vertical) // orientation of wheel
- << 0 // expected position after
+ << 1 // expected position after
<< QPoint(1,1);
- // Scrolling in a slider of a different orientation than the wheel works
- // if the mouse pointer is within the widget's rect
QTest::newRow("Different orientation2")<< 0 // initial position
<< 0 // minimum
<< 100 // maximum
diff --git a/tests/auto/qcombobox/tst_qcombobox.cpp b/tests/auto/qcombobox/tst_qcombobox.cpp
index cc59b62..e903ab5 100644
--- a/tests/auto/qcombobox/tst_qcombobox.cpp
+++ b/tests/auto/qcombobox/tst_qcombobox.cpp
@@ -2479,6 +2479,10 @@ void tst_QComboBox::keyBoardNavigationWithMouse()
QCOMPARE(combo.currentText(), QLatin1String("0"));
+#ifdef Q_OS_WINCE
+ QSKIP("When calling cursor function, Windows CE responds with: This function is not supported on this system.", SkipAll);
+#endif
+
QCursor::setPos(combo.view()->mapToGlobal(combo.view()->rect().center()));
QTest::qWait(200);
diff --git a/tests/auto/qdockwidget/tst_qdockwidget.cpp b/tests/auto/qdockwidget/tst_qdockwidget.cpp
index c9a7f1c..8f72e39 100644
--- a/tests/auto/qdockwidget/tst_qdockwidget.cpp
+++ b/tests/auto/qdockwidget/tst_qdockwidget.cpp
@@ -50,6 +50,7 @@
#include <qlineedit.h>
#include <QDesktopWidget>
#include <QtGui/QPainter>
+#include "private/qdockwidget_p.h"
bool hasFeature(QDockWidget *dockwidget, QDockWidget::DockWidgetFeature feature)
{ return (dockwidget->features() & feature) == feature; }
@@ -865,7 +866,9 @@ void tst_QDockWidget::taskQTBUG_1665_closableChanged()
dock.show();
QTest::qWaitForWindowShown(&dock);
- if (dock.windowFlags() & Qt::FramelessWindowHint)
+ QDockWidgetLayout *l = qobject_cast<QDockWidgetLayout*>(dock.layout());
+
+ if (l && !l->nativeWindowDeco())
QSKIP("this machine doesn't support native dock widget", SkipAll);
QVERIFY(dock.windowFlags() & Qt::WindowCloseButtonHint);
diff --git a/tests/auto/qfile/qfile.pro b/tests/auto/qfile/qfile.pro
index f70f750..33fd2fd 100644
--- a/tests/auto/qfile/qfile.pro
+++ b/tests/auto/qfile/qfile.pro
@@ -5,5 +5,5 @@ wince*:{
SUBDIRS = test stdinprocess
}
-SUBDIRS += largefile
+!symbian*:SUBDIRS += largefile
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index ccb08c3..5dc072d 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -1842,6 +1842,7 @@ void tst_QGL::shareRegister()
QVERIFY(qt_shared_test()->value(glw1->context()) == res1);
// Create another context that shares with the first.
+ QVERIFY(!glw1->isSharing());
QGLWidget *glw2 = new QGLWidget(0, glw1);
if (!glw2->isSharing()) {
delete glw2;
@@ -1880,6 +1881,7 @@ void tst_QGL::shareRegister()
// Create a third context, not sharing with the others.
QGLWidget *glw3 = new QGLWidget();
+ QVERIFY(!glw3->isSharing());
// Create a guard on the standalone context.
QGLSharedResourceGuard guard3(glw3->context());
@@ -1928,6 +1930,9 @@ void tst_QGL::shareRegister()
// Delete the first context.
delete glw1;
+ // The second context should no longer register as sharing.
+ QVERIFY(!glw2->isSharing());
+
// The first context's resource should transfer to the second context.
QCOMPARE(tst_QGLResource::deletions, 0);
QVERIFY(qt_shared_test()->value(glw2->context()) == res1);
diff --git a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
index c7ed309..2ad024f 100644
--- a/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
+++ b/tests/auto/qgraphicsanchorlayout/tst_qgraphicsanchorlayout.cpp
@@ -85,6 +85,7 @@ private slots:
void simplificationVsOrder();
void parallelSimplificationOfCenter();
void simplificationVsRedundance();
+ void spacingPersistency();
};
class RectWidget : public QGraphicsWidget
@@ -1866,5 +1867,30 @@ void tst_QGraphicsAnchorLayout::simplificationVsRedundance()
QCOMPARE(usedSimplex(l, Qt::Vertical), false);
}
+/*
+ Avoid regression where the saved prefSize would be lost. This was
+ solved by saving the original spacing in the QGraphicsAnchorPrivate class
+*/
+void tst_QGraphicsAnchorLayout::spacingPersistency()
+{
+ QGraphicsWidget w;
+ QGraphicsWidget *a = createItem();
+ QGraphicsAnchorLayout *l = new QGraphicsAnchorLayout(&w);
+
+ l->addAnchors(l, a, Qt::Horizontal);
+ QGraphicsAnchor *anchor = l->anchor(l, Qt::AnchorLeft, a, Qt::AnchorLeft);
+
+ anchor->setSpacing(-30);
+ QCOMPARE(anchor->spacing(), -30.0);
+
+ anchor->setSpacing(30);
+ QCOMPARE(anchor->spacing(), 30.0);
+
+ anchor->setSizePolicy(QSizePolicy::Ignored);
+ w.effectiveSizeHint(Qt::PreferredSize);
+
+ QCOMPARE(anchor->spacing(), 30.0);
+}
+
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 0fbd069..bca59c3 100644
--- a/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
+++ b/tests/auto/qgraphicsanchorlayout1/tst_qgraphicsanchorlayout1.cpp
@@ -1722,7 +1722,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout()
QRectF expected = truncate(item.rect);
QRectF actual = truncate(widgets[item.index]->geometry());
- QCOMPARE(expected, actual);
+ QCOMPARE(actual, expected);
}
// Test mirrored mode
@@ -1739,7 +1739,7 @@ void tst_QGraphicsAnchorLayout1::testBasicLayout()
QRectF expected = truncate(mirroredRect);
QRectF actual = truncate(widgets[item.index]->geometry());
- QCOMPARE(expected, actual);
+ QCOMPARE(actual, expected);
delete widgets[item.index];
}
diff --git a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
index 77c259c..269afbd 100644
--- a/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
+++ b/tests/auto/qitemselectionmodel/tst_qitemselectionmodel.cpp
@@ -92,6 +92,7 @@ private slots:
void task252069_rowIntersectsSelection();
void task232634_childrenDeselectionSignal();
void task260134_layoutChangedWithAllSelected();
+ void QTBUG5671_layoutChangedWithAllSelected();
private:
QAbstractItemModel *model;
@@ -2025,24 +2026,24 @@ void tst_QItemSelectionModel::task220420_selectedIndexes()
class QtTestTableModel: public QAbstractTableModel
{
Q_OBJECT
-
+
public:
QtTestTableModel(int rows = 0, int columns = 0, QObject *parent = 0)
: QAbstractTableModel(parent),
row_count(rows),
column_count(columns) {}
-
+
int rowCount(const QModelIndex& = QModelIndex()) const { return row_count; }
int columnCount(const QModelIndex& = QModelIndex()) const { return column_count; }
bool isEditable(const QModelIndex &) const { return true; }
-
+
QVariant data(const QModelIndex &idx, int role) const
{
if (role == Qt::DisplayRole || role == Qt::EditRole)
return QString("[%1,%2]").arg(idx.row()).arg(idx.column());
return QVariant();
}
-
+
int row_count;
int column_count;
friend class tst_QItemSelectionModel;
@@ -2055,7 +2056,7 @@ void tst_QItemSelectionModel::task240734_layoutChanged()
QItemSelectionModel selectionModel(&model);
selectionModel.select(model.index(0,0), QItemSelectionModel::Select);
QCOMPARE(selectionModel.selectedIndexes().count() , 1);
-
+
emit model.layoutAboutToBeChanged();
model.row_count = 5;
emit model.layoutChanged();
@@ -2107,7 +2108,7 @@ void tst_QItemSelectionModel::merge_data()
<< QItemSelection(model->index(2, 2) , model->index(3, 4))
<< int(QItemSelectionModel::Deselect)
<< QItemSelection(model->index(2, 1) , model->index(3, 1));
-
+
QItemSelection r1(model->index(2, 1) , model->index(3, 1));
r1.select(model->index(2, 4) , model->index(3, 4));
QTest::newRow("Toggle")
@@ -2274,5 +2275,57 @@ void tst_QItemSelectionModel::task260134_layoutChangedWithAllSelected()
}
+void tst_QItemSelectionModel::QTBUG5671_layoutChangedWithAllSelected()
+{
+ struct MyFilterModel : public QSortFilterProxyModel
+ { // Override sort filter proxy to remove even numbered rows.
+ bool filtering;
+ virtual bool filterAcceptsRow( int source_row, const QModelIndex& source_parent ) const
+ {
+ return !filtering || !( source_row & 1 );
+ }
+ };
+
+ //same as task260134_layoutChangedWithAllSelected but with a sightly bigger model
+
+ enum { cNumRows=30, cNumCols=20 };
+
+ QStandardItemModel model(cNumRows, cNumCols);
+ MyFilterModel proxy;
+ proxy.filtering = true;
+ proxy.setSourceModel(&model);
+ QItemSelectionModel selection(&proxy);
+
+ // Populate the tree view.
+ for (unsigned int i = 0; i < cNumCols; i++)
+ model.setHeaderData( i, Qt::Horizontal, QString::fromLatin1("Column %1").arg(i));
+
+ for (unsigned int r = 0; r < cNumRows; r++) {
+ for (unsigned int c = 0; c < cNumCols; c++) {
+ model.setData(model.index(r, c, QModelIndex()),
+ QString::fromLatin1("r:%1/c:%2").arg(r, c));
+ }
+ }
+
+
+ QCOMPARE(model.rowCount(), int(cNumRows));
+ QCOMPARE(proxy.rowCount(), int(cNumRows/2));
+
+ selection.select( QItemSelection(proxy.index(0,0), proxy.index(proxy.rowCount() - 1, proxy.columnCount() - 1)), QItemSelectionModel::Select);
+
+ QList<QPersistentModelIndex> indexList;
+ foreach(const QModelIndex &id, selection.selectedIndexes())
+ indexList << id;
+
+ proxy.filtering = false;
+ proxy.invalidate();
+ QCOMPARE(proxy.rowCount(), int(cNumRows));
+
+ //let's check the selection hasn't changed
+ QCOMPARE(selection.selectedIndexes().count(), indexList.count());
+ foreach(QPersistentModelIndex index, indexList)
+ QVERIFY(selection.isSelected(index));
+}
+
QTEST_MAIN(tst_QItemSelectionModel)
#include "tst_qitemselectionmodel.moc"
diff --git a/tests/auto/qlibrary/lib2/lib2.pro b/tests/auto/qlibrary/lib2/lib2.pro
index 436d7ba..fc00af8 100644
--- a/tests/auto/qlibrary/lib2/lib2.pro
+++ b/tests/auto/qlibrary/lib2/lib2.pro
@@ -37,9 +37,9 @@ symbian-abld: {
symbian-sbsv2: {
TARGET.CAPABILITY=ALL -TCB
QMAKE_POST_LINK = \
- $(GNUCP) $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dl2 && \
- $(GNUCP) $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/system.trolltech.test.mylib.dll && \
- if test $(PLATFORM) != WINSCW;then $(GNUCP) $${EPOCROOT}epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${PWD}/../tst/mylib.dl2; fi
+ $(GNUCP) $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dl2 && \
+ $(GNUCP) $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/system.trolltech.test.mylib.dll && \
+ if test $(PLATFORM) != WINSCW;then $(GNUCP) $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/mylib.dll $${PWD}/../tst/mylib.dl2; fi
}
#no special install rule for the library used by test
diff --git a/tests/auto/qtextdocument/tst_qtextdocument.cpp b/tests/auto/qtextdocument/tst_qtextdocument.cpp
index 1d54409..11e32b0 100644
--- a/tests/auto/qtextdocument/tst_qtextdocument.cpp
+++ b/tests/auto/qtextdocument/tst_qtextdocument.cpp
@@ -2615,6 +2615,17 @@ void tst_QTextDocument::testUndoCommandAdded()
cf.setFontItalic(true);
cursor.mergeCharFormat(cf);
QCOMPARE(spy.count(), 1);
+
+ spy.clear();
+ doc->undo();
+ QCOMPARE(spy.count(), 0);
+ doc->undo();
+ QCOMPARE(spy.count(), 0);
+ spy.clear();
+ doc->redo();
+ QCOMPARE(spy.count(), 0);
+ doc->redo();
+ QCOMPARE(spy.count(), 0);
}
void tst_QTextDocument::testUndoBlocks()
diff --git a/tests/auto/qtreewidget/tst_qtreewidget.cpp b/tests/auto/qtreewidget/tst_qtreewidget.cpp
index 6defd7b..621072c 100644
--- a/tests/auto/qtreewidget/tst_qtreewidget.cpp
+++ b/tests/auto/qtreewidget/tst_qtreewidget.cpp
@@ -167,6 +167,7 @@ private slots:
void setCurrentItemExpandsParent();
void task239150_editorWidth();
void setTextUpdate();
+ void taskQTBUG2844_visualItemRect();
public slots:
void itemSelectionChanged();
@@ -601,9 +602,9 @@ void tst_QTreeWidget::setItemHidden()
testWidget->scrollToItem(child);
QVERIFY(testWidget->visualItemRect(parent).isValid()
- && testWidget->viewport()->rect().contains(testWidget->visualItemRect(parent)));
+ && testWidget->viewport()->rect().intersects(testWidget->visualItemRect(parent)));
QVERIFY(testWidget->visualItemRect(child).isValid()
- && testWidget->viewport()->rect().contains(testWidget->visualItemRect(child)));
+ && testWidget->viewport()->rect().intersects(testWidget->visualItemRect(child)));
QVERIFY(!testWidget->isItemHidden(parent));
QVERIFY(!testWidget->isItemHidden(child));
@@ -611,9 +612,9 @@ void tst_QTreeWidget::setItemHidden()
testWidget->setItemHidden(parent, true);
QVERIFY(!(testWidget->visualItemRect(parent).isValid()
- && testWidget->viewport()->rect().contains(testWidget->visualItemRect(parent))));
+ && testWidget->viewport()->rect().intersects(testWidget->visualItemRect(parent))));
QVERIFY(!(testWidget->visualItemRect(child).isValid()
- && testWidget->viewport()->rect().contains(testWidget->visualItemRect(child))));
+ && testWidget->viewport()->rect().intersects(testWidget->visualItemRect(child))));
QVERIFY(testWidget->isItemHidden(parent));
QVERIFY(!testWidget->isItemHidden(child));
@@ -3271,6 +3272,25 @@ void tst_QTreeWidget::setTextUpdate()
QTRY_VERIFY(delegate.numPaints > 0);
}
+void tst_QTreeWidget::taskQTBUG2844_visualItemRect()
+{
+ CustomTreeWidget tree;
+ tree.resize(150, 100);
+ tree.setColumnCount(3);
+ QTreeWidgetItem item(&tree);
+
+ QRect itemRect = tree.visualItemRect(&item);
+
+ QRect rectCol0 = tree.visualRect(tree.indexFromItem(&item, 0));
+ QRect rectCol1 = tree.visualRect(tree.indexFromItem(&item, 1));
+ QRect rectCol2 = tree.visualRect(tree.indexFromItem(&item, 2));
+
+ QCOMPARE(tree.visualItemRect(&item), rectCol0 | rectCol2);
+ tree.setColumnHidden(2, true);
+ QCOMPARE(tree.visualItemRect(&item), rectCol0 | rectCol1);
+}
+
+
QTEST_MAIN(tst_QTreeWidget)
diff --git a/tests/auto/qworkspace/tst_qworkspace.cpp b/tests/auto/qworkspace/tst_qworkspace.cpp
index c1fe3e0..35f8a4d 100644
--- a/tests/auto/qworkspace/tst_qworkspace.cpp
+++ b/tests/auto/qworkspace/tst_qworkspace.cpp
@@ -426,6 +426,9 @@ void tst_QWorkspace::showWindows()
void tst_QWorkspace::changeWindowTitle()
{
+#ifdef Q_OS_WINCE
+ QSKIP( "Test fails on Windows CE due to QWorkspace state handling", SkipAll);
+#endif
const QString mwc( "MainWindow's Caption" );
const QString mwc2( "MainWindow's New Caption" );
const QString wc( "Widget's Caption" );
diff --git a/tools/assistant/lib/qhelp_global.cpp b/tools/assistant/lib/qhelp_global.cpp
index 980de27..749d2c9 100644
--- a/tools/assistant/lib/qhelp_global.cpp
+++ b/tools/assistant/lib/qhelp_global.cpp
@@ -4,7 +4,7 @@
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
-** This file is part of the Qt Assistant.
+** This file is part of the Qt Assistant of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage