summaryrefslogtreecommitdiffstats
path: root/src
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 /src
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
Diffstat (limited to 'src')
-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
24 files changed, 291 insertions, 445 deletions
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
}