From fb0765f5285b8518b3336a6aa36de1adc37bc1fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?=
Date: Thu, 11 Nov 2010 07:13:35 +0100
Subject: Fix a behaviour change of sizeHint() introduced by 6d4d265e7e67dde58
Commit 6d4d265e7e67dde58e45d7d89f4974d0bd8b70e4 added a behaviour change
in the cases if there was an item with height-for-width and sizeHint()
was called with no constraint. The commit tried to return the height
needed for the preferred width, but it still did not satisfy the
constraints, since the width used as the constraint could be less than
the preferred width. This also meant that the sizeHint(Qt::MinimumSize)
could actually be larger than the smallest possible size.
The behaviour should be that it should return the smallest width
possible regardless of height. For instance, for a label it could return
the size of the longest word (to avoid hyphenation issues).
The same logic applies for the height: It should return the smallest
height possible regardless of width. For instance, for a label it could
then return the height of the font.
I also had to fix some stuff in the heightForWidthWithSpanning()
autotest since it wrongly expected the maximum size to be
QWIDGETSIZE_MAX in several of the cases. However, that is the current
behaviour (and it is a bug), but it is unrelated to the problem with
spans so I simply fix the test and mark them with QEXPECT_FAIL.
Reviewed-by: John Tapsell
---
src/gui/graphicsview/qgridlayoutengine.cpp | 95 ++++++++++------------
.../tst_qgraphicsgridlayout.cpp | 19 +++--
2 files changed, 57 insertions(+), 57 deletions(-)
diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp
index e486b4d..9785b15 100644
--- a/src/gui/graphicsview/qgridlayoutengine.cpp
+++ b/src/gui/graphicsview/qgridlayoutengine.cpp
@@ -1107,7 +1107,50 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi
{
QGridLayoutBox sizehint_totalBoxes[NOrientations];
- if(rowCount() < 1 || columnCount() < 1 || !hasDynamicConstraint()) {
+ bool sizeHintCalculated = false;
+
+ if (hasDynamicConstraint() && rowCount() > 0 && columnCount() > 0) {
+ if (constraintOrientation() == Qt::Vertical) {
+ //We have items whose height depends on their width
+ if (constraint.width() >= 0) {
+ if(q_cachedDataForStyleInfo != styleInfo)
+ ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal);
+ else
+ sizehint_totalBoxes[Hor] = q_totalBoxes[Hor];
+ QVector sizehint_xx;
+ QVector sizehint_widths;
+
+ sizehint_xx.resize(columnCount());
+ sizehint_widths.resize(columnCount());
+ qreal width = constraint.width();
+ //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as
+ //constraints to find the row heights
+ q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(),
+ 0, sizehint_totalBoxes[Hor]);
+ ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical);
+ sizeHintCalculated = true;
+ }
+ } else {
+ if (constraint.height() >= 0) {
+ //We have items whose width depends on their height
+ ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical);
+ QVector sizehint_yy;
+ QVector sizehint_heights;
+
+ sizehint_yy.resize(rowCount());
+ sizehint_heights.resize(rowCount());
+ qreal height = constraint.height();
+ //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as
+ //constraints to find the column widths
+ q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(),
+ 0, sizehint_totalBoxes[Ver]);
+ ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Vertical);
+ sizeHintCalculated = true;
+ }
+ }
+ }
+
+ if (!sizeHintCalculated) {
//No items with height for width, so it doesn't matter which order we do these in
if(q_cachedDataForStyleInfo != styleInfo) {
ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal);
@@ -1116,55 +1159,7 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi
sizehint_totalBoxes[Hor] = q_totalBoxes[Hor];
sizehint_totalBoxes[Ver] = q_totalBoxes[Ver];
}
- } else if(constraintOrientation() == Qt::Vertical) {
- //We have items whose width depends on their height
- if(q_cachedDataForStyleInfo != styleInfo)
- ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal);
- else
- sizehint_totalBoxes[Hor] = q_totalBoxes[Hor];
- QVector sizehint_xx;
- QVector sizehint_widths;
-
- sizehint_xx.resize(columnCount());
- sizehint_widths.resize(columnCount());
- qreal width = constraint.width();
- if(width < 0) {
- /* It's not obvious what the behaviour should be. */
-/* if(which == Qt::MaximumSize)
- width = sizehint_totalBoxes[Hor].q_maximumSize;
- else if(which == Qt::MinimumSize)
- width = sizehint_totalBoxes[Hor].q_minimumSize;
- else*/
- width = sizehint_totalBoxes[Hor].q_preferredSize;
- }
- //Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as
- //constraints to find the row heights
- q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(),
- 0, sizehint_totalBoxes[Hor]);
- ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical);
- } else {
- //We have items whose height depends on their width
- ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical);
- QVector sizehint_yy;
- QVector sizehint_heights;
-
- sizehint_yy.resize(rowCount());
- sizehint_heights.resize(rowCount());
- qreal height = constraint.height();
- if(height < 0) {
-/* if(which == Qt::MaximumSize)
- height = sizehint_totalBoxes[Ver].q_maximumSize;
- else if(which == Qt::MinimumSize)
- height = sizehint_totalBoxes[Ver].q_minimumSize;
- else*/
- height = sizehint_totalBoxes[Ver].q_preferredSize;
- }
- //Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as
- //constraints to find the column widths
- q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(),
- 0, sizehint_totalBoxes[Ver]);
- ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Vertical);
- }
+ }
switch (which) {
case Qt::MinimumSize:
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 174e4aa..ff49b27 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -2556,8 +2556,9 @@ void tst_QGraphicsGridLayout::heightForWidth()
w11->setSizePolicy(sp);
layout->addItem(w11, 1, 1);
- QSizeF prefSize = layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, -1));
- QCOMPARE(prefSize, QSizeF(10+200, 10+100));
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, -1)), QSizeF(2, 2));
+ QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, -1)), QSizeF(210, 110));
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(-1, -1)), QSizeF(30100, 30100));
QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(2, -1)), QSizeF(2, 20001));
QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(2, -1)), QSizeF(2, 20010));
@@ -2610,21 +2611,25 @@ void tst_QGraphicsGridLayout::heightForWidthWithSpanning()
w->setSizePolicy(sp);
layout->addItem(w, 0,0,2,2);
- QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, -1)), QSizeF(1, 100));
+ QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(-1, -1)), QSizeF(1, 1));
QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(-1, -1)), QSizeF(200, 100));
- QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(-1, -1)), QSizeF(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
+ QEXPECT_FAIL("", "Due to an old bug this wrongly returns QWIDGETSIZE_MAX", Continue);
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(-1, -1)), QSizeF(30000, 30000));
QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(200, -1)), QSizeF(200, 100));
QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(200, -1)), QSizeF(200, 100));
- QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(200, -1)), QSizeF(200, QWIDGETSIZE_MAX));
+ QEXPECT_FAIL("", "Due to an old bug this wrongly returns QWIDGETSIZE_MAX", Continue);
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(200, -1)), QSizeF(200, 100));
QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(2, -1)), QSizeF(2, 10000));
QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(2, -1)), QSizeF(2, 10000));
- QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(2, -1)), QSizeF(2, QWIDGETSIZE_MAX));
+ QEXPECT_FAIL("", "Due to an old bug this wrongly returns QWIDGETSIZE_MAX", Continue);
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(2, -1)), QSizeF(2, 10000));
QCOMPARE(layout->effectiveSizeHint(Qt::MinimumSize, QSizeF(200, -1)), QSizeF(200, 100));
QCOMPARE(layout->effectiveSizeHint(Qt::PreferredSize, QSizeF(200, -1)), QSizeF(200, 100));
- QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(200, -1)), QSizeF(200, QWIDGETSIZE_MAX));
+ QEXPECT_FAIL("", "Due to an old bug this wrongly returns QWIDGETSIZE_MAX", Continue);
+ QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(200, -1)), QSizeF(200, 10000));
}
QTEST_MAIN(tst_QGraphicsGridLayout)
--
cgit v0.12
From 4e0865200244b70e6d4be62b57bdf248342834ba Mon Sep 17 00:00:00 2001
From: Martin Smith
Date: Fri, 12 Nov 2010 12:05:04 +0100
Subject: doc: Stated that the destructor does not call close().
Task-number: QTBUG-15277, QTBUG-8231
---
src/corelib/io/qiodevice.cpp | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/corelib/io/qiodevice.cpp b/src/corelib/io/qiodevice.cpp
index 26e587d..68fb2bf 100644
--- a/src/corelib/io/qiodevice.cpp
+++ b/src/corelib/io/qiodevice.cpp
@@ -395,7 +395,10 @@ QIODevice::QIODevice(QIODevicePrivate &dd, QObject *parent)
/*!
- Destructs the QIODevice object.
+ The destructor is virtual, and QIODevice is an abstract base
+ class. This destructor does not call close(), but the subclass
+ destructor might. If you are in doubt, call close() before
+ destroying the QIODevice.
*/
QIODevice::~QIODevice()
{
--
cgit v0.12
From 5c129ceed8cb157354250e1a938f0b8af5dfe507 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?=
Date: Fri, 12 Nov 2010 12:14:11 +0100
Subject: Add back the tests that were removed by commit
fcda1b785bd7d86011f49bfe96cb22b04202933f
Also add a proper test for the alignment problem
---
.../tst_qgraphicsgridlayout.cpp | 174 +++++++++++++++++++++
1 file changed, 174 insertions(+)
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index ff49b27..e448e4c 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -2306,6 +2306,11 @@ static QSizeF hfw1(Qt::SizeHint, const QSizeF &constraint)
return result;
}
+static QSizeF hfw2(Qt::SizeHint /*which*/, const QSizeF &constraint)
+{
+ return QSizeF(constraint.width(), constraint.width());
+}
+
void tst_QGraphicsGridLayout::geometries_data()
{
@@ -2361,6 +2366,31 @@ void tst_QGraphicsGridLayout::geometries_data()
<< QRectF(0, 1, 50,100) << QRectF(50, 1, 50,400)
);
+
+ QTest::newRow("hfw-h408") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .sizeHint(Qt::MinimumSize, QSizeF(40,40))
+ .sizeHint(Qt::PreferredSize, QSizeF(50,400))
+ .sizeHint(Qt::MaximumSize, QSizeF(500, 500))
+ .heightForWidth(hfw1)
+ )
+ << QSizeF(100, 408)
+ << (RectList()
+ << QRectF(0, 0, 50, 8) << QRectF(50, 0, 50, 8)
+ << QRectF(0, 8, 50,100) << QRectF(50, 8, 50,400)
+ );
QTest::newRow("hfw-h410") << (ItemList()
<< ItemDesc(0,0)
.minSize(QSizeF(1,1))
@@ -2386,6 +2416,150 @@ void tst_QGraphicsGridLayout::geometries_data()
<< QRectF(0, 10, 50,100) << QRectF(50, 10, 50,400)
);
+ QTest::newRow("hfw-h470") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .sizeHint(Qt::MinimumSize, QSizeF(40,40))
+ .sizeHint(Qt::PreferredSize, QSizeF(50,400))
+ .sizeHint(Qt::MaximumSize, QSizeF(500,500))
+ .heightForWidth(hfw1)
+ )
+ << QSizeF(100, 470)
+ << (RectList()
+ << QRectF(0, 0, 50,70) << QRectF(50, 0, 50,70)
+ << QRectF(0, 70, 50,100) << QRectF(50, 70, 50,400)
+ );
+
+
+ // change layout width and verify
+ QTest::newRow("hfw-w100") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .sizeHint(Qt::MinimumSize, QSizeF(40,40))
+ .sizeHint(Qt::PreferredSize, QSizeF(50,400))
+ .sizeHint(Qt::MaximumSize, QSizeF(5000,5000))
+ .heightForWidth(hfw1)
+ )
+ << QSizeF(100, 401)
+ << (RectList()
+ << QRectF( 0, 0, 50, 1) << QRectF( 50, 0, 50, 1)
+ << QRectF( 0, 1, 50, 100) << QRectF( 50, 1, 50, 400)
+ );
+
+ QTest::newRow("hfw-w160") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .sizeHint(Qt::MinimumSize, QSizeF(40,40))
+ .sizeHint(Qt::PreferredSize, QSizeF(50,400))
+ .sizeHint(Qt::MaximumSize, QSizeF(5000,5000))
+ .heightForWidth(hfw1)
+ )
+ << QSizeF(160, 401)
+ << (RectList()
+ << QRectF( 0, 0, 80, 100) << QRectF( 80, 0, 80, 100)
+ << QRectF( 0, 100, 80, 100) << QRectF( 80, 100, 80, 250)
+ );
+
+ QTest::newRow("hfw-w500") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(0,1)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,0)
+ .minSize(QSizeF(1,1))
+ .preferredSize(QSizeF(50,10))
+ .maxSize(QSizeF(100, 100))
+ << ItemDesc(1,1)
+ .sizeHint(Qt::MinimumSize, QSizeF(40,40))
+ .sizeHint(Qt::PreferredSize, QSizeF(50,400))
+ .sizeHint(Qt::MaximumSize, QSizeF(5000,5000))
+ .heightForWidth(hfw1)
+ )
+ << QSizeF(500, 401)
+ << (RectList()
+ << QRectF( 0, 0, 100, 100) << QRectF(100, 0, 100, 100)
+ << QRectF( 0, 100, 100, 100) << QRectF(100, 100, 400, 50)
+ );
+
+ QTest::newRow("hfw-alignment-defaults") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(100, 100))
+ .maxSize(QSizeF(100, 100))
+ .heightForWidth(hfw2)
+ << ItemDesc(1,0)
+ .minSize(QSizeF(200, 200))
+ .maxSize(QSizeF(200, 200))
+ .heightForWidth(hfw2)
+ << ItemDesc(2,0)
+ .minSize(QSizeF(300, 300))
+ .maxSize(QSizeF(300, 300))
+ )
+ << QSizeF(300, 600)
+ << (RectList()
+ << QRectF(0, 0, 100, 100)
+ << QRectF(0, 100, 200, 200)
+ << QRectF(0, 300, 300, 300)
+ );
+
+ QTest::newRow("hfw-alignment2") << (ItemList()
+ << ItemDesc(0,0)
+ .minSize(QSizeF(100, 100))
+ .maxSize(QSizeF(100, 100))
+ .heightForWidth(hfw2)
+ .alignment(Qt::AlignRight)
+ << ItemDesc(1,0)
+ .minSize(QSizeF(200, 200))
+ .maxSize(QSizeF(200, 200))
+ .heightForWidth(hfw2)
+ .alignment(Qt::AlignHCenter)
+ << ItemDesc(2,0)
+ .minSize(QSizeF(300, 300))
+ .maxSize(QSizeF(300, 300))
+ )
+ << QSizeF(300, 600)
+ << (RectList()
+ << QRectF(200, 0, 100, 100)
+ << QRectF( 50, 100, 200, 200)
+ << QRectF( 0, 300, 300, 300)
+ );
+
}
void tst_QGraphicsGridLayout::geometries()
--
cgit v0.12
From 8f23788ec21896135f182778cf48362162b88969 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?=
Date: Fri, 12 Nov 2010 13:16:53 +0100
Subject: Code style cleanup for merge request 847
---
src/gui/graphicsview/qgridlayoutengine.cpp | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp
index 9785b15..b7fe5a0 100644
--- a/src/gui/graphicsview/qgridlayoutengine.cpp
+++ b/src/gui/graphicsview/qgridlayoutengine.cpp
@@ -637,7 +637,7 @@ QRectF QGridLayoutItem::geometryWithin(qreal x, qreal y, qreal width, qreal heig
if (dynamicConstraintOrientation() == Qt::Vertical) {
if (size.width() > cellWidth)
size = effectiveMaxSize(QSizeF(cellWidth, -1));
- } else if(size.height() > cellHeight) {
+ } else if (size.height() > cellHeight) {
size = effectiveMaxSize(QSizeF(-1, cellHeight));
}
}
@@ -1113,7 +1113,7 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi
if (constraintOrientation() == Qt::Vertical) {
//We have items whose height depends on their width
if (constraint.width() >= 0) {
- if(q_cachedDataForStyleInfo != styleInfo)
+ if (q_cachedDataForStyleInfo != styleInfo)
ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal);
else
sizehint_totalBoxes[Hor] = q_totalBoxes[Hor];
@@ -1152,7 +1152,7 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi
if (!sizeHintCalculated) {
//No items with height for width, so it doesn't matter which order we do these in
- if(q_cachedDataForStyleInfo != styleInfo) {
+ if (q_cachedDataForStyleInfo != styleInfo) {
ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal);
ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical);
} else {
@@ -1680,7 +1680,7 @@ void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo,
q_heights.resize(rowCount());
q_descents.resize(rowCount());
- if(constraintOrientation() != Qt::Horizontal) {
+ if (constraintOrientation() != Qt::Horizontal) {
//We might have items whose width depends on their height
ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, NULL, NULL, Qt::Horizontal);
//Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as
--
cgit v0.12
From 659c889f64e76ec9aece2dd9e24a7f65875c46ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?=
Date: Mon, 15 Nov 2010 08:56:58 +0100
Subject: Add autotest to test a issue with stretches and preferred width.
The issue seemed to claim that the preferred size was not respected
when there was another item that could stretch along the same axis:
"A widget with a horizontal stretch next to it should get its
preferredWidth()".
This seems to works as expected, so nothing to fix.
Task-number: QTBUG-12835
---
.../tst_qgraphicsgridlayout.cpp | 62 ++++++++++++++++++++++
1 file changed, 62 insertions(+)
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index e448e4c..7170059 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -122,6 +122,7 @@ private slots:
void task236367_maxSizeHint();
void heightForWidth();
void heightForWidthWithSpanning();
+ void stretchAndHeightForWidth();
};
class RectWidget : public QGraphicsWidget
@@ -2806,6 +2807,67 @@ void tst_QGraphicsGridLayout::heightForWidthWithSpanning()
QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(200, -1)), QSizeF(200, 10000));
}
+
+void tst_QGraphicsGridLayout::stretchAndHeightForWidth()
+{
+ QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
+ QGraphicsGridLayout *layout = new QGraphicsGridLayout;
+ widget->setLayout(layout);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0);
+
+ RectWidget *w1 = new RectWidget;
+ w1->setSizeHint(Qt::MinimumSize, QSizeF(10, 10));
+ w1->setSizeHint(Qt::PreferredSize, QSizeF(100, 100));
+ w1->setSizeHint(Qt::MaximumSize, QSizeF(500, 500));
+ layout->addItem(w1, 0,0,1,1);
+
+ RectWidget *w2 = new RectWidget;
+ w2->setSizeHint(Qt::MinimumSize, QSizeF(10, 10));
+ w2->setSizeHint(Qt::PreferredSize, QSizeF(100, 100));
+ w2->setSizeHint(Qt::MaximumSize, QSizeF(500, 500));
+ layout->addItem(w2, 0,1,1,1);
+ layout->setColumnStretchFactor(1, 2);
+
+ QApplication::sendPostedEvents();
+ QGraphicsScene scene;
+ QGraphicsView *view = new QGraphicsView(&scene);
+
+ scene.addItem(widget);
+
+ view->show();
+
+ widget->resize(500, 100);
+ // w1 should stay at its preferred size
+ QCOMPARE(w1->geometry(), QRectF(0, 0, 100, 100));
+ QCOMPARE(w2->geometry(), QRectF(100, 0, 400, 100));
+
+
+ // only w1 has hfw
+ w1->setConstraintFunction(hfw);
+ QSizePolicy sp(QSizePolicy::Preferred, QSizePolicy::Preferred);
+ sp.setHeightForWidth(true);
+ w1->setSizePolicy(sp);
+ QApplication::sendPostedEvents();
+
+ QCOMPARE(w1->geometry(), QRectF(0, 0, 100, 200));
+ QCOMPARE(w2->geometry(), QRectF(100, 0, 400, 200));
+
+ // only w2 has hfw
+ w2->setConstraintFunction(hfw);
+ w2->setSizePolicy(sp);
+
+ w1->setConstraintFunction(0);
+ sp.setHeightForWidth(false);
+ w1->setSizePolicy(sp);
+ QApplication::sendPostedEvents();
+
+ QCOMPARE(w1->geometry(), QRectF(0, 0, 100, 100));
+ QCOMPARE(w2->geometry(), QRectF(100, 0, 400, 50));
+
+}
+
+
QTEST_MAIN(tst_QGraphicsGridLayout)
#include "tst_qgraphicsgridlayout.moc"
--
cgit v0.12
From 604c51f1fc5c79b7fad12cda911b06b9e6e5005f Mon Sep 17 00:00:00 2001
From: John Tapsell
Date: Mon, 15 Nov 2010 12:55:06 +0100
Subject: Fix item alignment in layouts bigger than the items thay they contain
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Task-number: QTBUG-13551
Task-number: QTBUG-7756
Merge-request: 894
Reviewed-by: Jan-Arve Sæther
---
src/gui/graphicsview/qgridlayoutengine.cpp | 92 ++++++++++++++--------
src/gui/graphicsview/qgridlayoutengine_p.h | 7 +-
.../tst_qgraphicsgridlayout.cpp | 70 +++++++++++++---
.../tst_qgraphicslinearlayout.cpp | 85 ++++++++++++++++++++
4 files changed, 208 insertions(+), 46 deletions(-)
diff --git a/src/gui/graphicsview/qgridlayoutengine.cpp b/src/gui/graphicsview/qgridlayoutengine.cpp
index b7fe5a0..f1055ba 100644
--- a/src/gui/graphicsview/qgridlayoutengine.cpp
+++ b/src/gui/graphicsview/qgridlayoutengine.cpp
@@ -166,7 +166,7 @@ void QGridLayoutRowData::reset(int count)
hasIgnoreFlag = false;
}
-void QGridLayoutRowData::distributeMultiCells()
+void QGridLayoutRowData::distributeMultiCells(const QGridLayoutRowInfo &rowInfo)
{
MultiCellMap::const_iterator i = multiCellMap.constBegin();
for (; i != multiCellMap.constEnd(); ++i) {
@@ -185,7 +185,7 @@ void QGridLayoutRowData::distributeMultiCells()
qreal extra = compare(box, totalBox, j);
if (extra > 0.0) {
calculateGeometries(start, end, box.q_sizes(j), dummy.data(), newSizes.data(),
- 0, totalBox);
+ 0, totalBox, rowInfo);
for (int k = 0; k < span; ++k)
extras[k].q_sizes(j) = newSizes[k];
@@ -202,11 +202,12 @@ void QGridLayoutRowData::distributeMultiCells()
void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSize, qreal *positions,
qreal *sizes, qreal *descents,
- const QGridLayoutBox &totalBox)
+ const QGridLayoutBox &totalBox,
+ const QGridLayoutRowInfo &rowInfo)
{
Q_ASSERT(end > start);
- targetSize = qBound(totalBox.q_minimumSize, targetSize, totalBox.q_maximumSize);
+ targetSize = qMax(totalBox.q_minimumSize, targetSize);
int n = end - start;
QVarLengthArray newSizes(n);
@@ -246,16 +247,22 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
}
}
} else {
- stealBox(start, end, PreferredSize, positions, sizes);
+ bool isLargerThanMaximum = (targetSize > totalBox.q_maximumSize);
+ if (isLargerThanMaximum) {
+ stealBox(start, end, MaximumSize, positions, sizes);
+ sumAvailable = targetSize - totalBox.q_maximumSize;
+ } else {
+ stealBox(start, end, PreferredSize, positions, sizes);
+ sumAvailable = targetSize - totalBox.q_preferredSize;
+ }
- sumAvailable = targetSize - totalBox.q_preferredSize;
if (sumAvailable > 0.0) {
qreal sumCurrentAvailable = sumAvailable;
bool somethingHasAMaximumSize = false;
- qreal sumPreferredSizes = 0.0;
+ qreal sumSizes = 0.0;
for (int i = 0; i < n; ++i)
- sumPreferredSizes += sizes[i];
+ sumSizes += sizes[i];
for (int i = 0; i < n; ++i) {
if (ignore.testBit(start + i)) {
@@ -265,7 +272,16 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
}
const QGridLayoutBox &box = boxes.at(start + i);
- qreal desired = box.q_maximumSize - box.q_preferredSize;
+ qreal boxSize;
+
+ qreal desired;
+ if (isLargerThanMaximum) {
+ boxSize = box.q_maximumSize;
+ desired = rowInfo.boxes.value(start + i).q_maximumSize - boxSize;
+ } else {
+ boxSize = box.q_preferredSize;
+ desired = box.q_maximumSize - boxSize;
+ }
if (desired == 0.0) {
newSizes[i] = sizes[i];
factors[i] = 0.0;
@@ -284,17 +300,17 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
} else if (stretch <= 0) {
factors[i] = 0.0;
} else {
- qreal ultimatePreferredSize;
- qreal ultimateSumPreferredSizes;
- qreal x = ((stretch * sumPreferredSizes)
- - (sumStretches * box.q_preferredSize))
+ qreal ultimateSize;
+ qreal ultimateSumSizes;
+ qreal x = ((stretch * sumSizes)
+ - (sumStretches * boxSize))
/ (sumStretches - stretch);
if (x >= 0.0) {
- ultimatePreferredSize = box.q_preferredSize + x;
- ultimateSumPreferredSizes = sumPreferredSizes + x;
+ ultimateSize = boxSize + x;
+ ultimateSumSizes = sumSizes + x;
} else {
- ultimatePreferredSize = box.q_preferredSize;
- ultimateSumPreferredSizes = (sumStretches * box.q_preferredSize)
+ ultimateSize = boxSize;
+ ultimateSumSizes = (sumStretches * boxSize)
/ stretch;
}
@@ -303,17 +319,17 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
(at the expense of the stretch factors, which are not fully respected
during the transition).
*/
- ultimatePreferredSize = ultimatePreferredSize * 3 / 2;
- ultimateSumPreferredSizes = ultimateSumPreferredSizes * 3 / 2;
+ ultimateSize = ultimateSize * 3 / 2;
+ ultimateSumSizes = ultimateSumSizes * 3 / 2;
- qreal beta = ultimateSumPreferredSizes - sumPreferredSizes;
+ qreal beta = ultimateSumSizes - sumSizes;
if (!beta) {
factors[i] = 1;
} else {
qreal alpha = qMin(sumCurrentAvailable, beta);
- qreal ultimateFactor = (stretch * ultimateSumPreferredSizes / sumStretches)
- - (box.q_preferredSize);
- qreal transitionalFactor = sumCurrentAvailable * (ultimatePreferredSize - box.q_preferredSize) / beta;
+ qreal ultimateFactor = (stretch * ultimateSumSizes / sumStretches)
+ - (boxSize);
+ qreal transitionalFactor = sumCurrentAvailable * (ultimateSize - boxSize) / beta;
factors[i] = ((alpha * ultimateFactor)
+ ((beta - alpha) * transitionalFactor)) / beta;
@@ -336,11 +352,16 @@ void QGridLayoutRowData::calculateGeometries(int start, int end, qreal targetSiz
if (newSizes[i] >= 0.0)
continue;
- const QGridLayoutBox &box = boxes.at(start + i);
+ qreal maxBoxSize;
+ if (isLargerThanMaximum)
+ maxBoxSize = rowInfo.boxes.value(start + i).q_maximumSize;
+ else
+ maxBoxSize = boxes.at(start + i).q_maximumSize;
+
qreal avail = sumCurrentAvailable * factors[i] / sumFactors;
- if (sizes[i] + avail >= box.q_maximumSize) {
- newSizes[i] = box.q_maximumSize;
- sumCurrentAvailable -= box.q_maximumSize - sizes[i];
+ if (sizes[i] + avail >= maxBoxSize) {
+ newSizes[i] = maxBoxSize;
+ sumCurrentAvailable -= maxBoxSize - sizes[i];
sumFactors -= factors[i];
keepGoing = (sumCurrentAvailable > 0.0);
if (!keepGoing)
@@ -1126,7 +1147,7 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi
//Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as
//constraints to find the row heights
q_columnData.calculateGeometries(0, columnCount(), width, sizehint_xx.data(), sizehint_widths.data(),
- 0, sizehint_totalBoxes[Hor]);
+ 0, sizehint_totalBoxes[Hor], q_infos[Hor]);
ensureColumnAndRowData(&q_rowData, &sizehint_totalBoxes[Ver], styleInfo, sizehint_xx.data(), sizehint_widths.data(), Qt::Vertical);
sizeHintCalculated = true;
}
@@ -1143,7 +1164,7 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi
//Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as
//constraints to find the column widths
q_rowData.calculateGeometries(0, rowCount(), height, sizehint_yy.data(), sizehint_heights.data(),
- 0, sizehint_totalBoxes[Ver]);
+ 0, sizehint_totalBoxes[Ver], q_infos[Ver]);
ensureColumnAndRowData(&q_columnData, &sizehint_totalBoxes[Hor], styleInfo, sizehint_yy.data(), sizehint_heights.data(), Qt::Vertical);
sizeHintCalculated = true;
}
@@ -1159,7 +1180,7 @@ QSizeF QGridLayoutEngine::sizeHint(const QLayoutStyleInfo &styleInfo, Qt::SizeHi
sizehint_totalBoxes[Hor] = q_totalBoxes[Hor];
sizehint_totalBoxes[Ver] = q_totalBoxes[Ver];
}
- }
+ }
switch (which) {
case Qt::MinimumSize:
@@ -1617,7 +1638,8 @@ void QGridLayoutEngine::ensureColumnAndRowData(QGridLayoutRowData *rowData, QGri
{
rowData->reset(rowCount(orientation));
fillRowData(rowData, styleInfo, colPositions, colSizes, orientation);
- rowData->distributeMultiCells();
+ const QGridLayoutRowInfo &rowInfo = q_infos[orientation == Qt::Vertical];
+ rowData->distributeMultiCells(rowInfo);
*totalBox = rowData->totalBox(0, rowCount(orientation));
//We have items whose width depends on their height
}
@@ -1686,22 +1708,22 @@ void QGridLayoutEngine::ensureGeometries(const QLayoutStyleInfo &styleInfo,
//Calculate column widths and positions, and put results in q_xx.data() and q_widths.data() so that we can use this information as
//constraints to find the row heights
q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(),
- 0, q_totalBoxes[Hor]);
+ 0, q_totalBoxes[Hor], q_infos[Hor] );
ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, q_xx.data(), q_widths.data(), Qt::Vertical);
//Calculate row heights and positions, and put results in q_yy.data() and q_heights.data()
q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(),
- q_descents.data(), q_totalBoxes[Ver]);
+ q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]);
} else {
//We have items whose height depends on their width
ensureColumnAndRowData(&q_rowData, &q_totalBoxes[Ver], styleInfo, NULL, NULL, Qt::Vertical);
//Calculate row heights and positions, and put results in q_yy.data() and q_heights.data() so that we can use this information as
//constraints to find the column widths
q_rowData.calculateGeometries(0, rowCount(), size.height(), q_yy.data(), q_heights.data(),
- q_descents.data(), q_totalBoxes[Ver]);
+ q_descents.data(), q_totalBoxes[Ver], q_infos[Ver]);
ensureColumnAndRowData(&q_columnData, &q_totalBoxes[Hor], styleInfo, q_yy.data(), q_heights.data(), Qt::Horizontal);
//Calculate row heights and positions, and put results in q_yy.data() and q_heights.data()
q_columnData.calculateGeometries(0, columnCount(), size.width(), q_xx.data(), q_widths.data(),
- 0, q_totalBoxes[Hor]);
+ 0, q_totalBoxes[Hor], q_infos[Hor]);
}
}
diff --git a/src/gui/graphicsview/qgridlayoutengine_p.h b/src/gui/graphicsview/qgridlayoutengine_p.h
index 02c74b0..44efbba 100644
--- a/src/gui/graphicsview/qgridlayoutengine_p.h
+++ b/src/gui/graphicsview/qgridlayoutengine_p.h
@@ -224,13 +224,16 @@ public:
typedef QMap, QGridLayoutMultiCellData> MultiCellMap;
+class QGridLayoutRowInfo;
+
class QGridLayoutRowData
{
public:
void reset(int count);
- void distributeMultiCells();
+ void distributeMultiCells(const QGridLayoutRowInfo &rowInfo);
void calculateGeometries(int start, int end, qreal targetSize, qreal *positions, qreal *sizes,
- qreal *descents, const QGridLayoutBox &totalBox);
+ qreal *descents, const QGridLayoutBox &totalBox,
+ const QGridLayoutRowInfo &rowInfo);
QGridLayoutBox totalBox(int start, int end) const;
void stealBox(int start, int end, int which, qreal *positions, qreal *sizes);
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 7170059..248778f 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -700,6 +700,10 @@ void tst_QGraphicsGridLayout::columnMaximumWidth()
layout->setContentsMargins(0, 0, 0, 0);
layout->setSpacing(0);
+ QCOMPARE(layout->minimumSize(), QSizeF(10+10+10, 10+10));
+ QCOMPARE(layout->preferredSize(), QSizeF(25+25+25, 25+25));
+ QCOMPARE(layout->maximumSize(), QSizeF(50+50+50, 50+50));
+
// should at least be a very large number
QVERIFY(layout->columnMaximumWidth(0) >= 10000);
QCOMPARE(layout->columnMaximumWidth(0), layout->columnMaximumWidth(1));
@@ -707,17 +711,65 @@ void tst_QGraphicsGridLayout::columnMaximumWidth()
layout->setColumnMaximumWidth(0, 20);
layout->setColumnMaximumWidth(2, 60);
- view.show();
- widget->show();
+ QCOMPARE(layout->minimumSize(), QSizeF(10+10+10, 10+10));
+ QCOMPARE(layout->preferredSize(), QSizeF(20+25+25, 25+25));
+ QCOMPARE(layout->maximumSize(), QSizeF(20+50+60, 50+50));
+ QCOMPARE(layout->maximumSize(), widget->maximumSize());
+
widget->resize(widget->effectiveSizeHint(Qt::PreferredSize));
- QApplication::processEvents();
+ layout->activate();
- QCOMPARE(layout->itemAt(0,0)->geometry().width(), 20.0);
- QCOMPARE(layout->itemAt(1,0)->geometry().width(), 20.0);
- QCOMPARE(layout->itemAt(0,1)->geometry().width(), 25.0);
- QCOMPARE(layout->itemAt(1,1)->geometry().width(), 25.0);
- QCOMPARE(layout->itemAt(0,2)->geometry().width(), 25.0);
- QCOMPARE(layout->itemAt(1,2)->geometry().width(), 25.0);
+ QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(0, 0, 20, 25));
+ QCOMPARE(layout->itemAt(1,0)->geometry(), QRectF(0, 25, 20, 25));
+ QCOMPARE(layout->itemAt(0,1)->geometry(), QRectF(20, 0, 25, 25));
+ QCOMPARE(layout->itemAt(1,1)->geometry(), QRectF(20, 25, 25, 25));
+ QCOMPARE(layout->itemAt(0,2)->geometry(), QRectF(45, 0, 25, 25));
+ QCOMPARE(layout->itemAt(1,2)->geometry(), QRectF(45, 25, 25, 25));
+
+ layout->setColumnAlignment(2, Qt::AlignCenter); //FIXME This shouldn't be needed because the documentation says that center is default
+ widget->resize(widget->effectiveSizeHint(Qt::MaximumSize));
+ layout->activate();
+ QCOMPARE(layout->geometry(), QRectF(0,0,20+50+60, 50+50));
+ QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(0, 0, 20, 50));
+ QCOMPARE(layout->itemAt(1,0)->geometry(), QRectF(0, 50, 20, 50));
+ QCOMPARE(layout->itemAt(0,1)->geometry(), QRectF(20, 0, 50, 50));
+ QCOMPARE(layout->itemAt(1,1)->geometry(), QRectF(20, 50, 50, 50));
+ QCOMPARE(layout->itemAt(0,2)->geometry(), QRectF(75, 0, 50, 50));
+ QCOMPARE(layout->itemAt(1,2)->geometry(), QRectF(75, 50, 50, 50));
+
+ for(int i = 0; i < layout->count(); i++)
+ layout->setAlignment(layout->itemAt(i), Qt::AlignRight | Qt::AlignBottom);
+ layout->activate();
+ QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(0, 0, 20, 50));
+ QCOMPARE(layout->itemAt(1,0)->geometry(), QRectF(0, 50, 20, 50));
+ QCOMPARE(layout->itemAt(0,1)->geometry(), QRectF(20, 0, 50, 50));
+ QCOMPARE(layout->itemAt(1,1)->geometry(), QRectF(20, 50, 50, 50));
+ QCOMPARE(layout->itemAt(0,2)->geometry(), QRectF(80, 0, 50, 50));
+ QCOMPARE(layout->itemAt(1,2)->geometry(), QRectF(80, 50, 50, 50));
+ for(int i = 0; i < layout->count(); i++)
+ layout->setAlignment(layout->itemAt(i), Qt::AlignCenter);
+
+ layout->setMaximumSize(layout->maximumSize() + QSizeF(60,60));
+ widget->resize(widget->effectiveSizeHint(Qt::MaximumSize));
+ layout->activate();
+
+ QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(0, 15, 20, 50));
+ QCOMPARE(layout->itemAt(1,0)->geometry(), QRectF(0, 95, 20, 50));
+ QCOMPARE(layout->itemAt(0,1)->geometry(), QRectF(20+30, 15, 50, 50));
+ QCOMPARE(layout->itemAt(1,1)->geometry(), QRectF(20+30, 95, 50, 50));
+ QCOMPARE(layout->itemAt(0,2)->geometry(), QRectF(20+60+50+5, 15, 50, 50));
+ QCOMPARE(layout->itemAt(1,2)->geometry(), QRectF(20+60+50+5, 95, 50, 50));
+
+ layout->setMaximumSize(layout->preferredSize() + QSizeF(20,20));
+ widget->resize(widget->effectiveSizeHint(Qt::MaximumSize));
+ layout->activate();
+
+ QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(0, 0, 20, 35));
+ QCOMPARE(layout->itemAt(1,0)->geometry(), QRectF(0, 35, 20, 35));
+ QCOMPARE(layout->itemAt(0,1)->geometry(), QRectF(20, 0, 35, 35));
+ QCOMPARE(layout->itemAt(1,1)->geometry(), QRectF(20, 35, 35, 35));
+ QCOMPARE(layout->itemAt(0,2)->geometry(), QRectF(55, 0, 35, 35));
+ QCOMPARE(layout->itemAt(1,2)->geometry(), QRectF(55, 35, 35, 35));
delete widget;
}
diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index 6107fa1..e271aee 100644
--- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -103,6 +103,8 @@ private slots:
void removeLayout();
void avoidRecursionInInsertItem();
void styleInfoLeak();
+ void testAlignmentInLargerLayout();
+ void testOffByOneInLargerLayout();
// Task specific tests
void task218400_insertStretchCrash();
@@ -1465,6 +1467,89 @@ void tst_QGraphicsLinearLayout::task218400_insertStretchCrash()
form->setLayout(layout); // crash
}
+void tst_QGraphicsLinearLayout::testAlignmentInLargerLayout()
+{
+ QGraphicsScene *scene = new QGraphicsScene;
+ QGraphicsWidget *form = new QGraphicsWidget;
+ scene->addItem(form);
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, form);
+ layout->setSpacing(0);
+ layout->setContentsMargins(0,0,0,0);
+
+ QGraphicsWidget *a = new QGraphicsWidget;
+ a->setMaximumSize(100,100);
+ layout->addItem(a);
+
+ QCOMPARE(form->maximumSize(), QSizeF(100,100));
+ QCOMPARE(layout->maximumSize(), QSizeF(100,100));
+ layout->setMinimumSize(QSizeF(200,200));
+ layout->setMaximumSize(QSizeF(200,200));
+
+ layout->setAlignment(a, Qt::AlignCenter);
+ layout->activate();
+ QCOMPARE(a->geometry(), QRectF(50,50,100,100));
+
+ layout->setAlignment(a, Qt::AlignRight | Qt::AlignBottom);
+ layout->activate();
+ QCOMPARE(a->geometry(), QRectF(100,100,100,100));
+
+ layout->setAlignment(a, Qt::AlignHCenter | Qt::AlignTop);
+ layout->activate();
+ QCOMPARE(a->geometry(), QRectF(50,0,100,100));
+
+ QGraphicsWidget *b = new QGraphicsWidget;
+ b->setMaximumSize(100,100);
+ layout->addItem(b);
+
+ layout->setAlignment(a, Qt::AlignCenter);
+ layout->setAlignment(b, Qt::AlignCenter);
+ layout->activate();
+ QCOMPARE(a->geometry(), QRectF(50,0,100,100));
+ QCOMPARE(b->geometry(), QRectF(50,100,100,100));
+
+ layout->setAlignment(a, Qt::AlignRight | Qt::AlignBottom);
+ layout->setAlignment(b, Qt::AlignLeft | Qt::AlignTop);
+ layout->activate();
+ QCOMPARE(a->geometry(), QRectF(100,0,100,100));
+ QCOMPARE(b->geometry(), QRectF(0,100,100,100));
+}
+
+void tst_QGraphicsLinearLayout::testOffByOneInLargerLayout() {
+ QGraphicsScene *scene = new QGraphicsScene;
+ QGraphicsWidget *form = new QGraphicsWidget;
+ scene->addItem(form);
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, form);
+ layout->setSpacing(0);
+ layout->setContentsMargins(0,0,0,0);
+
+ QGraphicsWidget *a = new QGraphicsWidget;
+ QGraphicsWidget *b = new QGraphicsWidget;
+ a->setMaximumSize(100,100);
+ b->setMaximumSize(100,100);
+ layout->addItem(a);
+ layout->addItem(b);
+
+ layout->setAlignment(a, Qt::AlignRight | Qt::AlignBottom);
+ layout->setAlignment(b, Qt::AlignLeft | Qt::AlignTop);
+ layout->setMinimumSize(QSizeF(101,201));
+ layout->setMaximumSize(QSizeF(101,201));
+ layout->activate();
+ QCOMPARE(a->geometry(), QRectF(1,0.5,100,100));
+ QCOMPARE(b->geometry(), QRectF(0,100.5,100,100));
+
+ layout->setMinimumSize(QSizeF(100,200));
+ layout->setMaximumSize(QSizeF(100,200));
+ layout->activate();
+ QCOMPARE(a->geometry(), QRectF(0,0,100,100));
+ QCOMPARE(b->geometry(), QRectF(0,100,100,100));
+
+ layout->setMinimumSize(QSizeF(99,199));
+ layout->setMaximumSize(QSizeF(99,199));
+ layout->activate();
+ QCOMPARE(a->geometry(), QRectF(0,0,99,99.5));
+ QCOMPARE(b->geometry(), QRectF(0,99.5,99,99.5));
+}
+
QTEST_MAIN(tst_QGraphicsLinearLayout)
#include "tst_qgraphicslinearlayout.moc"
--
cgit v0.12
From 1781b3c876b4e1025b2a85f4e7975c171b1a1404 Mon Sep 17 00:00:00 2001
From: John Tapsell
Date: Mon, 15 Nov 2010 12:55:13 +0100
Subject: Change the QGraphics*Layout documentation to match the code - that
the default alignment is top-left.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
This includes unit tests to confirm that the alignment is top-left in a
variety of different cases.
Merge-request: 894
Reviewed-by: Jan-Arve Sæther
---
src/gui/graphicsview/qgraphicsgridlayout.cpp | 11 ++++++
src/gui/graphicsview/qgraphicslinearlayout.cpp | 4 +-
.../tst_qgraphicsgridlayout.cpp | 45 +++++++++++++++++++++-
.../tst_qgraphicslinearlayout.cpp | 33 ++++++++++++++++
4 files changed, 89 insertions(+), 4 deletions(-)
diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp
index 3fc7f10..c3bb6c3 100644
--- a/src/gui/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp
@@ -64,6 +64,17 @@
removeAt() will remove an item from the layout, without
destroying it.
+ \section1 Size Hints and Size Policies in QGraphicsGridLayout
+
+ QGraphicsGridLayout respects each item's size hints and size policies,
+ and when the layout contains more space than the items can fill, each item
+ is arranged according to the layout's alignment for that item. You can set
+ an alignment for each item by calling setAlignment(), and check the
+ alignment for any item by calling alignment(). You can also set the alignment
+ for an entire row or column by calling setRowAlignment() and setColumnAlignment()
+ respectively. By default, items are aligned to the top left.
+
+
\sa QGraphicsLinearLayout, QGraphicsWidget
*/
diff --git a/src/gui/graphicsview/qgraphicslinearlayout.cpp b/src/gui/graphicsview/qgraphicslinearlayout.cpp
index 7e8d19f..244a728 100644
--- a/src/gui/graphicsview/qgraphicslinearlayout.cpp
+++ b/src/gui/graphicsview/qgraphicslinearlayout.cpp
@@ -75,7 +75,7 @@
is arranged according to the layout's alignment for that item. You can set
an alignment for each item by calling setAlignment(), and check the
alignment for any item by calling alignment(). By default, items are
- centered both vertically and horizontally.
+ aligned to the top left.
\section1 Spacing within QGraphicsLinearLayout
@@ -446,7 +446,7 @@ void QGraphicsLinearLayout::setAlignment(QGraphicsLayoutItem *item, Qt::Alignmen
/*!
Returns the alignment for \a item. The default alignment is
- Qt::AlignCenter.
+ Qt::AlignTop | Qt::AlignLeft.
The alignment decides how the item is positioned within its assigned space
in the case where there's more space available in the layout than the
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 248778f..8d1f282 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -123,6 +123,7 @@ private slots:
void heightForWidth();
void heightForWidthWithSpanning();
void stretchAndHeightForWidth();
+ void testDefaultAlignment();
};
class RectWidget : public QGraphicsWidget
@@ -726,7 +727,7 @@ void tst_QGraphicsGridLayout::columnMaximumWidth()
QCOMPARE(layout->itemAt(0,2)->geometry(), QRectF(45, 0, 25, 25));
QCOMPARE(layout->itemAt(1,2)->geometry(), QRectF(45, 25, 25, 25));
- layout->setColumnAlignment(2, Qt::AlignCenter); //FIXME This shouldn't be needed because the documentation says that center is default
+ layout->setColumnAlignment(2, Qt::AlignCenter);
widget->resize(widget->effectiveSizeHint(Qt::MaximumSize));
layout->activate();
QCOMPARE(layout->geometry(), QRectF(0,0,20+50+60, 50+50));
@@ -2859,7 +2860,6 @@ void tst_QGraphicsGridLayout::heightForWidthWithSpanning()
QCOMPARE(layout->effectiveSizeHint(Qt::MaximumSize, QSizeF(200, -1)), QSizeF(200, 10000));
}
-
void tst_QGraphicsGridLayout::stretchAndHeightForWidth()
{
QGraphicsWidget *widget = new QGraphicsWidget(0, Qt::Window);
@@ -2919,7 +2919,48 @@ void tst_QGraphicsGridLayout::stretchAndHeightForWidth()
}
+void tst_QGraphicsGridLayout::testDefaultAlignment()
+{
+ QGraphicsWidget *widget = new QGraphicsWidget;
+ QGraphicsGridLayout *layout = new QGraphicsGridLayout(widget);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0);
+
+ QGraphicsWidget *w = new QGraphicsWidget;
+ w->setMinimumSize(50,50);
+ w->setMaximumSize(50,50);
+ layout->addItem(w,0,0);
+
+ //Default alignment should be to the top-left
+ //First, check by forcing the layout to be bigger
+ layout->setMinimumSize(100,100);
+ layout->activate();
+ QCOMPARE(layout->geometry(), QRectF(0,0,100,100));
+ QCOMPARE(w->geometry(), QRectF(0,0,50,50));
+ layout->setMinimumSize(-1,-1);
+
+ //Second, check by forcing the column and row to be bigger instead
+ layout->setColumnMinimumWidth(0, 100);
+ layout->setRowMinimumHeight(0, 100);
+ layout->activate();
+ QCOMPARE(layout->geometry(), QRectF(0,0,100,100));
+ QCOMPARE(w->geometry(), QRectF(0,0,50,50));
+ layout->setMinimumSize(-1,-1);
+ layout->setColumnMinimumWidth(0, 0);
+ layout->setRowMinimumHeight(0, 0);
+
+
+ //Third, check by adding a larger item in the column
+ QGraphicsWidget *w2 = new QGraphicsWidget;
+ w2->setMinimumSize(100,100);
+ w2->setMaximumSize(100,100);
+ layout->addItem(w2,1,0);
+ layout->activate();
+ QCOMPARE(layout->geometry(), QRectF(0,0,100,150));
+ QCOMPARE(w->geometry(), QRectF(0,0,50,50));
+ QCOMPARE(w2->geometry(), QRectF(0,50,100,100));
+}
QTEST_MAIN(tst_QGraphicsGridLayout)
#include "tst_qgraphicsgridlayout.moc"
diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index e271aee..cbc90be 100644
--- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -105,6 +105,7 @@ private slots:
void styleInfoLeak();
void testAlignmentInLargerLayout();
void testOffByOneInLargerLayout();
+ void testDefaultAlignment();
// Task specific tests
void task218400_insertStretchCrash();
@@ -1549,6 +1550,38 @@ void tst_QGraphicsLinearLayout::testOffByOneInLargerLayout() {
QCOMPARE(a->geometry(), QRectF(0,0,99,99.5));
QCOMPARE(b->geometry(), QRectF(0,99.5,99,99.5));
}
+void tst_QGraphicsLinearLayout::testDefaultAlignment()
+{
+ QGraphicsWidget *widget = new QGraphicsWidget;
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical, widget);
+ layout->setContentsMargins(0, 0, 0, 0);
+ layout->setSpacing(0);
+
+ QGraphicsWidget *w = new QGraphicsWidget;
+ w->setMinimumSize(50,50);
+ w->setMaximumSize(50,50);
+ layout->addItem(w);
+
+ //Default alignment should be to the top-left
+ QCOMPARE(layout->alignment(w), 0);
+
+ //First, check by forcing the layout to be bigger
+ layout->setMinimumSize(100,100);
+ layout->activate();
+ QCOMPARE(layout->geometry(), QRectF(0,0,100,100));
+ QCOMPARE(w->geometry(), QRectF(0,0,50,50));
+ layout->setMinimumSize(-1,-1);
+
+ //Second, check by adding a larger item in the column
+ QGraphicsWidget *w2 = new QGraphicsWidget;
+ w2->setMinimumSize(100,100);
+ w2->setMaximumSize(100,100);
+ layout->addItem(w2);
+ layout->activate();
+ QCOMPARE(layout->geometry(), QRectF(0,0,100,150));
+ QCOMPARE(w->geometry(), QRectF(0,0,50,50));
+ QCOMPARE(w2->geometry(), QRectF(0,50,100,100));
+}
QTEST_MAIN(tst_QGraphicsLinearLayout)
#include "tst_qgraphicslinearlayout.moc"
--
cgit v0.12
From f0990583431166e721d038e150ba00b0edc4e105 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?=
Date: Mon, 15 Nov 2010 14:28:59 +0100
Subject: Some improvements to the docs that was added in merge request 894
---
src/gui/graphicsview/qgraphicsgridlayout.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/gui/graphicsview/qgraphicsgridlayout.cpp b/src/gui/graphicsview/qgraphicsgridlayout.cpp
index c3bb6c3..20ebab6 100644
--- a/src/gui/graphicsview/qgraphicsgridlayout.cpp
+++ b/src/gui/graphicsview/qgraphicsgridlayout.cpp
@@ -67,7 +67,7 @@
\section1 Size Hints and Size Policies in QGraphicsGridLayout
QGraphicsGridLayout respects each item's size hints and size policies,
- and when the layout contains more space than the items can fill, each item
+ and when a cell in the grid has more space than the items can fill, each item
is arranged according to the layout's alignment for that item. You can set
an alignment for each item by calling setAlignment(), and check the
alignment for any item by calling alignment(). You can also set the alignment
--
cgit v0.12
From 68fc0a299b9268007ae68f5d8a8dce40ed1e4e0c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?=
Date: Mon, 15 Nov 2010 14:33:51 +0100
Subject: Adhere to code style
---
tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp | 8 ++++----
tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 8d1f282..2e52c4e 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -704,7 +704,7 @@ void tst_QGraphicsGridLayout::columnMaximumWidth()
QCOMPARE(layout->minimumSize(), QSizeF(10+10+10, 10+10));
QCOMPARE(layout->preferredSize(), QSizeF(25+25+25, 25+25));
QCOMPARE(layout->maximumSize(), QSizeF(50+50+50, 50+50));
-
+
// should at least be a very large number
QVERIFY(layout->columnMaximumWidth(0) >= 10000);
QCOMPARE(layout->columnMaximumWidth(0), layout->columnMaximumWidth(1));
@@ -738,7 +738,7 @@ void tst_QGraphicsGridLayout::columnMaximumWidth()
QCOMPARE(layout->itemAt(0,2)->geometry(), QRectF(75, 0, 50, 50));
QCOMPARE(layout->itemAt(1,2)->geometry(), QRectF(75, 50, 50, 50));
- for(int i = 0; i < layout->count(); i++)
+ for (int i = 0; i < layout->count(); i++)
layout->setAlignment(layout->itemAt(i), Qt::AlignRight | Qt::AlignBottom);
layout->activate();
QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(0, 0, 20, 50));
@@ -747,13 +747,13 @@ void tst_QGraphicsGridLayout::columnMaximumWidth()
QCOMPARE(layout->itemAt(1,1)->geometry(), QRectF(20, 50, 50, 50));
QCOMPARE(layout->itemAt(0,2)->geometry(), QRectF(80, 0, 50, 50));
QCOMPARE(layout->itemAt(1,2)->geometry(), QRectF(80, 50, 50, 50));
- for(int i = 0; i < layout->count(); i++)
+ for (int i = 0; i < layout->count(); i++)
layout->setAlignment(layout->itemAt(i), Qt::AlignCenter);
layout->setMaximumSize(layout->maximumSize() + QSizeF(60,60));
widget->resize(widget->effectiveSizeHint(Qt::MaximumSize));
layout->activate();
-
+
QCOMPARE(layout->itemAt(0,0)->geometry(), QRectF(0, 15, 20, 50));
QCOMPARE(layout->itemAt(1,0)->geometry(), QRectF(0, 95, 20, 50));
QCOMPARE(layout->itemAt(0,1)->geometry(), QRectF(20+30, 15, 50, 50));
diff --git a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index cbc90be..965e340 100644
--- a/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/auto/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -1543,7 +1543,7 @@ void tst_QGraphicsLinearLayout::testOffByOneInLargerLayout() {
layout->activate();
QCOMPARE(a->geometry(), QRectF(0,0,100,100));
QCOMPARE(b->geometry(), QRectF(0,100,100,100));
-
+
layout->setMinimumSize(QSizeF(99,199));
layout->setMaximumSize(QSizeF(99,199));
layout->activate();
--
cgit v0.12
From 96b1ea7088f8d541bc4c5fbc87baaf56b0b2fd43 Mon Sep 17 00:00:00 2001
From: Morten Engvoldsen
Date: Mon, 15 Nov 2010 18:34:38 +0100
Subject: Doc: Correcting references to Qt Declarative module.
---
doc/src/declarative/declarativeui.qdoc | 8 ++++----
doc/src/declarative/elements.qdoc | 2 +-
doc/src/declarative/extending-tutorial.qdoc | 4 ++--
doc/src/declarative/qtbinding.qdoc | 12 ++++++------
doc/src/declarative/qtdeclarative.qdoc | 2 +-
doc/src/getting-started/gettingstartedqml.qdoc | 2 +-
doc/src/qt4-intro.qdoc | 2 +-
7 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc
index 28a8a70..eb469d6 100644
--- a/doc/src/declarative/declarativeui.qdoc
+++ b/doc/src/declarative/declarativeui.qdoc
@@ -45,7 +45,7 @@ language for describing user interfaces and a language runtime. A collection
of C++ APIs is used to integrate these high level features with classic
Qt applications.
-\section2 QML, Elements and the QtDeclarative Module
+\section2 QML, Elements and the Qt Declarative Module
User interfaces and their behavior are described using QML, an extension to
\l{About JavaScript}{JavaScript} that lets developers and designers
@@ -60,14 +60,14 @@ QObject-based type system, adds support for automatic
\l{Property Binding}{property bindings} and provides
\l{Network Transparency}{network transparency} at the language level.
-The QtDeclarative module implements the interface between the QML language
+The Qt Declarative module implements the interface between the QML language
and the elements available to it. It also provides a C++ API that can be
used to load and interact with QML files from within Qt applications.
Qt Quick builds on \l{QML for Qt programmers}{Qt's existing strengths}.
QML can be be used to incrementally extend an existing application or
to build completely new applications. QML is fully
-\l{Extending QML in C++}{extensible from C++} through the QtDeclarative
+\l{Extending QML in C++}{extensible from C++} through the Qt Declarative
Module.
\section1 Getting Started
@@ -139,7 +139,7 @@ Module.
\o \l{QML Global Object}
\o \l{QML Internationalization}
\o \l{QML Security}
-\o \l{QtDeclarative Module}
+\o \l{Qt Declarative Module}
\o \l{Debugging QML}
\o \l{QML Viewer}
\o \l{QML Performance}
diff --git a/doc/src/declarative/elements.qdoc b/doc/src/declarative/elements.qdoc
index 54f07a2..eaa6a82 100644
--- a/doc/src/declarative/elements.qdoc
+++ b/doc/src/declarative/elements.qdoc
@@ -32,7 +32,7 @@
\brief A dictionary of standard QML elements.
This is a dictionary of all standard QML elements made available
- in the QtDeclarative module.
+ in the Qt Declarative module.
To see the QML elements listed by functional area, see the
\l{Groups Of Related QML Elements} page.
diff --git a/doc/src/declarative/extending-tutorial.qdoc b/doc/src/declarative/extending-tutorial.qdoc
index 2bfe62e..dff1d9c 100644
--- a/doc/src/declarative/extending-tutorial.qdoc
+++ b/doc/src/declarative/extending-tutorial.qdoc
@@ -29,7 +29,7 @@
\page qml-extending-tutorial-index.html
\title Tutorial: Writing QML extensions with C++
-The QtDeclarative module provides a set of APIs for extending QML through
+The Qt Declarative module provides a set of APIs for extending QML through
C++ extensions. You can write extensions to add your own QML types, extend existing
Qt types, or call C/C++ functions that are not accessible from ordinary QML code.
@@ -65,7 +65,7 @@ For example, this could be done to implement particular data models, or provide
elements with custom painting and drawing capabilities, or access system features
like network programming that are not accessible through built-in QML features.
-In this tutorial, we will show how to use the C++ classes in the QtDeclarative
+In this tutorial, we will show how to use the C++ classes in the Qt Declarative
module to extend QML. The end result will be a simple Pie Chart display implemented by
several custom QML types connected together through QML features like bindings and
signals, and made available to the QML runtime through a plugin.
diff --git a/doc/src/declarative/qtbinding.qdoc b/doc/src/declarative/qtbinding.qdoc
index 8a969eb..cd50503 100644
--- a/doc/src/declarative/qtbinding.qdoc
+++ b/doc/src/declarative/qtbinding.qdoc
@@ -31,7 +31,7 @@
\title Using QML in C++ Applications
QML is designed to be easily extensible from C++. The classes in the
-QtDeclarative module allow QML components to be loaded and manipulated from C++, and through
+Qt Declarative module allow QML components to be loaded and manipulated from C++, and through
Qt's \l{The Meta-Object System}{meta-object system}, QML and C++ objects can easily
communicate through Qt signals and slots. In addition, QML plugins can be written to create
reusable QML components for distribution.
@@ -41,20 +41,20 @@ You may want to mix QML and C++ for a number of reasons. For example:
\list
\o To use functionality defined in a C++ source (for example, when using a C++ Qt-based data model, or
calling functions in a third-party C++ library)
-\o To access functionality in the QtDeclarative module (for example, to dynamically generate
+\o To access functionality in the Qt Declarative module (for example, to dynamically generate
images using QDeclarativeImageProvider)
\o To write your own QML elements (whether for your applications, or for distribution to others)
\endlist
-To use the QtDeclarative module, you must include and link to the module appropriately, as shown on
+To use the Qt Declarative module, you must include and link to the module appropriately, as shown on
the \l {QtDeclarative}{module index page}. The \l {Qt Declarative UI Runtime} documentation
shows how to build a basic C++ application that uses this module.
\section1 Core module classes
-The QtDeclarative module provides a set of C++ APIs for extending your QML applications from C++ and
-embedding QML into C++ applications. There are several core classes in the QtDeclarative module
+The Qt Declarative module provides a set of C++ APIs for extending your QML applications from C++ and
+embedding QML into C++ applications. There are several core classes in the Qt Declarative module
that provide the essential capabilities for doing this. These are:
\list
@@ -520,7 +520,7 @@ a QColor-type property or to call a C++ function that requires a QColor paramete
\section1 Writing QML plugins
-The QtDeclarative module includes the QDeclarativeExtensionPlugin class, which is an abstract
+The Qt Declarative module includes the QDeclarativeExtensionPlugin class, which is an abstract
class for writing QML plugins. This allows QML extension types to be dynamically loaded into
QML applications.
diff --git a/doc/src/declarative/qtdeclarative.qdoc b/doc/src/declarative/qtdeclarative.qdoc
index 7ecdc53..f2b2032 100644
--- a/doc/src/declarative/qtdeclarative.qdoc
+++ b/doc/src/declarative/qtdeclarative.qdoc
@@ -27,7 +27,7 @@
/*!
\module QtDeclarative
- \title QtDeclarative Module
+ \title Qt Declarative Module
\ingroup modules
\brief The Qt Declarative module provides a declarative framework
diff --git a/doc/src/getting-started/gettingstartedqml.qdoc b/doc/src/getting-started/gettingstartedqml.qdoc
index 54fa098..b767587 100644
--- a/doc/src/getting-started/gettingstartedqml.qdoc
+++ b/doc/src/getting-started/gettingstartedqml.qdoc
@@ -42,7 +42,7 @@
installation instructions and requirements for different platforms.
Qt Quick includes a declarative language called
- \l{Introduction to the QML language}{QML}, the \l{QtDeclarative Module}, and
+ \l{Introduction to the QML language}{QML}, the \l{Qt Declarative Module}, and
\l{QML Viewer}.
\section1 QML to Build User Interfaces
diff --git a/doc/src/qt4-intro.qdoc b/doc/src/qt4-intro.qdoc
index 2384051..62decbb 100644
--- a/doc/src/qt4-intro.qdoc
+++ b/doc/src/qt4-intro.qdoc
@@ -466,7 +466,7 @@
collaborate tightly and create animated and fluid user experiences,
using existing knowledge in script language and design.
- \i QtDeclarative is a C++ library that provides the underlying engine,
+ \i Qt Declarative is a C++ library that provides the underlying engine,
which translates the declarative description of the UI in QML into
items on a QGraphicsScene. The library also provides APIs to bind
custom C++ types and elements to QML, and to connect the QML UI with
--
cgit v0.12
From 013fe9236fbc54eb40a19461cfa65d5fb8334f06 Mon Sep 17 00:00:00 2001
From: Morten Engvoldsen
Date: Mon, 15 Nov 2010 18:41:15 +0100
Subject: Doc: correcting heading - Beginning Qt Quick - into - Intro to Qt
Quick
---
doc/src/declarative/declarativeui.qdoc | 2 +-
doc/src/declarative/qml-intro.qdoc | 2 +-
doc/src/declarative/qmlinuse.qdoc | 499 +++++++++++++++++++++++++++++++++
3 files changed, 501 insertions(+), 2 deletions(-)
create mode 100644 doc/src/declarative/qmlinuse.qdoc
diff --git a/doc/src/declarative/declarativeui.qdoc b/doc/src/declarative/declarativeui.qdoc
index eb469d6..01e1302 100644
--- a/doc/src/declarative/declarativeui.qdoc
+++ b/doc/src/declarative/declarativeui.qdoc
@@ -77,7 +77,7 @@ Module.
\o \l{Introduction to the QML language}
\o \l{QML for Qt Programmers}
\o \l{Getting Started Programming with QML}
-\o \l{Beginning Qt Quick}
+\o \l{Intro to Qt Quick}
\endlist
\list
diff --git a/doc/src/declarative/qml-intro.qdoc b/doc/src/declarative/qml-intro.qdoc
index f891e01..e02ce8f 100644
--- a/doc/src/declarative/qml-intro.qdoc
+++ b/doc/src/declarative/qml-intro.qdoc
@@ -29,7 +29,7 @@
/*!
\page qml-intro.html
-\title Beginning Qt Quick
+\title Intro to Qt Quick
\section1 Overview
diff --git a/doc/src/declarative/qmlinuse.qdoc b/doc/src/declarative/qmlinuse.qdoc
new file mode 100644
index 0000000..90ce02c
--- /dev/null
+++ b/doc/src/declarative/qmlinuse.qdoc
@@ -0,0 +1,499 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** Commercial Usage
+** Licensees holding valid Qt Commercial licenses may use this file in
+** accordance with the Qt Commercial License Agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in a
+** written agreement between you and Nokia.
+**
+** GNU Free Documentation License
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of this
+** file.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+/*!
+\page qmlinuse.html
+\title Using QML elements
+
+\raw HTML
+
+
+
+
+ Groups Of Related QML Elements
+
+ QML Elements are grouped by their respective functionalities. Certain elements are
+ suited for building complex components while other elements strictly dictate appearances
+ and color.
+
+
+
+ add something about elements in use in general
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+ Basic elements can be extended to form more complex elements.
+
Elements:
+
+ - Item Element
+ - The Item is the most basic of all visual items in QML. Many visual elements inherit
+ properties from the Item element.
+ - Component Element
+ - The Component element encapsulates a QML component definition.
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+ Visual elements offer various interactive and graphical functionalities. Visual
+ elements can directly set properties that dictate appearances.
+
Elements:
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+ Animation and transition elements control animation behaviors. Animations can run
+ in parallel or in series for different value types.
+
+
Elements:
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+ These elements define basic interactions such as touch movements and focus management.
+
Elements:
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+ Key and mouse events information are provided in these event elements.
+
Elements:
+
+ - KeyEvent Element - The KeyEvent
+ object provides information about a key event.
+ - MouseEvent Element - The MouseEvent
+ object provides information about a mouse event.
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+ Using positioning elements, layouts can be defined and their children accessed through
+ an index.
+
Elements:
+
+ - Column Element - The Column
+ item arranges its children vertically.
+ - Flow Element - The Flow item
+ arranges its children side by side, wrapping as necessary.
+ - Grid Element - The Grid item
+ positions its children in a grid.
+ - Row Element - The Row item
+ arranges its children horizontally.
+ - Repeater Element - The Repeater element allows you to repeat an Item-based component using a model.
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+
+ States and groups of states are formed using state elements.
+
Elements:
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+ Advanced handling of transformations is controlled in transform elements.
+
Elements:
+
+ - Rotation Element - The Rotation object provides a way to rotate an Item.
+ - Scale Element - The Scale element provides a way to scale an Item.
+ - Transform Element - The Transform element provide a way of building advanced transformations on Items.
+ - Translate Element - The Translate object provides a way to move an Item without changing its x or y properties.
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+ These elements handle assorted operations such as event timing, Qt enumerations,
+ and font loading.
+
Elements:
+
+ - Binding Element - The Binding element allows arbitrary property bindings to be created.
+ - Connections Element - A Connections element describes generalized connections to signals.
+ - DoubleValidator Element - Provides a validator for non-integer numbers.
+ - FontLoader Element - The FontLoader element allows fonts to be loaded by name or URL.
+ - IntValidator Element - This element provides a validator for integer values.
+ - LayoutItem Element - The LayoutItem element allows declarative UI elements to be placed inside Qt's Graphics View layouts.
+ - Loader Element - The Loader item allows dynamically loading an Item-based subtree from a URL or Component.
+ - Package Element - Package provides a bundle for shared contexts in multiple views.
+ - Qt Element - The QML global Qt object provides useful enums and functions from Qt.
+ - QtObject Element - The QtObject element is the most basic element in QML.
+ - RegExpValidator Element - This element provides a validator for regular expressions.
+ - SystemPalette Element - The SystemPalette element provides access to the Qt palettes.
+ - Timer Element - The Timer item triggers a handler at a specified interval.
+ - WorkerScript Element - The WorkerScript element enables the use of threads in QML.
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+ Models and views are used to organize data and control their layouts using delegates.
+ Models dictate the data formation and views control the layouts of data in the model.
+
View Elements:
+
+ - GridView Element - The GridView item provides a grid view of items provided by a model.
+ - ListView Element - The ListView item provides a list view of items provided by a model.
+ - PathView Element - The PathView element lays out model-provided items on a path.
+ - WebView Element - The WebView item allows you to add Web content to a canvas.
+
+
Model Elements:
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+ QML components can be arranged along paths. Path elements allow control over different
+ path types.
+
Elements:
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+ Particle effects are declared and controlled using particle elements.
+
Elements:
+
+
+
+
+
+
+
+
+
+
+ image heading
+
+
+ img descr.
+
+
+
+
+
+
+ Bridge elements allow direct communication between C++ and QML entities.
+
Elements:
+
+ - LayoutItem Element - The LayoutItem element allows declarative UI elements to be placed inside Qt's Graphics View layouts.
+
+
+
+
+\endraw
+
+
+
+*/
+
--
cgit v0.12
From a40e77495612db0b89730debbacc585a22d0eb3a Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt
Date: Tue, 16 Nov 2010 13:27:57 +0100
Subject: Fix possible missing glyphs in text when using GL engine
If you create/destroy gl contexts a lot, you may sometimes get a new
context with the same pointer as a destroyed context. When you look up
the glyph cache in the font engine using the context pointer as a key,
you will then get a glyph cache which contains no valid data. We need
to reset the glyph cache completely in this case and set up bindings for
the new context so that the glyph cache can be repopulated and reused.
Note that there is a different solution for this in Qt 4.8, so this is
temporary solution for the Qt 4.7.x series.
Task-number: QT-4162
Reviewed-by: Fabien Freling
---
src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 ++
src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 9 ++++++++-
src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h | 15 ++++++++++++++-
3 files changed, 24 insertions(+), 2 deletions(-)
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 1dcb773..73915cb 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1479,6 +1479,8 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
if (!cache || cache->cacheType() != glyphType) {
cache = new QGLTextureGlyphCache(ctx, glyphType, QTransform());
staticTextItem->fontEngine()->setGlyphCache(ctx, cache);
+ } else if (cache->context() == 0) { // Old context has been destroyed, new context has same ptr value
+ cache->setContext(ctx);
}
bool recreateVertexArrays = false;
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
index 919c542..28e8c40 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
@@ -54,11 +54,18 @@ extern Q_GUI_EXPORT bool qt_cleartype_enabled;
QGLTextureGlyphCache::QGLTextureGlyphCache(QGLContext *context, QFontEngineGlyphCache::Type type, const QTransform &matrix)
: QImageTextureGlyphCache(type, matrix)
- , ctx(context)
+ , ctx(0)
, m_width(0)
, m_height(0)
, m_filterMode(Nearest)
{
+ setContext(context);
+}
+
+void QGLTextureGlyphCache::setContext(QGLContext *context)
+{
+ ctx = context;
+
// broken FBO readback is a bug in the SGX 1.3 and 1.4 drivers for the N900 where
// copying between FBO's is broken if the texture is either GL_ALPHA or POT. The
// workaround is to use a system-memory copy of the glyph cache for this device.
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
index e22146d..fa2b091 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
@@ -90,6 +90,9 @@ public:
FilterMode filterMode() const { return m_filterMode; }
void setFilterMode(FilterMode m) { m_filterMode = m; }
+ void setContext(QGLContext *context);
+ QGLContext *context() const { return ctx; }
+
public Q_SLOTS:
void contextDestroyed(const QGLContext *context) {
if (context == ctx) {
@@ -98,10 +101,20 @@ public Q_SLOTS:
// the context may not be current, so we cannot directly
// destroy the fbo and texture here, but since the context
// is about to be destroyed, the GL server will do the
- // clean up for us anyway
+ // clean up for us anyway. We reset everything, so that the
+ // glyph cache object can be reused later by setting a new
+ // context on it.
m_fbo = 0;
m_texture = 0;
ctx = 0;
+ m_width = 0;
+ m_height = 0;
+ m_w = 0;
+ m_h = 0;
+ m_cx = 0;
+ m_cy = 0;
+ m_currentRowHeight = 0;
+ coords.clear();
} else {
// since the context holding the texture is shared, and
// about to be destroyed, we have to transfer ownership
--
cgit v0.12
From e963a1365d495649a1c8930f4776c78781218881 Mon Sep 17 00:00:00 2001
From: Sergio Ahumada
Date: Tue, 16 Nov 2010 21:47:14 +0100
Subject: Doc: Fixing typo
---
src/gui/graphicsview/qgraphicstransform.cpp | 2 +-
src/gui/kernel/qapplication_win.cpp | 4 ++--
src/gui/kernel/qclipboard_mac.cpp | 2 +-
src/gui/kernel/qevent.cpp | 2 +-
src/gui/kernel/qgesturemanager.cpp | 2 +-
src/gui/kernel/qgesturemanager_p.h | 2 +-
src/gui/kernel/qguiplatformplugin.cpp | 2 +-
src/gui/kernel/qkeymapper_mac.cpp | 2 +-
src/gui/kernel/qkeysequence.cpp | 2 +-
src/gui/kernel/qwidget.cpp | 4 ++--
src/gui/kernel/qwidget_s60.cpp | 2 +-
src/gui/kernel/qx11embed_x11.cpp | 2 +-
src/gui/util/qundostack.cpp | 2 +-
src/network/ssl/qsslsocket_openssl.cpp | 2 +-
src/plugins/bearer/symbian/symbianengine.cpp | 2 +-
src/plugins/graphicssystems/meego/qmeegographicssystem.cpp | 2 +-
src/script/api/qscriptcontextinfo.cpp | 2 +-
src/xmlpatterns/expr/qarithmeticexpression_p.h | 2 +-
tests/auto/collections/tst_collections.cpp | 2 +-
tools/assistant/tools/assistant/helpenginewrapper.cpp | 2 +-
20 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp
index 1f155c6..d495da2 100644
--- a/src/gui/graphicsview/qgraphicstransform.cpp
+++ b/src/gui/graphicsview/qgraphicstransform.cpp
@@ -54,7 +54,7 @@
instances to one QGraphicsItem. Each QGraphicsTransform is applied in
order, one at a time, to the QGraphicsItem it's assigned to.
- QGraphicsTransform is particularily useful for animations. Whereas
+ QGraphicsTransform is particularly useful for animations. Whereas
QGraphicsItem::setTransform() lets you assign any transform directly to an
item, there is no direct way to interpolate between two different
transformations (e.g., when transitioning between two states, each for
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 78028eb..10c4ed6 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -3269,7 +3269,7 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
if (type == QEvent::MouseButtonPress
&& QApplication::activePopupWidget() != activePopupWidget
&& replayPopupMouseEvent) {
- // the popup dissappeared. Replay the event
+ // the popup disappeared. Replay the event
QWidget* w = QApplication::widgetAt(gpos.x, gpos.y);
if (w && !QApplicationPrivate::isBlockedByModal(w)) {
Q_ASSERT(w->testAttribute(Qt::WA_WState_Created));
@@ -3506,7 +3506,7 @@ static void tabletInit(const quint64 uniqueId, const UINT csr_type, HCTX hTab)
}
#endif // QT_NO_TABLETEVENT
-// Update the "dynamic" informations of a cursor device (pen, airbrush, etc).
+// Update the "dynamic" information of a cursor device (pen, airbrush, etc).
// The dynamic information is the information of QTabletDeviceData that can change
// in time (eraser or pen if a device is turned around).
#ifndef QT_NO_TABLETEVENT
diff --git a/src/gui/kernel/qclipboard_mac.cpp b/src/gui/kernel/qclipboard_mac.cpp
index 49a6cc8..482a3a3 100644
--- a/src/gui/kernel/qclipboard_mac.cpp
+++ b/src/gui/kernel/qclipboard_mac.cpp
@@ -623,7 +623,7 @@ QMacPasteboard::sync() const
#ifdef DEBUG_PASTEBOARD
if(fromGlobal)
- qDebug("Pasteboard: Syncronize!");
+ qDebug("Pasteboard: Synchronize!");
#endif
return fromGlobal;
}
diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp
index eade02e..7fdb926 100644
--- a/src/gui/kernel/qevent.cpp
+++ b/src/gui/kernel/qevent.cpp
@@ -1970,7 +1970,7 @@ void QInputMethodEvent::setCommitString(const QString &commitString, int replace
is usually given by a wheel on 4D mouse. If the device does not support a
Z-axis, pass zero here.
- The \a tangentialPressure paramater contins the tangential pressure of an air
+ The \a tangentialPressure parameter contins the tangential pressure of an air
brush. If the device does not support tangential pressure, pass 0 here.
\a rotation contains the device's rotation in degrees. 4D mice support
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index 9519447..46450b1 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -189,7 +189,7 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ
QGesture *QGestureManager::getState(QObject *object, QGestureRecognizer *recognizer, Qt::GestureType type)
{
// if the widget is being deleted we should be careful not to
- // create a new state, as it will create QWeakPointer which doesnt work
+ // create a new state, as it will create QWeakPointer which doesn't work
// from the destructor.
if (object->isWidgetType()) {
if (static_cast(object)->d_func()->data.in_destructor)
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
index a5a3482..92310f5 100644
--- a/src/gui/kernel/qgesturemanager_p.h
+++ b/src/gui/kernel/qgesturemanager_p.h
@@ -101,7 +101,7 @@ private:
NotGesture,
MaybeGesture // this means timers are up and waiting for some
// more events, and input events are handled by
- // gesture recognizer explicitely
+ // gesture recognizer explicitly
} state;
struct ObjectGesture
diff --git a/src/gui/kernel/qguiplatformplugin.cpp b/src/gui/kernel/qguiplatformplugin.cpp
index 2dd251b..c80c6d3 100644
--- a/src/gui/kernel/qguiplatformplugin.cpp
+++ b/src/gui/kernel/qguiplatformplugin.cpp
@@ -187,7 +187,7 @@ QString QGuiPlatformPlugin::styleName()
#endif
}
-/* return an aditional default palette (only work on X11) */
+/* return an additional default palette (only work on X11) */
QPalette QGuiPlatformPlugin::palette()
{
#ifdef Q_WS_X11
diff --git a/src/gui/kernel/qkeymapper_mac.cpp b/src/gui/kernel/qkeymapper_mac.cpp
index 300e5ca..b8f08bf 100644
--- a/src/gui/kernel/qkeymapper_mac.cpp
+++ b/src/gui/kernel/qkeymapper_mac.cpp
@@ -765,7 +765,7 @@ bool QKeyMapperPrivate::translateKeyEvent(QWidget *widget, EventHandlerCallRef e
&handled_event) == false)
return handled_event;
QString text(ourChar);
- /* This is actually wrong - but unfortunatly it is the best that can be
+ /* This is actually wrong - but unfortunately it is the best that can be
done for now because of the Control/Meta mapping problems */
if (modifiers & (Qt::ControlModifier | Qt::MetaModifier)
&& !qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) {
diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp
index 50b2354..bf3eddd 100644
--- a/src/gui/kernel/qkeysequence.cpp
+++ b/src/gui/kernel/qkeysequence.cpp
@@ -1105,7 +1105,7 @@ QKeySequence QKeySequence::mnemonic(const QString &text)
#else
found = true;
} else {
- qWarning("QKeySequence::mnemonic: \"%s\" contains multiple occurences of '&'", qPrintable(text));
+ qWarning("QKeySequence::mnemonic: \"%s\" contains multiple occurrences of '&'", qPrintable(text));
#endif
}
}
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index e22ec55..39c734e 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -8836,7 +8836,7 @@ void QWidget::mousePressEvent(QMouseEvent *event)
QWidget* w;
while ((w = QApplication::activePopupWidget()) && w != this){
w->close();
- if (QApplication::activePopupWidget() == w) // widget does not want to dissappear
+ if (QApplication::activePopupWidget() == w) // widget does not want to disappear
w->hide(); // hide at least
}
if (!rect().contains(event->pos())){
@@ -9305,7 +9305,7 @@ void QWidget::setInputMethodHints(Qt::InputMethodHints hints)
#ifndef QT_NO_IM
Q_D(QWidget);
d->imHints = hints;
- // Optimisation to update input context only it has already been created.
+ // Optimization to update input context only it has already been created.
if (d->ic || qApp->d_func()->inputContext) {
QInputContext *ic = inputContext();
if (ic)
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index cf4bdf1..97917ba 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -57,7 +57,7 @@
#include
#endif
-// This is necessary in order to be able to perform delayed invokation on slots
+// This is necessary in order to be able to perform delayed invocation on slots
// which take arguments of type WId. One example is
// QWidgetPrivate::_q_delayedDestroy, which is used to delay destruction of
// CCoeControl objects until after the CONE event handler has finished running.
diff --git a/src/gui/kernel/qx11embed_x11.cpp b/src/gui/kernel/qx11embed_x11.cpp
index 9f1b1f8..e6e3bfb 100644
--- a/src/gui/kernel/qx11embed_x11.cpp
+++ b/src/gui/kernel/qx11embed_x11.cpp
@@ -1136,7 +1136,7 @@ void QX11EmbedContainer::paintEvent(QPaintEvent *)
/*! \internal
- Returns wether or not the windows' embedded flag is set.
+ Returns whether or not the windows' embedded flag is set.
*/
bool QX11EmbedContainerPrivate::isEmbedded() const
{
diff --git a/src/gui/util/qundostack.cpp b/src/gui/util/qundostack.cpp
index 919ac3c..04cfca9 100644
--- a/src/gui/util/qundostack.cpp
+++ b/src/gui/util/qundostack.cpp
@@ -441,7 +441,7 @@ bool QUndoStackPrivate::checkUndoLimit()
/*!
Constructs an empty undo stack with the parent \a parent. The
- stack will initally be in the clean state. If \a parent is a
+ stack will initially be in the clean state. If \a parent is a
QUndoGroup object, the stack is automatically added to the group.
\sa push()
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 70ef7ba..0479d83 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -728,7 +728,7 @@ void CSymbianCertificateRetriever::RunL()
if (iStatus.Int() == KErrNone)
iCertificates->append(iCertificateData);
else
- qWarning() << "CSymbianCertificateRetriever: failed to retreive a certificate, error " << iStatus.Int();
+ qWarning() << "CSymbianCertificateRetriever: failed to retrieve a certificate, error " << iStatus.Int();
GetCertificateL();
break;
}
diff --git a/src/plugins/bearer/symbian/symbianengine.cpp b/src/plugins/bearer/symbian/symbianengine.cpp
index 33fa508..f025d86 100644
--- a/src/plugins/bearer/symbian/symbianengine.cpp
+++ b/src/plugins/bearer/symbian/symbianengine.cpp
@@ -981,7 +981,7 @@ void SymbianEngine::RunL()
QMutexLocker locker(&mutex);
if (iStatus != KErrCancel) {
- // By default, start relistening notifications. Stop only if interesting event occured.
+ // By default, start relistening notifications. Stop only if interesting event occurred.
iWaitingCommsDatabaseNotifications = true;
RDbNotifier::TEvent event = STATIC_CAST(RDbNotifier::TEvent, iStatus.Int());
switch (event) {
diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
index 063af13..507f70b 100644
--- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
+++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp
@@ -83,7 +83,7 @@ QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const
QPixmapData *QMeeGoGraphicsSystem::createPixmapData(QPixmapData::PixelType type) const
{
// Long story short: without this it's possible to hit an
- // unitialized paintDevice due to a Qt bug too complex to even
+ // uninitialized paintDevice due to a Qt bug too complex to even
// explain here... not to mention fix without going crazy.
// MDK
QGLShareContextScope ctx(qt_gl_share_widget()->context());
diff --git a/src/script/api/qscriptcontextinfo.cpp b/src/script/api/qscriptcontextinfo.cpp
index a90e014..8528dec 100644
--- a/src/script/api/qscriptcontextinfo.cpp
+++ b/src/script/api/qscriptcontextinfo.cpp
@@ -177,7 +177,7 @@ QScriptContextInfoPrivate::QScriptContextInfoPrivate(const QScriptContext *conte
fileName = source->url();
}
- // Get the others informations:
+ // Get the others information:
JSC::JSObject *callee = frame->callee();
if (callee && callee->inherits(&JSC::InternalFunction::info))
functionName = JSC::asInternalFunction(callee)->name(frame);
diff --git a/src/xmlpatterns/expr/qarithmeticexpression_p.h b/src/xmlpatterns/expr/qarithmeticexpression_p.h
index 66c1f13..6ff8219 100644
--- a/src/xmlpatterns/expr/qarithmeticexpression_p.h
+++ b/src/xmlpatterns/expr/qarithmeticexpression_p.h
@@ -62,7 +62,7 @@ QT_BEGIN_NAMESPACE
namespace QPatternist
{
/**
- * @short Implements arithmetics, such as multiplication and substraction.
+ * @short Implements arithmetics, such as multiplication and subtraction.
*
*
* Optimizations: there's some operator/value combos that are no ops. For
diff --git a/tests/auto/collections/tst_collections.cpp b/tests/auto/collections/tst_collections.cpp
index f81535e..43e1a52 100644
--- a/tests/auto/collections/tst_collections.cpp
+++ b/tests/auto/collections/tst_collections.cpp
@@ -1222,7 +1222,7 @@ void tst_Collections::vector()
}
}
- // this used to trigger an unitialized read in valgrind
+ // this used to trigger an uninitialized read in valgrind
QVector foo;
foo.resize(144);
diff --git a/tools/assistant/tools/assistant/helpenginewrapper.cpp b/tools/assistant/tools/assistant/helpenginewrapper.cpp
index a53a9ee..748ad2c 100644
--- a/tools/assistant/tools/assistant/helpenginewrapper.cpp
+++ b/tools/assistant/tools/assistant/helpenginewrapper.cpp
@@ -144,7 +144,7 @@ HelpEngineWrapper::HelpEngineWrapper(const QString &collectionFile)
/*
* Otherwise we will waste time if several new docs are found,
- * because we will start to index them, only to be interupted
+ * because we will start to index them, only to be interrupted
* by the next request. Also, there is a nasty SQLITE bug that will
* cause the application to hang for minutes in that case.
* This call is reverted by initalDocSetupDone(), which must be
--
cgit v0.12
From b2a89cf4049e425553bfe74bcb1a52433e6a13c7 Mon Sep 17 00:00:00 2001
From: Michael Dominic K
Date: Wed, 17 Nov 2010 10:55:08 +0100
Subject: Send QMeeGoSwitchEvent to toplevel widgets before switching graphics
system.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Merge-request: 926
Reviewed-by: Samuel Rødal
---
.../qmeegographicssystemhelper.cpp | 17 ++++++
.../qmeegographicssystemhelper.pro | 4 +-
.../qmeegoswitchevent.cpp | 58 +++++++++++++++++++
.../qmeegographicssystemhelper/qmeegoswitchevent.h | 65 ++++++++++++++++++++++
4 files changed, 142 insertions(+), 2 deletions(-)
create mode 100644 tools/qmeegographicssystemhelper/qmeegoswitchevent.cpp
create mode 100644 tools/qmeegographicssystemhelper/qmeegoswitchevent.h
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
index d348e70..b660eb3 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp
@@ -46,6 +46,7 @@
#include
#include
#include "qmeegoruntime.h"
+#include "qmeegoswitchevent.h"
QString QMeeGoGraphicsSystemHelper::runningGraphicsSystemName()
{
@@ -81,8 +82,16 @@ void QMeeGoGraphicsSystemHelper::switchToMeeGo()
if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
qWarning("Can't switch to meego - switching only supported with 'runtime' graphics system.");
else {
+ QMeeGoSwitchEvent willSwitchEvent(QLatin1String("meego"), QMeeGoSwitchEvent::WillSwitch);
+ foreach (QWidget *widget, QApplication::topLevelWidgets())
+ QCoreApplication::sendEvent(widget, &willSwitchEvent);
+
QApplication *app = static_cast(QCoreApplication::instance());
app->setGraphicsSystem(QLatin1String("meego"));
+
+ QMeeGoSwitchEvent didSwitchEvent(QLatin1String("meego"), QMeeGoSwitchEvent::DidSwitch);
+ foreach (QWidget *widget, QApplication::topLevelWidgets())
+ QCoreApplication::sendEvent(widget, &didSwitchEvent);
}
}
@@ -94,8 +103,16 @@ void QMeeGoGraphicsSystemHelper::switchToRaster()
if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime"))
qWarning("Can't switch to raster - switching only supported with 'runtime' graphics system.");
else {
+ QMeeGoSwitchEvent willSwitchEvent(QLatin1String("raster"), QMeeGoSwitchEvent::WillSwitch);
+ foreach (QWidget *widget, QApplication::topLevelWidgets())
+ QCoreApplication::sendEvent(widget, &willSwitchEvent);
+
QApplication *app = static_cast(QCoreApplication::instance());
app->setGraphicsSystem(QLatin1String("raster"));
+
+ QMeeGoSwitchEvent didSwitchEvent(QLatin1String("raster"), QMeeGoSwitchEvent::DidSwitch);
+ foreach (QWidget *widget, QApplication::topLevelWidgets())
+ QCoreApplication::sendEvent(widget, &didSwitchEvent);
}
}
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
index 161a31b..360847e 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.pro
@@ -6,5 +6,5 @@ include(../../src/qbase.pri)
QT += gui
INCLUDEPATH += '../../src/plugins/graphicssystems/meego'
-HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h qmeegofencesync.h qmeegofencesync_p.h
-SOURCES = qmeegographicssystemhelper.cpp qmeegooverlaywidget.cpp qmeegoruntime.cpp qmeegolivepixmap.cpp qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h qmeegofencesync.h qmeegofencesync_p.h qmeegofencesync.cpp
+HEADERS = qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h qmeegofencesync.h qmeegofencesync_p.h qmeegoswitchevent.h
+SOURCES = qmeegographicssystemhelper.cpp qmeegooverlaywidget.cpp qmeegoruntime.cpp qmeegolivepixmap.cpp qmeegographicssystemhelper.h qmeegooverlaywidget.h qmeegolivepixmap.h qmeegoruntime.h qmeegolivepixmap_p.h qmeegofencesync.h qmeegofencesync_p.h qmeegofencesync.cpp qmeegoswitchevent.cpp qmeegoswitchevent.h
diff --git a/tools/qmeegographicssystemhelper/qmeegoswitchevent.cpp b/tools/qmeegographicssystemhelper/qmeegoswitchevent.cpp
new file mode 100644
index 0000000..b136ce8
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegoswitchevent.cpp
@@ -0,0 +1,58 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins 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 "qmeegoswitchevent.h"
+
+QMeeGoSwitchEvent::QMeeGoSwitchEvent(const QString &graphicsSystemName, QMeeGoSwitchEvent::State s) : QEvent((QEvent::Type) QMeeGoSwitchEvent::SwitchEvent)
+{
+ name = graphicsSystemName;
+ switchState = s;
+}
+
+QString QMeeGoSwitchEvent::graphicsSystemName() const
+{
+ return name;
+}
+
+QMeeGoSwitchEvent::State QMeeGoSwitchEvent::state() const
+{
+ return switchState;
+}
\ No newline at end of file
diff --git a/tools/qmeegographicssystemhelper/qmeegoswitchevent.h b/tools/qmeegographicssystemhelper/qmeegoswitchevent.h
new file mode 100644
index 0000000..a67c6c4
--- /dev/null
+++ b/tools/qmeegographicssystemhelper/qmeegoswitchevent.h
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include
+#include
+
+class QMeeGoSwitchEvent : public QEvent
+{
+public:
+ enum State {
+ WillSwitch,
+ DidSwitch
+ };
+
+ enum Type {
+ SwitchEvent = QEvent::User + 1024
+ };
+
+ QMeeGoSwitchEvent(const QString &graphicsSystemName, State s);
+ QString graphicsSystemName() const;
+ State state() const;
+
+
+private:
+ QString name;
+ State switchState;
+};
--
cgit v0.12
From 0091dcee679c8787f80bc2ed49f263c801779987 Mon Sep 17 00:00:00 2001
From: Michael Dominic K
Date: Wed, 17 Nov 2010 10:55:09 +0100
Subject: Documentation update for new switching events.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Merge-request: 926
Reviewed-by: Samuel Rødal
---
.../qmeegographicssystemhelper.h | 6 +++++
.../qmeegographicssystemhelper/qmeegoswitchevent.h | 26 +++++++++++++++++++++-
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
index 2baacbb..d47c829 100644
--- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
+++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h
@@ -102,6 +102,9 @@ public:
When running with the 'runtime' graphics system, sets the currently active
system to 'meego'. The window surface and all the resources are automatically
migrated to OpenGL. Will fail if the active graphics system is not 'runtime'.
+ Calling this function will emit QMeeGoSwitchEvent to the top level widgets.
+ Two events will be emitted for each switch -- one before the switch (QMeeGoSwitchEvent::WillSwitch)
+ and one after the switch (QMeeGoSwitchEvent::DidSwitch).
*/
static void switchToMeeGo();
@@ -111,6 +114,9 @@ public:
system to 'raster'. The window surface and the graphics resources (including the
EGL shared image resources) are automatically migrated back to the CPU. All OpenGL
resources (surface, context, cache, font cache) are automaticall anihilated.
+ Calling this function will emit QMeeGoSwitchEvent to the top level widgets.
+ Two events will be emitted for each switch -- one before the switch (QMeeGoSwitchEvent::WillSwitch)
+ and one after the switch (QMeeGoSwitchEvent::DidSwitch).
*/
static void switchToRaster();
diff --git a/tools/qmeegographicssystemhelper/qmeegoswitchevent.h b/tools/qmeegographicssystemhelper/qmeegoswitchevent.h
index a67c6c4..2d8371e 100644
--- a/tools/qmeegographicssystemhelper/qmeegoswitchevent.h
+++ b/tools/qmeegographicssystemhelper/qmeegoswitchevent.h
@@ -42,22 +42,46 @@
#include
#include
+//! A custom event representing a graphics system switch.
+/*!
+ This event is sent two times -- before the actual switch and after the switch.
+ The current mode of the event can be detected by looking at the State of the
+ event.
+
+ The end-user application can use the event to drop it's own allocated GL resources
+ when going to software mode.
+*/
+
class QMeeGoSwitchEvent : public QEvent
{
public:
+
+ //! The state represented by this event.
enum State {
WillSwitch,
DidSwitch
};
+ //! The event type id to use to detect this event.
enum Type {
SwitchEvent = QEvent::User + 1024
};
+ //! Constructor for the event.
+ /*!
+ Creates a new event with the given name and the given state.
+ */
QMeeGoSwitchEvent(const QString &graphicsSystemName, State s);
+
+ //! Returns the name of the target graphics system.
+ /*!
+ Depending on the state, the name represents the system we're about to swtich to,
+ or the system we just switched to.
+ */
QString graphicsSystemName() const;
- State state() const;
+ //! Returns the state represented by this event.
+ State state() const;
private:
QString name;
--
cgit v0.12
From d68b5355b36e31dbeec2474d8469646358e0cd87 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Samuel=20R=C3=B8dal?=
Date: Wed, 17 Nov 2010 10:58:57 +0100
Subject: Compile fix.
Not sure why this worked before.
Reviewed-by: Benjamin Poulain
---
src/corelib/tools/qstring.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index d4a1248..92b54a0 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -3572,7 +3572,7 @@ static QByteArray toLatin1_helper(const QChar *data, int length)
}
length = length % 16;
}
-#elif QT_ALWAYS_HAVE_NEON
+#elif defined(QT_ALWAYS_HAVE_NEON)
// Refer to the documentation of the SSE2 implementation
// this use eactly the same method as for SSE except:
// 1) neon has unsigned comparison
--
cgit v0.12
From 6ad33e1ff7618704fd41549780d0d0c93778364e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Samuel=20R=C3=B8dal?=
Date: Wed, 17 Nov 2010 13:01:38 +0100
Subject: Prevent crash in GL 2 engine when stroking null rectangle.
Task-number: QTBUG-15320
Reviewed-by: Kim
---
.../gl2paintengineex/qpaintengineex_opengl2.cpp | 3 +++
tests/auto/qgl/tst_qgl.cpp | 23 ++++++++++++++++++++++
2 files changed, 26 insertions(+)
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 73915cb..37552ac 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1212,6 +1212,9 @@ void QGL2PaintEngineExPrivate::stroke(const QVectorPath &path, const QPen &pen)
stroker.process(dashStroke, pen, clip);
}
+ if (!stroker.vertexCount())
+ return;
+
if (opaque) {
prepareForDraw(opaque);
setVertexAttributePointer(QT_VERTEX_COORDS_ATTR, stroker.vertices());
diff --git a/tests/auto/qgl/tst_qgl.cpp b/tests/auto/qgl/tst_qgl.cpp
index e38bf42..cc2cac9 100644
--- a/tests/auto/qgl/tst_qgl.cpp
+++ b/tests/auto/qgl/tst_qgl.cpp
@@ -97,6 +97,7 @@ private slots:
void qglContextDefaultBindTexture();
void textureCleanup();
void threadImages();
+ void nullRectCrash();
};
tst_QGL::tst_QGL()
@@ -2375,6 +2376,28 @@ void tst_QGL::threadImages()
delete widget;
}
+void tst_QGL::nullRectCrash()
+{
+ if (!QGLFramebufferObject::hasOpenGLFramebufferObjects())
+ QSKIP("QGLFramebufferObject not supported on this platform", SkipSingle);
+
+ QGLWidget glw;
+ glw.makeCurrent();
+
+ QGLFramebufferObjectFormat fboFormat;
+ fboFormat.setAttachment(QGLFramebufferObject::CombinedDepthStencil);
+
+ QGLFramebufferObject *fbo = new QGLFramebufferObject(128, 128, fboFormat);
+
+ QPainter fboPainter(fbo);
+
+ fboPainter.setPen(QPen(QColor(255, 127, 127, 127), 2));
+ fboPainter.setBrush(QColor(127, 255, 127, 127));
+ fboPainter.drawRect(QRectF());
+
+ fboPainter.end();
+}
+
class tst_QGLDummy : public QObject
{
Q_OBJECT
--
cgit v0.12
From 0b6adc944d7da5d4b943f1bd85666af82f1450de Mon Sep 17 00:00:00 2001
From: David Boddie
Date: Wed, 17 Nov 2010 13:50:20 +0100
Subject: Doc: Updated the DirectFB documentation to reflect version changes.
---
doc/src/platforms/emb-directfb-EmbLinux.qdoc | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/doc/src/platforms/emb-directfb-EmbLinux.qdoc b/doc/src/platforms/emb-directfb-EmbLinux.qdoc
index dbe6c14..bcc06dc 100644
--- a/doc/src/platforms/emb-directfb-EmbLinux.qdoc
+++ b/doc/src/platforms/emb-directfb-EmbLinux.qdoc
@@ -39,11 +39,11 @@ and generally chip vendors start out with the official version and
implement their own plugins to optimize the operations their hardware
supports.
-We recommend using Qt 4.6 with DirectFB. DirectFB support was introduced
-already into Qt for Embedded Linux as a labs project for Qt 4.3 and folded
+We recommend using Qt 4.6 or later with DirectFB. Support for DirectFB was
+introduced into Qt for Embedded Linux as a labs project for Qt 4.3 and folded
into Qt as a screen driver for Qt 4.4, but not supported fully. In Qt 4.5,
major changes were made to make it work with the optimized raster paint
-engine. And in Qt 4.6 these have been further improved.
+engine. These changes were further improved in Qt 4.6.
\tableofcontents
--
cgit v0.12
From b5d26bfb348b6a99529ecf9ab66845e7eacd4732 Mon Sep 17 00:00:00 2001
From: David Boddie
Date: Wed, 17 Nov 2010 13:51:05 +0100
Subject: Doc: Minor fixes to style.
---
doc/src/platforms/emb-pointer.qdoc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/doc/src/platforms/emb-pointer.qdoc b/doc/src/platforms/emb-pointer.qdoc
index 81e532f..506e9e0 100644
--- a/doc/src/platforms/emb-pointer.qdoc
+++ b/doc/src/platforms/emb-pointer.qdoc
@@ -105,7 +105,7 @@
{touch panels} in which case the driver must be specified
explicitly to determine which device to use.
- To manually specify which driver to use, set the QWS_MOUSE_PROTO
+ To manually specify which driver to use, set the \c QWS_MOUSE_PROTO
environment variable. For example (if the current shell is bash,
ksh, zsh or sh):
@@ -156,7 +156,7 @@
\snippet doc/src/snippets/code/doc_src_emb-pointer.qdoc 8
To make \l{Qt for Embedded Linux} explicitly choose the tslib mouse
- handler, set the QWS_MOUSE_PROTO environment variable as explained
+ handler, set the \c QWS_MOUSE_PROTO environment variable as explained
above.
\endtable
--
cgit v0.12
From 78895a7ecaf6579894d88388c09be6e6368dc029 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?=
Date: Tue, 16 Nov 2010 14:19:29 +0200
Subject: Fixed crash when destroying QGLWidget
The QGLWidget destroys the QGLContext, which in turn destroys the
bound pixmap. When this happens there may not be a current QGLContext,
so check that before trying to restore it.
Done-with: Gunnar Sletta
Reviewed-by: Samuel
---
src/opengl/qgl_p.h | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h
index 4742bdb..b46d428 100644
--- a/src/opengl/qgl_p.h
+++ b/src/opengl/qgl_p.h
@@ -506,7 +506,8 @@ private slots:
// when you come to delete the context.
QGLContextPrivate::unbindPixmapFromTexture(boundPixmap);
glDeleteTextures(1, &id);
- oldContext->makeCurrent();
+ if (oldContext)
+ oldContext->makeCurrent();
return;
}
#endif
--
cgit v0.12
From 2c40c98a5b3ff4f16c4ad71b5707d5271945819e Mon Sep 17 00:00:00 2001
From: Sami Merila
Date: Thu, 18 Nov 2010 12:15:03 +0200
Subject: QToolbar should fill available width on Symbian
Normally QStyle provides a minimum size for a widget. However, to
imitate native toolbar behavior, QToolBar should occupy available
screen estate on Symbian (with QS60Style). This is only supported
for horizontal QToolBars as native side does not have same
functionality for vertical toolbars.
QToolbar size now tries to take into account available size of
parent reduced by margins (if several parents, then each can reduce
the available space by their margins). Also, toolbar internal
pixel metrics data (item spacing, item margins) are taken into
account.
Task-number: QTBUG-13120
Reviewed-by: Janne Koskinen
---
src/gui/styles/qs60style.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 50 insertions(+)
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 5fe9050..5eddc98 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -2536,6 +2536,56 @@ QSize QS60Style::sizeFromContents(ContentsType ct, const QStyleOption *opt,
if (const QStyleOptionToolButton *toolBtn = qstyleoption_cast(opt))
if (toolBtn->subControls & SC_ToolButtonMenu)
sz += QSize(pixelMetric(PM_MenuButtonIndicator), 0);
+
+ //Make toolbuttons in toolbar stretch the whole screen area
+ if (widget && qobject_cast(widget->parentWidget())) {
+ const QToolBar *tb = qobject_cast(widget->parentWidget());
+ const bool parentCanGrowHorizontally = !(tb->sizePolicy().horizontalPolicy() == QSizePolicy::Fixed ||
+ tb->sizePolicy().horizontalPolicy() == QSizePolicy::Maximum) && tb->orientation() == Qt::Horizontal;
+
+ if (parentCanGrowHorizontally) {
+ int visibleButtons = 0;
+ //Make the auto-stretch to happen only for horizontal orientation
+ if (tb && tb->orientation() == Qt::Horizontal) {
+ QList actionList = tb->actions();
+ for (int i = 0; i < actionList.count(); i++) {
+ if (actionList.at(i)->isVisible())
+ visibleButtons++;
+ }
+ }
+
+ if (widget->parentWidget() && visibleButtons > 0) {
+ QWidget *w = const_cast(widget);
+ int toolBarMaxWidth = 0;
+ int totalMargin = 0;
+ while (w) {
+ //honor fixed width parents
+ if (w->maximumWidth() == w->minimumWidth())
+ toolBarMaxWidth = qMax(toolBarMaxWidth, w->maximumWidth());
+ if (w->layout() && w->windowType() == Qt::Widget) {
+ totalMargin += w->layout()->contentsMargins().left() +
+ w->layout()->contentsMargins().right();
+ }
+ w = w->parentWidget();
+ }
+ totalMargin += 2 * pixelMetric(QStyle::PM_ToolBarFrameWidth);
+
+ if (toolBarMaxWidth == 0)
+ toolBarMaxWidth =
+ QApplication::desktop()->availableGeometry(widget->parentWidget()).width();
+ //Reduce the margins, toolbar frame, item spacing and internal margin from available area
+ toolBarMaxWidth -= totalMargin;
+
+ //ensure that buttons are side-by-side and not on top of each other
+ const int toolButtonWidth = (toolBarMaxWidth / visibleButtons)
+ - pixelMetric(QStyle::PM_ToolBarItemSpacing)
+ - pixelMetric(QStyle::PM_ToolBarItemMargin)
+ //toolbar frame needs to be reduced again, since QToolBarLayout adds it for each toolbar action
+ - 2 * pixelMetric(QStyle::PM_ToolBarFrameWidth) - 1;
+ sz.setWidth(qMax(toolButtonWidth, sz.width()));
+ }
+ }
+ }
break;
case CT_PushButton:
sz = QCommonStyle::sizeFromContents( ct, opt, csz, widget);
--
cgit v0.12
From faf0e9966c319ac774db3d4967d902772c30e526 Mon Sep 17 00:00:00 2001
From: Sami Merila
Date: Thu, 18 Nov 2010 13:06:10 +0200
Subject: Tactile Feedback plugin is not compiled in latest Sym^3 RnD envs
Due to somewhat questionable .pro-file flagging, the plugin is not
currently compiled at all for latest Sym^3 environments.
Flagging is now more bulletproof (not 3.1 & not 3.2), so even if the
upcoming platform versions change, this should work in the future.
Task-number: QTBUG-15428
Reviewed-by: Mikka Heikkinen
---
src/plugins/s60/feedback/feedback.pro | 2 +-
src/plugins/s60/s60.pro | 2 +-
src/s60installs/s60installs.pro | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/plugins/s60/feedback/feedback.pro b/src/plugins/s60/feedback/feedback.pro
index 1069220..5e577ec 100644
--- a/src/plugins/s60/feedback/feedback.pro
+++ b/src/plugins/s60/feedback/feedback.pro
@@ -6,7 +6,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/s60/feedback
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-contains(S60_VERSION, 5.0)|contains(S60_VERSION, symbian3) {
+!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
HEADERS += qtactileFeedback.h
SOURCES += qtactileFeedback_s60.cpp
diff --git a/src/plugins/s60/s60.pro b/src/plugins/s60/s60.pro
index ffcd170..1ddf326 100644
--- a/src/plugins/s60/s60.pro
+++ b/src/plugins/s60/s60.pro
@@ -6,7 +6,7 @@ symbian {
SUBDIRS += 3_1 3_2
}
- contains(S60_VERSION, 5.0)|contains(S60_VERSION, symbian3) {
+ !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
SUBDIRS += feedback
}
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index 65b8781..7827fb6 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -87,7 +87,7 @@ symbian: {
DEPLOYMENT += bearer_plugin
}
- contains(S60_VERSION, 5.0)|contains(S60_VERSION, symbian3) {
+ !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
feedback_plugin.sources = $$QT_BUILD_TREE/plugins/s60/feedback/qtactilefeedback$${QT_LIBINFIX}.dll
feedback_plugin.path = c:$$QT_PLUGINS_BASE_DIR/feedback
DEPLOYMENT += feedback_plugin
--
cgit v0.12
From 9f18a1ad5ce32dd397642a4c03fa1fcb21fb9456 Mon Sep 17 00:00:00 2001
From: Mike McQuaid
Date: Thu, 18 Nov 2010 05:40:36 +0000
Subject: Check correctly before including SSE4.2 header.
Previously, this failed machines that only had SSE4.1 but not
SSE4.2 due to an assumption that nmmintrin.h could be included
when only using SSE4.1.
Fixes http://bugreports.qt.nokia.com/browse/QTBUG-13623.
Merge-request: 929
Reviewed-by: Benjamin Poulain
---
src/corelib/tools/qsimd_p.h | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/corelib/tools/qsimd_p.h b/src/corelib/tools/qsimd_p.h
index 87fa770..2dbed76 100644
--- a/src/corelib/tools/qsimd_p.h
+++ b/src/corelib/tools/qsimd_p.h
@@ -87,9 +87,13 @@ QT_BEGIN_HEADER
#include
#endif
-// SSE4.1 and SSE4.2 intrinsics
-#if (defined(QT_HAVE_SSE4_1) || defined(QT_HAVE_SSE4_2)) && (defined(__SSE4_1__) || defined(Q_CC_MSVC))
+// SSE4.1 intrinsics
+#if defined(QT_HAVE_SSE4_1) && (defined(__SSE4_1__) || defined(Q_CC_MSVC))
#include
+#endif
+
+// SSE4.2 intrinsics
+#if defined(QT_HAVE_SSE4_2) && (defined(__SSE4_2__) || defined(Q_CC_MSVC))
#include
#endif
--
cgit v0.12
From 36ac9c61e73944cd75d09f5751dd8ed053571b9b Mon Sep 17 00:00:00 2001
From: Joona Petrell
Date: Thu, 18 Nov 2010 20:57:20 +1000
Subject: Add missing symbols in QtGui emulator def file
---
src/s60installs/bwins/QtGuiu.def | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def
index c91b22c..dc8a865 100644
--- a/src/s60installs/bwins/QtGuiu.def
+++ b/src/s60installs/bwins/QtGuiu.def
@@ -12898,4 +12898,10 @@ EXPORTS
?qmljsDebugArgumentsString@QApplicationPrivate@@SA?AVQString@@XZ @ 12897 NONAME ; class QString QApplicationPrivate::qmljsDebugArgumentsString(void)
?convertToPostscriptFontFamilyName@QFontEngine@@SA?AVQByteArray@@ABV2@@Z @ 12898 NONAME ; class QByteArray QFontEngine::convertToPostscriptFontFamilyName(class QByteArray const &)
?lastResortFont@QFont@@QBE?AVQString@@XZ @ 12899 NONAME ; class QString QFont::lastResortFont(void) const
+ ?setFontEngine@QStaticTextItem@@QAEXPAVQFontEngine@@@Z @ 12900 NONAME ; void QStaticTextItem::setFontEngine(class QFontEngine *)
+ ??0QStaticTextItem@@QAE@ABV0@@Z @ 12901 NONAME ; QStaticTextItem::QStaticTextItem(class QStaticTextItem const &)
+ ??4QStaticTextItem@@QAEXABV0@@Z @ 12902 NONAME ; void QStaticTextItem::operator=(class QStaticTextItem const &)
+ ?fontEngine@QStaticTextItem@@QBEPAVQFontEngine@@XZ @ 12903 NONAME ; class QFontEngine * QStaticTextItem::fontEngine(void) const
+ ?reactivateDeferredActiveObjects@QEventDispatcherS60@@UAEXXZ @ 12904 NONAME ; void QEventDispatcherS60::reactivateDeferredActiveObjects(void)
+ ?userData@QStaticTextItem@@QBEPAVQStaticTextUserData@@XZ @ 12905 NONAME ; class QStaticTextUserData * QStaticTextItem::userData(void) const
--
cgit v0.12
From 31feffb92570c6e13618cc2d0d03a5f243a7e350 Mon Sep 17 00:00:00 2001
From: Sami Merila
Date: Thu, 18 Nov 2010 13:06:10 +0200
Subject: Tactile Feedback plugin is not compiled in latest Sym^3 RnD envs
Due to somewhat questionable .pro-file flagging, the plugin is not
currently compiled at all for latest Sym^3 environments.
Flagging is now more bulletproof (not 3.1 & not 3.2), so even if the
upcoming platform versions change, this should work in the future.
Task-number: QTBUG-15428
Reviewed-by: Miikka Heikkinen
---
src/plugins/s60/feedback/feedback.pro | 2 +-
src/plugins/s60/s60.pro | 2 +-
src/s60installs/s60installs.pro | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/plugins/s60/feedback/feedback.pro b/src/plugins/s60/feedback/feedback.pro
index 1069220..5e577ec 100644
--- a/src/plugins/s60/feedback/feedback.pro
+++ b/src/plugins/s60/feedback/feedback.pro
@@ -6,7 +6,7 @@ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/s60/feedback
INCLUDEPATH += $$APP_LAYER_SYSTEMINCLUDE
-contains(S60_VERSION, 5.0)|contains(S60_VERSION, symbian3) {
+!contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
HEADERS += qtactileFeedback.h
SOURCES += qtactileFeedback_s60.cpp
diff --git a/src/plugins/s60/s60.pro b/src/plugins/s60/s60.pro
index ffcd170..1ddf326 100644
--- a/src/plugins/s60/s60.pro
+++ b/src/plugins/s60/s60.pro
@@ -6,7 +6,7 @@ symbian {
SUBDIRS += 3_1 3_2
}
- contains(S60_VERSION, 5.0)|contains(S60_VERSION, symbian3) {
+ !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
SUBDIRS += feedback
}
diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro
index 65b8781..7827fb6 100644
--- a/src/s60installs/s60installs.pro
+++ b/src/s60installs/s60installs.pro
@@ -87,7 +87,7 @@ symbian: {
DEPLOYMENT += bearer_plugin
}
- contains(S60_VERSION, 5.0)|contains(S60_VERSION, symbian3) {
+ !contains(S60_VERSION, 3.1):!contains(S60_VERSION, 3.2) {
feedback_plugin.sources = $$QT_BUILD_TREE/plugins/s60/feedback/qtactilefeedback$${QT_LIBINFIX}.dll
feedback_plugin.path = c:$$QT_PLUGINS_BASE_DIR/feedback
DEPLOYMENT += feedback_plugin
--
cgit v0.12
From 7196045b78b33cf135683d5c0b4e164f95231791 Mon Sep 17 00:00:00 2001
From: "Bradley T. Hughes"
Date: Thu, 18 Nov 2010 12:42:14 +0100
Subject: Don't let posted events starve native dialogs (regression)
After commit eb1015c7bbf135af3656110a4d112377c1209db8, it is possible
for posted events to starve some of the (most likely internal) messages
used by native dialogs.
This commit reverts eb1015c7bbf135af3656110a4d112377c1209db8, and
instead introduces a Windows timer to keep sendPostedEvents() happening
while the event queue is very active. The GetMessage() hook we install
will eventually see when the queue is empty and we can use PostMessage()
again, which will then stop this timer.
This fixes the regression reported in QTBUG-14655, as well as all of the
other reported regressions and problems since the initial commit
31f1ff91028dd7f90925d5b3737e4d88b5fb07aa (which ensures that posted
events are sent even when Windows is spinning the message loop).
Task-number: QTBUG-14655
Reviewed-by: joao
---
src/corelib/kernel/qeventdispatcher_win.cpp | 48 ++++++++++++++++++++---------
1 file changed, 34 insertions(+), 14 deletions(-)
diff --git a/src/corelib/kernel/qeventdispatcher_win.cpp b/src/corelib/kernel/qeventdispatcher_win.cpp
index a719e72..3dccda6 100644
--- a/src/corelib/kernel/qeventdispatcher_win.cpp
+++ b/src/corelib/kernel/qeventdispatcher_win.cpp
@@ -84,7 +84,8 @@ extern uint qGlobalPostedEventsCount();
enum {
WM_QT_SOCKETNOTIFIER = WM_USER,
- WM_QT_SENDPOSTEDEVENTS = WM_USER + 1
+ WM_QT_SENDPOSTEDEVENTS = WM_USER + 1,
+ SendPostedEventsWindowsTimerId = ~1u
};
#if defined(Q_OS_WINCE)
@@ -353,7 +354,7 @@ public:
// for controlling when to send posted events
QAtomicInt serialNumber;
- int lastSerialNumber;
+ int lastSerialNumber, sendPostedEventsWindowsTimerId;
QAtomicInt wakeUps;
// timers
@@ -378,7 +379,7 @@ public:
QEventDispatcherWin32Private::QEventDispatcherWin32Private()
: threadId(GetCurrentThreadId()), interrupt(false), internalHwnd(0), getMessageHook(0),
- serialNumber(0), lastSerialNumber(0), wakeUps(0)
+ serialNumber(0), lastSerialNumber(0), sendPostedEventsWindowsTimerId(0), wakeUps(0)
{
resolveTimerAPI();
}
@@ -485,17 +486,21 @@ LRESULT QT_WIN_CALLBACK qt_internal_proc(HWND hwnd, UINT message, WPARAM wp, LPA
}
}
return 0;
- } else if (message == WM_TIMER) {
- Q_ASSERT(d != 0);
- d->sendTimerEvent(wp);
- return 0;
- } else if (message == WM_QT_SENDPOSTEDEVENTS) {
+ } else if (message == WM_QT_SENDPOSTEDEVENTS
+ // we also use a Windows timer to send posted events when the message queue is full
+ || (message == WM_TIMER
+ && d->sendPostedEventsWindowsTimerId != 0
+ && wp == d->sendPostedEventsWindowsTimerId)) {
int localSerialNumber = d->serialNumber;
if (localSerialNumber != d->lastSerialNumber) {
d->lastSerialNumber = localSerialNumber;
QCoreApplicationPrivate::sendPostedEvents(0, 0, d->threadData);
}
return 0;
+ } else if (message == WM_TIMER) {
+ Q_ASSERT(d != 0);
+ d->sendTimerEvent(wp);
+ return 0;
}
return DefWindowProc(hwnd, message, wp, lp);
@@ -507,21 +512,36 @@ LRESULT QT_WIN_CALLBACK qt_GetMessageHook(int code, WPARAM wp, LPARAM lp)
QEventDispatcherWin32 *q = qobject_cast(QAbstractEventDispatcher::instance());
Q_ASSERT(q != 0);
if (q) {
+ MSG *msg = (MSG *) lp;
QEventDispatcherWin32Private *d = q->d_func();
int localSerialNumber = d->serialNumber;
- MSG unused;
- if ((HIWORD(GetQueueStatus(QS_INPUT | QS_RAWINPUT)) == 0
- && PeekMessage(&unused, 0, WM_TIMER, WM_TIMER, PM_NOREMOVE) == 0)) {
- // no more input or timer events in the message queue or more than 10ms has elapsed since
- // we send posted events, we can allow posted events to be sent now
+ if (HIWORD(GetQueueStatus(QS_TIMER | QS_INPUT | QS_RAWINPUT)) == 0) {
+ // no more input or timer events in the message queue, we can allow posted events to be sent normally now
+ if (d->sendPostedEventsWindowsTimerId != 0) {
+ // stop the timer to send posted events, since we now allow the WM_QT_SENDPOSTEDEVENTS message
+ KillTimer(d->internalHwnd, d->sendPostedEventsWindowsTimerId);
+ d->sendPostedEventsWindowsTimerId = 0;
+ }
(void) d->wakeUps.fetchAndStoreRelease(0);
- MSG *msg = (MSG *) lp;
if (localSerialNumber != d->lastSerialNumber
// if this message IS the one that triggers sendPostedEvents(), no need to post it again
&& (msg->hwnd != d->internalHwnd
|| msg->message != WM_QT_SENDPOSTEDEVENTS)) {
PostMessage(d->internalHwnd, WM_QT_SENDPOSTEDEVENTS, 0, 0);
}
+ } else if (d->sendPostedEventsWindowsTimerId == 0
+ && localSerialNumber != d->lastSerialNumber
+ // if this message IS the one that triggers sendPostedEvents(), no need to post it again
+ && (msg->hwnd != d->internalHwnd
+ || msg->message != WM_QT_SENDPOSTEDEVENTS)) {
+ // start a special timer to continue delivering posted events while
+ // there are still input and timer messages in the message queue
+ d->sendPostedEventsWindowsTimerId = SetTimer(d->internalHwnd,
+ SendPostedEventsWindowsTimerId,
+ USER_TIMER_MINIMUM,
+ NULL);
+ // we don't check the return value of SetTimer()... if creating the timer failed, there's little
+ // we can do. we just have to accept that posted events will be starved
}
}
}
--
cgit v0.12
From 0ced71e4dddc12240b22fd5786ed41a529e49c47 Mon Sep 17 00:00:00 2001
From: Marco Bubke
Date: Thu, 18 Nov 2010 13:35:44 +0100
Subject: Fix parent bug for QDeclarativeOpenMetaObject
The dynamic meta object was not called because no parent meta object was called.
Reviewed-By: Aaron Kennedy
---
src/declarative/util/qdeclarativeopenmetaobject.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/declarative/util/qdeclarativeopenmetaobject.cpp b/src/declarative/util/qdeclarativeopenmetaobject.cpp
index 40485bd..c611435 100644
--- a/src/declarative/util/qdeclarativeopenmetaobject.cpp
+++ b/src/declarative/util/qdeclarativeopenmetaobject.cpp
@@ -186,6 +186,7 @@ QDeclarativeOpenMetaObject::QDeclarativeOpenMetaObject(QObject *obj, bool automa
d->type->d->referers.insert(this);
QObjectPrivate *op = QObjectPrivate::get(obj);
+ d->parent = static_cast(op->metaObject);
*static_cast(this) = *d->type->d->mem;
op->metaObject = this;
}
@@ -201,6 +202,7 @@ QDeclarativeOpenMetaObject::QDeclarativeOpenMetaObject(QObject *obj, QDeclarativ
d->type->d->referers.insert(this);
QObjectPrivate *op = QObjectPrivate::get(obj);
+ d->parent = static_cast(op->metaObject);
*static_cast(this) = *d->type->d->mem;
op->metaObject = this;
}
--
cgit v0.12
From d4cd9c899e705ff01f597f0007def8fbd3ab8b39 Mon Sep 17 00:00:00 2001
From: Alan Alpert
Date: Fri, 19 Nov 2010 09:19:41 +1000
Subject: Add a test on QWS
Without a single test, it fails anyways.
Task-number: QTBUG-14792
---
tests/auto/declarative/qmlvisual/TEST_GUIDELINES | 2 +-
tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp | 6 ++++--
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/tests/auto/declarative/qmlvisual/TEST_GUIDELINES b/tests/auto/declarative/qmlvisual/TEST_GUIDELINES
index cb53b6e..469832f 100644
--- a/tests/auto/declarative/qmlvisual/TEST_GUIDELINES
+++ b/tests/auto/declarative/qmlvisual/TEST_GUIDELINES
@@ -4,4 +4,4 @@ Guidelines for creating new visual tests:
2. Keep it short. It is hoped that these tests can be run regularly, perhaps even for every commit, and if you add up ten seconds for every time someone commits a change to QML then we'll be sitting here for a long time. Completeness is more important than haste, but consider the most time efficient ways to achieve said completeness. Do not forget about snapshot mode (tst_qmlvisual -help for details on -recordsnapshot) when testing that a static scene looks right.
-3. Avoid text. Text is relatively unstable due to platform specific peculiarities. If you need to identify an area, consider a unique color as opposed to a unique text label. If you must use Text, TextEdit, or TextInput, use the test-friendlier versions in the 'shared' directory.
+3. Avoid text. Text is relatively unstable due to platform specific peculiarities. If you need to identify an area, consider a unique color as opposed to a unique text label. If you must use Text, TextEdit, or TextInput, use the test-friendlier versions in the 'shared' directory. Also keep in mind that text anti-aliasing is disabled during tests for greater consistency, and you should never use point sizes in tests. Text autotests can thus only test some aspects of the elements.
diff --git a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
index 8d4d0d1..2a15102 100644
--- a/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
+++ b/tests/auto/declarative/qmlvisual/tst_qmlvisual.cpp
@@ -104,14 +104,16 @@ void tst_qmlvisual::visual_data()
QStringList files;
files << findQmlFiles(QDir(QT_TEST_SOURCE_DIR));
if (qgetenv("QMLVISUAL_ALL") != "1") {
- //Text on X11 varies per distro - and the CI system is currently using something outdated.
#if defined(Q_WS_X11)
+ //Text on X11 varies per distro - and the CI system is currently using something outdated.
foreach(const QString &str, files.filter(QRegExp(".*text.*")))
files.removeAll(str);
#endif
- //We don't want QWS test results to mire down the CI system
#if defined(Q_WS_QWS)
+ //We don't want QWS test results to mire down the CI system
files.clear();
+ //Needs at least one test data or it fails anyways
+ files << QT_TEST_SOURCE_DIR "/selftest_noimages/selftest_noimages.qml";
#endif
}
--
cgit v0.12
From 519264c692f77f6da2fb8a9ac2ddb1d70b39cc90 Mon Sep 17 00:00:00 2001
From: Martin Jones
Date: Fri, 19 Nov 2010 10:55:22 +1000
Subject: Doc: clarify Flickable children vs. contentItem children.
---
src/declarative/graphicsitems/qdeclarativeflickable.cpp | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/declarative/graphicsitems/qdeclarativeflickable.cpp b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
index 3a3189c..1870647 100644
--- a/src/declarative/graphicsitems/qdeclarativeflickable.cpp
+++ b/src/declarative/graphicsitems/qdeclarativeflickable.cpp
@@ -386,6 +386,13 @@ void QDeclarativeFlickablePrivate::updateBeginningEnd()
\snippet doc/src/snippets/declarative/flickable.qml document
\clearfloat
+
+ Items declared as children of a Flickable are automatically parented to the
+ Flickable's \l contentItem. This should be taken into account when
+ operating on the children of the Flickable; it is usually the children of
+ \c contentItem that are relevant. For example, the bound of Items added
+ to the Flickable will be available by \c contentItem.childrenRect
+
\section1 Limitations
\note Due to an implementation detail, items placed inside a Flickable cannot anchor to it by
--
cgit v0.12
From f3a80c1128a04c9eb04a28b2fe8b468113731c43 Mon Sep 17 00:00:00 2001
From: Joona Petrell
Date: Fri, 19 Nov 2010 13:29:48 +1000
Subject: Add missing symbols to QtOpenGL emulator def file
---
src/s60installs/bwins/QtOpenGLu.def | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/s60installs/bwins/QtOpenGLu.def b/src/s60installs/bwins/QtOpenGLu.def
index fa340e4..620fcb9 100644
--- a/src/s60installs/bwins/QtOpenGLu.def
+++ b/src/s60installs/bwins/QtOpenGLu.def
@@ -8,7 +8,7 @@ EXPORTS
?d_func@QGLShader@@AAEPAVQGLShaderPrivate@@XZ @ 7 NONAME ; class QGLShaderPrivate * QGLShader::d_func(void)
?bindToDynamicTexture@QGLPixelBuffer@@QAE_NI@Z @ 8 NONAME ; bool QGLPixelBuffer::bindToDynamicTexture(unsigned int)
??0QGLWidget@@QAE@PAVQGLContext@@PAVQWidget@@PBV0@V?$QFlags@W4WindowType@Qt@@@@@Z @ 9 NONAME ; QGLWidget::QGLWidget(class QGLContext *, class QWidget *, class QGLWidget const *, class QFlags)
- ??_EQGLFormat@@QAE@I@Z @ 10 NONAME ; QGLFormat::~QGLFormat(unsigned int)
+ ??_EQGLFormat@@QAE@I@Z @ 10 NONAME ABSENT ; QGLFormat::~QGLFormat(unsigned int)
?drawPixmapFragments@QGL2PaintEngineEx@@UAEXPBVPixmapFragment@QPainter@@HABVQPixmap@@V?$QFlags@W4PixmapFragmentHint@QPainter@@@@@Z @ 11 NONAME ; void QGL2PaintEngineEx::drawPixmapFragments(class QPainter::PixmapFragment const *, int, class QPixmap const &, class QFlags)
?paintEngine@QGLWidget@@UBEPAVQPaintEngine@@XZ @ 12 NONAME ; class QPaintEngine * QGLWidget::paintEngine(void) const
?setPreferredPaintEngine@QGL@@YAXW4Type@QPaintEngine@@@Z @ 13 NONAME ; void QGL::setPreferredPaintEngine(enum QPaintEngine::Type)
@@ -107,7 +107,7 @@ EXPORTS
??0QGLContext@@QAE@ABVQGLFormat@@@Z @ 106 NONAME ; QGLContext::QGLContext(class QGLFormat const &)
?geometryOutputVertexCount@QGLShaderProgram@@QBEHXZ @ 107 NONAME ; int QGLShaderProgram::geometryOutputVertexCount(void) const
?setAccum@QGLFormat@@QAEX_N@Z @ 108 NONAME ; void QGLFormat::setAccum(bool)
- ??0QGLSignalProxy@@QAE@XZ @ 109 NONAME ; QGLSignalProxy::QGLSignalProxy(void)
+ ??0QGLSignalProxy@@QAE@XZ @ 109 NONAME ABSENT ; QGLSignalProxy::QGLSignalProxy(void)
?isUninitialized@QGLPixmapData@@ABE_NXZ @ 110 NONAME ; bool QGLPixmapData::isUninitialized(void) const
??0QGLFramebufferObjectFormat@@QAE@XZ @ 111 NONAME ; QGLFramebufferObjectFormat::QGLFramebufferObjectFormat(void)
??8@YA_NABVQGLFormat@@0@Z @ 112 NONAME ; bool operator==(class QGLFormat const &, class QGLFormat const &)
@@ -496,7 +496,7 @@ EXPORTS
?setUniformValue@QGLShaderProgram@@QAEXPBDABVQSize@@@Z @ 495 NONAME ; void QGLShaderProgram::setUniformValue(char const *, class QSize const &)
?convertToGLFormat@QGLWidget@@SA?AVQImage@@ABV2@@Z @ 496 NONAME ; class QImage QGLWidget::convertToGLFormat(class QImage const &)
?staticMetaObject@QGLTextureGlyphCache@@2UQMetaObject@@B @ 497 NONAME ; struct QMetaObject const QGLTextureGlyphCache::staticMetaObject
- ??_EQGLContextResource@@QAE@I@Z @ 498 NONAME ; QGLContextResource::~QGLContextResource(unsigned int)
+ ??_EQGLContextResource@@QAE@I@Z @ 498 NONAME ABSENT ; QGLContextResource::~QGLContextResource(unsigned int)
?handle@QGLColormap@@IAEKXZ @ 499 NONAME ; unsigned long QGLColormap::handle(void)
?isCreated@QGLBuffer@@QBE_NXZ @ 500 NONAME ; bool QGLBuffer::isCreated(void) const
?setColormap@QGLWidget@@QAEXABVQGLColormap@@@Z @ 501 NONAME ; void QGLWidget::setColormap(class QGLColormap const &)
@@ -698,4 +698,9 @@ EXPORTS
?setProfile@QGLFormat@@QAEXW4OpenGLContextProfile@1@@Z @ 697 NONAME ; void QGLFormat::setProfile(enum QGLFormat::OpenGLContextProfile)
?updateDynamicTexture@QGLPixelBuffer@@QBEXI@Z @ 698 NONAME ; void QGLPixelBuffer::updateDynamicTexture(unsigned int) const
?setUniformValue@QGLShaderProgram@@QAEXHH@Z @ 699 NONAME ; void QGLShaderProgram::setUniformValue(int, int)
+ ?maxTextureHeight@QGLTextureGlyphCache@@UBEHXZ @ 700 NONAME ; int QGLTextureGlyphCache::maxTextureHeight(void) const
+ ?initializeOffscreenTexture@QGLWindowSurface@@AAE_NABVQSize@@@Z @ 701 NONAME ; bool QGLWindowSurface::initializeOffscreenTexture(class QSize const &)
+ ?maxTextureWidth@QGLTextureGlyphCache@@UBEHXZ @ 702 NONAME ; int QGLTextureGlyphCache::maxTextureWidth(void) const
+ ?filterMode@QGLTextureGlyphCache@@QBE?AW4FilterMode@1@XZ @ 703 NONAME ; enum QGLTextureGlyphCache::FilterMode QGLTextureGlyphCache::filterMode(void) const
+ ?setFilterMode@QGLTextureGlyphCache@@QAEXW4FilterMode@1@@Z @ 704 NONAME ; void QGLTextureGlyphCache::setFilterMode(enum QGLTextureGlyphCache::FilterMode)
--
cgit v0.12
From abfdba11b8948497765c24670becf39e2ce1ff6d Mon Sep 17 00:00:00 2001
From: Joona Petrell
Date: Fri, 19 Nov 2010 14:40:33 +1000
Subject: Add missing symbols to QtOpenGL arm def file
---
src/s60installs/eabi/QtOpenGLu.def | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/s60installs/eabi/QtOpenGLu.def b/src/s60installs/eabi/QtOpenGLu.def
index 7ceade4..c92d99e 100644
--- a/src/s60installs/eabi/QtOpenGLu.def
+++ b/src/s60installs/eabi/QtOpenGLu.def
@@ -702,4 +702,9 @@ EXPORTS
_ZeqRK9QGLFormatS1_ @ 701 NONAME
_Zls6QDebugRK9QGLFormat @ 702 NONAME
_ZneRK9QGLFormatS1_ @ 703 NONAME
+ _ZN16QGLWindowSurface26initializeOffscreenTextureERK5QSize @ 704 NONAME
+ _ZNK20QGLTextureGlyphCache15maxTextureWidthEv @ 705 NONAME
+ _ZNK20QGLTextureGlyphCache16maxTextureHeightEv @ 706 NONAME
+ _ZThn8_NK20QGLTextureGlyphCache15maxTextureWidthEv @ 707 NONAME
+ _ZThn8_NK20QGLTextureGlyphCache16maxTextureHeightEv @ 708 NONAME
--
cgit v0.12
From ac62887fe00eb22ea00622d4c3dab5ff40417e76 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy
Date: Fri, 19 Nov 2010 16:23:52 +1000
Subject: Don't leak QML compiled data objects
Task-number: QTBUG-14761
---
src/declarative/qml/qdeclarativecompileddata.cpp | 4 ++--
src/declarative/qml/qdeclarativecompiler.cpp | 2 --
src/declarative/qml/qdeclarativecompiler_p.h | 4 +---
3 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/src/declarative/qml/qdeclarativecompileddata.cpp b/src/declarative/qml/qdeclarativecompileddata.cpp
index a4ecc77..690f499 100644
--- a/src/declarative/qml/qdeclarativecompileddata.cpp
+++ b/src/declarative/qml/qdeclarativecompileddata.cpp
@@ -169,8 +169,8 @@ QDeclarativeCompiledData::QDeclarativeCompiledData(QDeclarativeEngine *engine)
QDeclarativeCompiledData::~QDeclarativeCompiledData()
{
for (int ii = 0; ii < types.count(); ++ii) {
- if (types.at(ii).ref)
- types.at(ii).ref->release();
+ if (types.at(ii).component)
+ types.at(ii).component->release();
}
for (int ii = 0; ii < propertyCaches.count(); ++ii)
diff --git a/src/declarative/qml/qdeclarativecompiler.cpp b/src/declarative/qml/qdeclarativecompiler.cpp
index b2740b8..645402e 100644
--- a/src/declarative/qml/qdeclarativecompiler.cpp
+++ b/src/declarative/qml/qdeclarativecompiler.cpp
@@ -591,8 +591,6 @@ bool QDeclarativeCompiler::compile(QDeclarativeEngine *engine,
}
} else if (tref.typeData) {
ref.component = tref.typeData->compiledData();
- ref.ref = tref.typeData;
- ref.ref->addref();
}
ref.className = parserRef->name.toUtf8();
out->types << ref;
diff --git a/src/declarative/qml/qdeclarativecompiler_p.h b/src/declarative/qml/qdeclarativecompiler_p.h
index 43a0901..5cd1fd2 100644
--- a/src/declarative/qml/qdeclarativecompiler_p.h
+++ b/src/declarative/qml/qdeclarativecompiler_p.h
@@ -89,14 +89,12 @@ public:
struct TypeReference
{
TypeReference()
- : type(0), component(0), ref(0) {}
+ : type(0), component(0) {}
QByteArray className;
QDeclarativeType *type;
-// QDeclarativeComponent *component;
QDeclarativeCompiledData *component;
- QDeclarativeRefCount *ref;
QObject *createInstance(QDeclarativeContextData *, const QBitField &, QList *) const;
const QMetaObject *metaObject() const;
};
--
cgit v0.12
From 1119a86b9752a1a58dade499a2884b89b2275a57 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy
Date: Fri, 19 Nov 2010 16:34:05 +1000
Subject: Allow testing of raster engine on Mac from qmlviewer
---
tools/qml/main.cpp | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/tools/qml/main.cpp b/tools/qml/main.cpp
index 579f1ab..209c72f 100644
--- a/tools/qml/main.cpp
+++ b/tools/qml/main.cpp
@@ -155,7 +155,11 @@ void usage()
qWarning(" -I ........................... prepend to the module import search path,");
qWarning(" display path if is empty");
qWarning(" -P ........................... prepend to the plugin search path");
+#if defined(Q_WS_MAC)
+ qWarning(" -no-opengl ............................... don't use a QGLWidget for the viewport");
+#else
qWarning(" -opengl .................................. use a QGLWidget for the viewport");
+#endif
qWarning(" -script ........................... set the script to use");
qWarning(" -scriptopts |help ............... set the script options to use");
@@ -370,8 +374,13 @@ static void parseCommandLineOptions(const QStringList &arguments)
} else if (arg == "-translation") {
if (lastArg) usage();
opts.translationFile = arguments.at(++i);
+#if defined(Q_WS_MAC)
+ } else if (arg == "-no-opengl") {
+ opts.useGL = false;
+#else
} else if (arg == "-opengl") {
opts.useGL = true;
+#endif
} else if (arg == "-qmlbrowser") {
opts.useNativeFileBrowser = false;
} else if (arg == "-warnings") {
--
cgit v0.12
From a26d41fc2732e225dc9a1b5eb5224cc499ae87b4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?=
Date: Thu, 18 Nov 2010 15:06:45 +0100
Subject: Improve performance of hfw in qgridlayoutengine by adding more
caching.
The previous code tried to do caching of queries with constraints too,
but it's usecase was rather limited.
The caching worked for the simple case of
effectiveSizeHint(Qt::PreferredSize, QSize(10, -1));
effectiveSizeHint(Qt::PreferredSize, QSize(10, -1)); // uses cache
The problem was that if somebody called this sequence:
effectiveSizeHint(Qt::PreferredSize, QSize(10, -1));
effectiveSizeHint(Qt::PreferredSize, QSize(-1, -1));
effectiveSizeHint(Qt::PreferredSize, QSize(10, -1));
Each call would disregard the cache because the constraint was
different.
Now the pattern is used in the qgridlayoutengine itself when we
calculate hfw: (yes, height-for-width).
First, we ask for the horizontal size hints with no constraints.
Then, we'll ask for the vertical size hints with constraints.
Since horizontal and vertical ultimately comes from the same function
(effectiveSizeHint) it will invalidate the cache each time.
The solution is to add another cache for the sizeHints with
constraints.
The most notable improvement is in the hfw, nested case. Result:
RESULT : tst_QGraphicsLinearLayout::heightForWidth():"hfw, nested":
546 msecs per iteration (total: 546, iterations: 1)
RESULT : tst_QGraphicsLinearLayout::heightForWidth():"hfw, nested":
0.000029 msecs per iteration (total: 62, iterations: 2097152)
Improvement: 18,827,586 times faster (!!)
---
src/gui/graphicsview/qgraphicslayoutitem.cpp | 35 ++++--
src/gui/graphicsview/qgraphicslayoutitem_p.h | 2 +
.../qgraphicslinearlayout.pro | 6 +
.../tst_qgraphicslinearlayout.cpp | 133 +++++++++++++++++++++
4 files changed, 165 insertions(+), 11 deletions(-)
create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/qgraphicslinearlayout.pro
create mode 100644 tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
diff --git a/src/gui/graphicsview/qgraphicslayoutitem.cpp b/src/gui/graphicsview/qgraphicslayoutitem.cpp
index e43f7fa..016cfbf 100644
--- a/src/gui/graphicsview/qgraphicslayoutitem.cpp
+++ b/src/gui/graphicsview/qgraphicslayoutitem.cpp
@@ -137,19 +137,28 @@ void QGraphicsLayoutItemPrivate::init()
QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint) const
{
Q_Q(const QGraphicsLayoutItem);
- if (!sizeHintCacheDirty && cachedConstraint == constraint)
- return cachedSizeHints;
+ QSizeF *sizeHintCache;
+ const bool hasConstraint = constraint.width() >= 0 || constraint.height() >= 0;
+ if (hasConstraint) {
+ if (!sizeHintWithConstraintCacheDirty && constraint == cachedConstraint)
+ return cachedSizeHintsWithConstraints;
+ sizeHintCache = cachedSizeHintsWithConstraints;
+ } else {
+ if (!sizeHintCacheDirty)
+ return cachedSizeHints;
+ sizeHintCache = cachedSizeHints;
+ }
for (int i = 0; i < Qt::NSizeHints; ++i) {
- cachedSizeHints[i] = constraint;
+ sizeHintCache[i] = constraint;
if (userSizeHints)
- combineSize(cachedSizeHints[i], userSizeHints[i]);
+ combineSize(sizeHintCache[i], userSizeHints[i]);
}
- QSizeF &minS = cachedSizeHints[Qt::MinimumSize];
- QSizeF &prefS = cachedSizeHints[Qt::PreferredSize];
- QSizeF &maxS = cachedSizeHints[Qt::MaximumSize];
- QSizeF &descentS = cachedSizeHints[Qt::MinimumDescent];
+ QSizeF &minS = sizeHintCache[Qt::MinimumSize];
+ QSizeF &prefS = sizeHintCache[Qt::PreferredSize];
+ QSizeF &maxS = sizeHintCache[Qt::MaximumSize];
+ QSizeF &descentS = sizeHintCache[Qt::MinimumDescent];
normalizeHints(minS.rwidth(), prefS.rwidth(), maxS.rwidth(), descentS.rwidth());
normalizeHints(minS.rheight(), prefS.rheight(), maxS.rheight(), descentS.rheight());
@@ -175,9 +184,13 @@ QSizeF *QGraphicsLayoutItemPrivate::effectiveSizeHints(const QSizeF &constraint)
// Not supported yet
// COMBINE_SIZE(descentS, q->sizeHint(Qt::MinimumDescent, constraint));
- cachedConstraint = constraint;
- sizeHintCacheDirty = false;
- return cachedSizeHints;
+ if (hasConstraint) {
+ cachedConstraint = constraint;
+ sizeHintWithConstraintCacheDirty = false;
+ } else {
+ sizeHintCacheDirty = false;
+ }
+ return sizeHintCache;
}
diff --git a/src/gui/graphicsview/qgraphicslayoutitem_p.h b/src/gui/graphicsview/qgraphicslayoutitem_p.h
index b752e03..d72ee9f 100644
--- a/src/gui/graphicsview/qgraphicslayoutitem_p.h
+++ b/src/gui/graphicsview/qgraphicslayoutitem_p.h
@@ -85,8 +85,10 @@ public:
QSizeF *userSizeHints;
mutable QSizeF cachedSizeHints[Qt::NSizeHints];
mutable QSizeF cachedConstraint;
+ mutable QSizeF cachedSizeHintsWithConstraints[Qt::NSizeHints];
mutable quint32 sizeHintCacheDirty : 1;
+ mutable quint32 sizeHintWithConstraintCacheDirty : 1;
quint32 isLayout : 1;
quint32 ownedByLayout : 1;
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/qgraphicslinearlayout.pro b/tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/qgraphicslinearlayout.pro
new file mode 100644
index 0000000..ff85fe8
--- /dev/null
+++ b/tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/qgraphicslinearlayout.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_bench_qgraphicslinearlayout
+
+SOURCES += tst_qgraphicslinearlayout.cpp
+
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
new file mode 100644
index 0000000..0dd9543
--- /dev/null
+++ b/tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -0,0 +1,133 @@
+/****************************************************************************
+**
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
+** All rights reserved.
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** No Commercial Usage
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights. These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**
+**
+**
+**
+**
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include
+#include
+#include
+#include
+
+class tst_QGraphicsLinearLayout : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QGraphicsLinearLayout() {}
+ ~tst_QGraphicsLinearLayout() {}
+
+private slots:
+ void heightForWidth_data();
+ void heightForWidth();
+};
+
+
+struct MySquareWidget : public QGraphicsWidget
+{
+ MySquareWidget() {}
+ virtual QSizeF sizeHint ( Qt::SizeHint which, const QSizeF & constraint = QSizeF() ) const
+ {
+ if (which != Qt::PreferredSize)
+ return QGraphicsWidget::sizeHint(which, constraint);
+ if (constraint.width() < 0)
+ return QGraphicsWidget::sizeHint(which, constraint);
+ return QSizeF(constraint.width(), constraint.width());
+ }
+};
+
+void tst_QGraphicsLinearLayout::heightForWidth_data()
+{
+ QTest::addColumn("hfw");
+ QTest::addColumn("nested");
+
+ QTest::newRow("hfw") << true << false;
+ QTest::newRow("hfw, nested") << true << true;
+ QTest::newRow("not hfw") << false << false;
+ QTest::newRow("not hfw, nested") << false << true;
+}
+
+void tst_QGraphicsLinearLayout::heightForWidth()
+{
+ QFETCH(bool, hfw);
+ QFETCH(bool, nested);
+
+ QGraphicsScene scene;
+ QGraphicsWidget *form = new QGraphicsWidget;
+ scene.addItem(form);
+
+ QGraphicsLinearLayout *outerlayout = 0;
+ if (nested) {
+ outerlayout = new QGraphicsLinearLayout(form);
+ for(int i = 0; i < 8; i++) {
+ QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
+ outerlayout->addItem(layout);
+ outerlayout = layout;
+ }
+ }
+
+ QGraphicsLinearLayout *qlayout = 0;
+ qlayout = new QGraphicsLinearLayout(Qt::Vertical);
+ if (nested)
+ outerlayout->addItem(qlayout);
+ else
+ form->setLayout(qlayout);
+
+ MySquareWidget *widget = new MySquareWidget;
+ for (int i = 0; i < 1; i++) {
+ widget = new MySquareWidget;
+ QSizePolicy sizepolicy = widget->sizePolicy();
+ sizepolicy.setHeightForWidth(hfw);
+ widget->setSizePolicy(sizepolicy);
+ qlayout->addItem(widget);
+ }
+ // make sure only one iteration is done.
+ // run with tst_QGraphicsLinearLayout.exe "heightForWidth" -tickcounter -iterations 6
+ // this will iterate 6 times the whole test, (not only the benchmark)
+ // which should reduce warmup time and give a realistic picture of the performance of
+ // effectiveSizeHint()
+ QSizeF constraint(hfw ? 100 : -1, -1);
+ QBENCHMARK {
+ (void)form->effectiveSizeHint(Qt::PreferredSize, constraint);
+ }
+
+}
+
+
+QTEST_MAIN(tst_QGraphicsLinearLayout)
+
+#include "tst_qgraphicslinearlayout.moc"
--
cgit v0.12
From 1960713543e2a5fee76df7dbf06ea70cf277d696 Mon Sep 17 00:00:00 2001
From: Alan Alpert
Date: Fri, 19 Nov 2010 18:29:11 +1000
Subject: Initial commit of qmlvisualaids
A tool to make it easier to do the platform visual updating. Needs to be
streamlined at least a little in order to make it feasible to stay up to
date.
Task-number: QTBUG-14792
---
.../qmlvisual/shared/qmlvisualaids/Button.qml | 19 +++++
.../qmlvisual/shared/qmlvisualaids/Comparison.qml | 75 +++++++++++++++++
.../qmlvisual/shared/qmlvisualaids/main.cpp | 14 ++++
.../qmlvisual/shared/qmlvisualaids/mainwindow.cpp | 74 +++++++++++++++++
.../qmlvisual/shared/qmlvisualaids/mainwindow.h | 31 +++++++
.../qmlvisual/shared/qmlvisualaids/qmlvisual.pro | 26 ++++++
.../qmlvisual/shared/qmlvisualaids/qmlvisual.qrc | 6 ++
.../qmlvisual/shared/qmlvisualaids/testmodel.cpp | 96 ++++++++++++++++++++++
.../qmlvisual/shared/qmlvisualaids/testmodel.h | 50 +++++++++++
9 files changed, 391 insertions(+)
create mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Button.qml
create mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Comparison.qml
create mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/main.cpp
create mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.cpp
create mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.h
create mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.pro
create mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.qrc
create mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.cpp
create mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.h
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Button.qml b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Button.qml
new file mode 100644
index 0000000..600079f
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Button.qml
@@ -0,0 +1,19 @@
+import Qt 4.7
+
+Rectangle {
+ width: txt.width + 16
+ height: txt.height + 8
+ radius: 4
+ border.color: "black"
+ property alias caption: txt.text
+ signal triggered
+ Text{
+ id: txt
+ text: "Button"
+ anchors.centerIn: parent
+ }
+ MouseArea{
+ anchors.fill: parent
+ onClicked: parent.triggered()
+ }
+}
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Comparison.qml b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Comparison.qml
new file mode 100644
index 0000000..43b10d4
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Comparison.qml
@@ -0,0 +1,75 @@
+import Qt 4.7
+
+Item{
+ width: 1000
+ height:800
+ Row{
+ spacing: 4
+ Button{
+ caption: "run"
+ onTriggered: test.runTest()
+ }
+
+ Button{
+ caption: "update"
+ onTriggered: test.updateVisuals()
+ }
+
+ Button{
+ caption: "platform"
+ onTriggered: test.updatePlatformVisuals()
+ }
+ }
+
+ Rectangle {
+ y: 180
+ width: 1000
+ height: 620
+ Row{
+ id: grid
+ spacing: 4
+ Text{
+ width: 300
+ height: 200
+ text: test.testName
+ clip: true; wrapMode: Text.WordWrap
+ }
+ Text{
+ width: 300
+ height: 200
+ text: test.testCase
+ clip: true; wrapMode: Text.WordWrap
+ }
+ Text{
+ width: 300
+ height: 200
+ text: test.testScript
+ clip: true; wrapMode: Text.WordWrap
+ }
+ }
+ Item{
+ y: 200
+ Row{
+ ListView{
+ width: 200; height: 400
+ delegate: Rectangle{ width: 200; height: 200; color: "blue"; Image{ source: modelData }}
+ model: test.goodImages;
+ }
+ ListView{
+ width: 200; height: 400
+ delegate: Rectangle{ width: 200; height: 200; color: "blue"; Image{ source: modelData }}
+ model: test.diffImages;
+ }
+ ListView{
+ width: 200; height: 400
+ delegate: Rectangle{ width: 200; height: 200; color: "blue"; Image{ source: modelData }}
+ model: test.badImages;
+ }
+ }
+ }
+ MouseArea{
+ anchors.fill: parent
+ onClicked: test.moveOn();
+ }
+ }
+}
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/main.cpp b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/main.cpp
new file mode 100644
index 0000000..2d35350
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/main.cpp
@@ -0,0 +1,14 @@
+#include
+#include
+#include "mainwindow.h"
+#include
+#include
+#include
+
+int main(int argc, char *argv[])
+{
+ QApplication a(argc, argv);
+ MainWindow *m = new MainWindow;
+ m->show();
+ return a.exec();
+}
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.cpp b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.cpp
new file mode 100644
index 0000000..49614ec
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.cpp
@@ -0,0 +1,74 @@
+#include "mainwindow.h"
+#include
+#include
+
+MainWindow::MainWindow(QWidget *parent) :
+ QMainWindow(parent), testIdx(-1)
+{
+ createMenus();
+ view = new QDeclarativeView(this);
+ setCentralWidget(view);
+ view->setResizeMode(QDeclarativeView::SizeViewToRootObject);
+ curTest = new TestModel(this);
+ connect(curTest, SIGNAL(moveOn()),
+ this, SLOT(runTests()));
+
+ view->engine()->rootContext()->setContextProperty("test", curTest);
+ view->setSource(QUrl("qrc:qml/Comparison.qml"));
+}
+
+void MainWindow::runAllTests()
+{
+ tests.clear();
+ testIdx = 0;
+
+ QString visualTest = "./tst_qmlvisual";//TODO: Crossplatform
+
+ QProcess p;//TODO: Error checking here
+ p.setProcessChannelMode(QProcess::MergedChannels);
+ p.start(visualTest, QStringList());
+ p.waitForFinished(-1);//Can't time out, because it takes an indeterminate and long time
+
+ QString output = QString(p.readAllStandardOutput());
+ QRegExp re("QDeclarativeTester\\( \"([^\"]*)\" \\)");
+ int offset=0;
+ while((offset = re.indexIn(output, offset)) != -1){
+ tests << re.cap(1);
+ offset++;
+ }
+
+ if(tests.count())
+ QMessageBox::information(this, "Test Results", QString("Tests completed. %1 test failures occurred.").arg(tests.count()));
+ else
+ QMessageBox::information(this, "Test Results", "Tests completed. All tests passed!");
+
+ runTests();
+}
+
+void MainWindow::runTests()
+{
+ if(testIdx >= tests.size())
+ testIdx = -1;
+ if(testIdx == -1)
+ return;
+ showFixScreen(tests[testIdx++]);
+}
+
+void MainWindow::showFixScreen(const QString &path)
+{
+ if(curTest->setTest(path)){
+ view->engine()->rootContext()->setContextProperty("test", curTest); //signal connects to runTests
+ }else{
+ QMessageBox::critical(this, "Test Error", QString("Cannot find test %1.").arg(path));
+ runTests();
+ }
+}
+
+void MainWindow::createMenus()
+{
+ QMenu *tests = this->menuBar()->addMenu("Tests");
+ tests->addAction("Run All", this, SLOT(runAllTests()));
+ tests->addSeparator();
+ tests->addAction("About Qt...", qApp, SLOT(aboutQt()));
+ tests->addAction("Quit", qApp, SLOT(quit()));
+}
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.h b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.h
new file mode 100644
index 0000000..0209064
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.h
@@ -0,0 +1,31 @@
+#ifndef MAINWINDOW_H
+#define MAINWINDOW_H
+
+#include
+#include
+#include
+#include
+#include "testmodel.h"
+
+class MainWindow : public QMainWindow
+{
+ Q_OBJECT
+public:
+ explicit MainWindow(QWidget *parent = 0);
+ void createMenus();
+
+signals:
+
+public slots:
+ void runTests();
+ void runAllTests();
+ void showFixScreen(const QString& path);
+
+private:
+ QDeclarativeView* view;
+ TestModel *curTest;
+ QStringList tests;
+ int testIdx;
+};
+
+#endif // MAINWINDOW_H
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.pro b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.pro
new file mode 100644
index 0000000..d18c235
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.pro
@@ -0,0 +1,26 @@
+#-------------------------------------------------
+#
+# Project created by QtCreator 2010-11-19T09:48:39
+#
+#-------------------------------------------------
+
+QT += core gui declarative
+
+TARGET = ../../qmlvisualaids
+TEMPLATE = app
+
+
+SOURCES += main.cpp \
+ testmodel.cpp \
+ mainwindow.cpp
+
+HEADERS += \
+ testmodel.h \
+ mainwindow.h
+
+OTHER_FILES += \
+ Comparison.qml \
+ Button.qml
+
+RESOURCES += \
+ qmlvisual.qrc
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.qrc b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.qrc
new file mode 100644
index 0000000..d79b64c
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.qrc
@@ -0,0 +1,6 @@
+
+
+ Comparison.qml
+ Button.qml
+
+
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.cpp b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.cpp
new file mode 100644
index 0000000..4aec14b
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.cpp
@@ -0,0 +1,96 @@
+#include "testmodel.h"
+#include
+#include
+#include
+
+TestModel::TestModel(QObject *parent) :
+ QObject(parent), _testName("Invalid")
+{
+
+}
+
+//testPath is the path to the test script, and assumes the file under test has the same name and is in the dir above
+bool TestModel::setTest(const QString &testPath)
+{
+ _good.clear();
+ _bad.clear();
+ _diff.clear();
+
+ _testScriptPath = testPath;
+ if(!_testScriptPath.endsWith(".qml"))
+ _testScriptPath += ".qml";
+ _testName = _testScriptPath.split('/').last();
+
+ //Assumed that the test case is in the directory above and has the same name as the script
+ _testPath = _testScriptPath.left(_testScriptPath.lastIndexOf('/', _testScriptPath.lastIndexOf('/') - 1))
+ + '/' + _testName;
+
+ bool ret = QFile::exists(_testPath) && QFile::exists(_testScriptPath);
+ if(!ret)
+ return ret;
+
+ QFile test(_testPath);
+ test.open(QFile::ReadOnly | QFile::Text);
+ _testCase = test.readAll();
+
+ QFile script(_testScriptPath);
+ script.open(QFile::ReadOnly | QFile::Text);
+ _testScript = script.readAll();
+
+ QString base = _testScriptPath;
+ base.chop(4);//remove .qml, replace with .%1.png
+ base += ".%1.png";
+ int c = 0;
+ while (QFile::exists(base.arg(c))) {
+ _good << "file://" + base.arg(c);
+ if(QFile::exists(base.arg(c) + ".reject.png"))
+ _bad << "file://" + base.arg(c) + ".reject.png";
+ else
+ _bad << "";
+
+ if(QFile::exists(base.arg(c) + ".diff.png"))
+ _diff << "file://" + base.arg(c) + ".diff.png";
+ else
+ _diff << "";
+
+ c++;
+ }
+
+ return ret;
+}
+
+//returns true iff running the test changed the failure images.
+bool TestModel::runTest()
+{
+ launchTester("-play");
+ return false;//TODO: Actually check that
+}
+
+void TestModel::updateVisuals()
+{
+ launchTester("-updatevisuals");
+}
+
+void TestModel::updatePlatformVisuals()
+{
+ launchTester("-updateplatformvisuals");
+}
+
+void TestModel::launchTester(const QString &args)
+{
+ QStringList arguments;
+ arguments << args << _testPath;
+
+ QString visualTest;
+#if defined(Q_WS_WIN) || defined(Q_WS_S60)
+ visualTest = "tst_qmlvisual.exe";
+#else
+ visualTest = "./tst_qmlvisual";
+#endif
+
+ QProcess p;
+ p.setProcessChannelMode(QProcess::ForwardedChannels);
+ p.start(visualTest, arguments);
+ p.waitForFinished();
+}
+
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.h b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.h
new file mode 100644
index 0000000..fd64dc2
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.h
@@ -0,0 +1,50 @@
+#ifndef TESTMODEL_H
+#define TESTMODEL_H
+
+#include
+#include
+#include
+
+class TestModel : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int snapshotCount READ snapshotCount CONSTANT)
+ Q_PROPERTY(QStringList goodImages READ goodImages CONSTANT)//List of image locatoins
+ Q_PROPERTY(QStringList badImages READ badImages CONSTANT)
+ Q_PROPERTY(QStringList diffImages READ diffImages CONSTANT)
+ Q_PROPERTY(QString testName READ testName CONSTANT) //The qml file name
+ Q_PROPERTY(QString testCase READ testCase CONSTANT) //The actual contents, not the location
+ Q_PROPERTY(QString testScript READ testScript CONSTANT) //The actual contents, not the location
+public:
+ explicit TestModel(QObject *parent = 0);
+ bool setTest(const QString &testPath);//testPath is the path to the test script, and assumes the file under test has the same name and is in the dir above
+
+ int snapshotCount() { return _count; }
+ QString testCase() { return _testCase; }
+ QString testName() { return _testName; }
+ QString testScript() {return _testScript; }
+ QStringList goodImages() {return _good;}
+ QStringList badImages() { return _bad; }
+ QStringList diffImages() {return _diff;}
+
+signals:
+ void moveOn();
+
+public slots:
+ bool runTest();//returns true iff running the test changed the failure images.
+ void updateVisuals();
+ void updatePlatformVisuals();
+
+private:
+ void launchTester(const QString &args);
+
+ int _count;
+ QStringList _good,_bad,_diff;
+ QString _testCase;
+ QString _testScript;
+ QString _testPath;
+ QString _testScriptPath;
+ QString _testName;
+};
+
+#endif // TESTMODEL_H
--
cgit v0.12
From 18205faa87abd85d0848291738821666928b5769 Mon Sep 17 00:00:00 2001
From: Alan Alpert
Date: Fri, 19 Nov 2010 19:31:01 +1000
Subject: Move qmlvisualaids to another repo
Moved to a personal repo, since its fate is a little uncertain so it
shouldn't draw this much attention.
Task-number: QTBUG-14792
---
.../qmlvisual/shared/qmlvisualaids/Button.qml | 19 -----
.../qmlvisual/shared/qmlvisualaids/Comparison.qml | 75 -----------------
.../qmlvisual/shared/qmlvisualaids/main.cpp | 14 ----
.../qmlvisual/shared/qmlvisualaids/mainwindow.cpp | 74 -----------------
.../qmlvisual/shared/qmlvisualaids/mainwindow.h | 31 -------
.../qmlvisual/shared/qmlvisualaids/qmlvisual.pro | 26 ------
.../qmlvisual/shared/qmlvisualaids/qmlvisual.qrc | 6 --
.../qmlvisual/shared/qmlvisualaids/testmodel.cpp | 96 ----------------------
.../qmlvisual/shared/qmlvisualaids/testmodel.h | 50 -----------
9 files changed, 391 deletions(-)
delete mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Button.qml
delete mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Comparison.qml
delete mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/main.cpp
delete mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.cpp
delete mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.h
delete mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.pro
delete mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.qrc
delete mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.cpp
delete mode 100644 tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.h
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Button.qml b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Button.qml
deleted file mode 100644
index 600079f..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Button.qml
+++ /dev/null
@@ -1,19 +0,0 @@
-import Qt 4.7
-
-Rectangle {
- width: txt.width + 16
- height: txt.height + 8
- radius: 4
- border.color: "black"
- property alias caption: txt.text
- signal triggered
- Text{
- id: txt
- text: "Button"
- anchors.centerIn: parent
- }
- MouseArea{
- anchors.fill: parent
- onClicked: parent.triggered()
- }
-}
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Comparison.qml b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Comparison.qml
deleted file mode 100644
index 43b10d4..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/Comparison.qml
+++ /dev/null
@@ -1,75 +0,0 @@
-import Qt 4.7
-
-Item{
- width: 1000
- height:800
- Row{
- spacing: 4
- Button{
- caption: "run"
- onTriggered: test.runTest()
- }
-
- Button{
- caption: "update"
- onTriggered: test.updateVisuals()
- }
-
- Button{
- caption: "platform"
- onTriggered: test.updatePlatformVisuals()
- }
- }
-
- Rectangle {
- y: 180
- width: 1000
- height: 620
- Row{
- id: grid
- spacing: 4
- Text{
- width: 300
- height: 200
- text: test.testName
- clip: true; wrapMode: Text.WordWrap
- }
- Text{
- width: 300
- height: 200
- text: test.testCase
- clip: true; wrapMode: Text.WordWrap
- }
- Text{
- width: 300
- height: 200
- text: test.testScript
- clip: true; wrapMode: Text.WordWrap
- }
- }
- Item{
- y: 200
- Row{
- ListView{
- width: 200; height: 400
- delegate: Rectangle{ width: 200; height: 200; color: "blue"; Image{ source: modelData }}
- model: test.goodImages;
- }
- ListView{
- width: 200; height: 400
- delegate: Rectangle{ width: 200; height: 200; color: "blue"; Image{ source: modelData }}
- model: test.diffImages;
- }
- ListView{
- width: 200; height: 400
- delegate: Rectangle{ width: 200; height: 200; color: "blue"; Image{ source: modelData }}
- model: test.badImages;
- }
- }
- }
- MouseArea{
- anchors.fill: parent
- onClicked: test.moveOn();
- }
- }
-}
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/main.cpp b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/main.cpp
deleted file mode 100644
index 2d35350..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/main.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
-#include
-#include
-#include "mainwindow.h"
-#include
-#include
-#include
-
-int main(int argc, char *argv[])
-{
- QApplication a(argc, argv);
- MainWindow *m = new MainWindow;
- m->show();
- return a.exec();
-}
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.cpp b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.cpp
deleted file mode 100644
index 49614ec..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-#include "mainwindow.h"
-#include
-#include
-
-MainWindow::MainWindow(QWidget *parent) :
- QMainWindow(parent), testIdx(-1)
-{
- createMenus();
- view = new QDeclarativeView(this);
- setCentralWidget(view);
- view->setResizeMode(QDeclarativeView::SizeViewToRootObject);
- curTest = new TestModel(this);
- connect(curTest, SIGNAL(moveOn()),
- this, SLOT(runTests()));
-
- view->engine()->rootContext()->setContextProperty("test", curTest);
- view->setSource(QUrl("qrc:qml/Comparison.qml"));
-}
-
-void MainWindow::runAllTests()
-{
- tests.clear();
- testIdx = 0;
-
- QString visualTest = "./tst_qmlvisual";//TODO: Crossplatform
-
- QProcess p;//TODO: Error checking here
- p.setProcessChannelMode(QProcess::MergedChannels);
- p.start(visualTest, QStringList());
- p.waitForFinished(-1);//Can't time out, because it takes an indeterminate and long time
-
- QString output = QString(p.readAllStandardOutput());
- QRegExp re("QDeclarativeTester\\( \"([^\"]*)\" \\)");
- int offset=0;
- while((offset = re.indexIn(output, offset)) != -1){
- tests << re.cap(1);
- offset++;
- }
-
- if(tests.count())
- QMessageBox::information(this, "Test Results", QString("Tests completed. %1 test failures occurred.").arg(tests.count()));
- else
- QMessageBox::information(this, "Test Results", "Tests completed. All tests passed!");
-
- runTests();
-}
-
-void MainWindow::runTests()
-{
- if(testIdx >= tests.size())
- testIdx = -1;
- if(testIdx == -1)
- return;
- showFixScreen(tests[testIdx++]);
-}
-
-void MainWindow::showFixScreen(const QString &path)
-{
- if(curTest->setTest(path)){
- view->engine()->rootContext()->setContextProperty("test", curTest); //signal connects to runTests
- }else{
- QMessageBox::critical(this, "Test Error", QString("Cannot find test %1.").arg(path));
- runTests();
- }
-}
-
-void MainWindow::createMenus()
-{
- QMenu *tests = this->menuBar()->addMenu("Tests");
- tests->addAction("Run All", this, SLOT(runAllTests()));
- tests->addSeparator();
- tests->addAction("About Qt...", qApp, SLOT(aboutQt()));
- tests->addAction("Quit", qApp, SLOT(quit()));
-}
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.h b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.h
deleted file mode 100644
index 0209064..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/mainwindow.h
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef MAINWINDOW_H
-#define MAINWINDOW_H
-
-#include
-#include
-#include
-#include
-#include "testmodel.h"
-
-class MainWindow : public QMainWindow
-{
- Q_OBJECT
-public:
- explicit MainWindow(QWidget *parent = 0);
- void createMenus();
-
-signals:
-
-public slots:
- void runTests();
- void runAllTests();
- void showFixScreen(const QString& path);
-
-private:
- QDeclarativeView* view;
- TestModel *curTest;
- QStringList tests;
- int testIdx;
-};
-
-#endif // MAINWINDOW_H
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.pro b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.pro
deleted file mode 100644
index d18c235..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.pro
+++ /dev/null
@@ -1,26 +0,0 @@
-#-------------------------------------------------
-#
-# Project created by QtCreator 2010-11-19T09:48:39
-#
-#-------------------------------------------------
-
-QT += core gui declarative
-
-TARGET = ../../qmlvisualaids
-TEMPLATE = app
-
-
-SOURCES += main.cpp \
- testmodel.cpp \
- mainwindow.cpp
-
-HEADERS += \
- testmodel.h \
- mainwindow.h
-
-OTHER_FILES += \
- Comparison.qml \
- Button.qml
-
-RESOURCES += \
- qmlvisual.qrc
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.qrc b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.qrc
deleted file mode 100644
index d79b64c..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/qmlvisual.qrc
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
- Comparison.qml
- Button.qml
-
-
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.cpp b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.cpp
deleted file mode 100644
index 4aec14b..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.cpp
+++ /dev/null
@@ -1,96 +0,0 @@
-#include "testmodel.h"
-#include
-#include
-#include
-
-TestModel::TestModel(QObject *parent) :
- QObject(parent), _testName("Invalid")
-{
-
-}
-
-//testPath is the path to the test script, and assumes the file under test has the same name and is in the dir above
-bool TestModel::setTest(const QString &testPath)
-{
- _good.clear();
- _bad.clear();
- _diff.clear();
-
- _testScriptPath = testPath;
- if(!_testScriptPath.endsWith(".qml"))
- _testScriptPath += ".qml";
- _testName = _testScriptPath.split('/').last();
-
- //Assumed that the test case is in the directory above and has the same name as the script
- _testPath = _testScriptPath.left(_testScriptPath.lastIndexOf('/', _testScriptPath.lastIndexOf('/') - 1))
- + '/' + _testName;
-
- bool ret = QFile::exists(_testPath) && QFile::exists(_testScriptPath);
- if(!ret)
- return ret;
-
- QFile test(_testPath);
- test.open(QFile::ReadOnly | QFile::Text);
- _testCase = test.readAll();
-
- QFile script(_testScriptPath);
- script.open(QFile::ReadOnly | QFile::Text);
- _testScript = script.readAll();
-
- QString base = _testScriptPath;
- base.chop(4);//remove .qml, replace with .%1.png
- base += ".%1.png";
- int c = 0;
- while (QFile::exists(base.arg(c))) {
- _good << "file://" + base.arg(c);
- if(QFile::exists(base.arg(c) + ".reject.png"))
- _bad << "file://" + base.arg(c) + ".reject.png";
- else
- _bad << "";
-
- if(QFile::exists(base.arg(c) + ".diff.png"))
- _diff << "file://" + base.arg(c) + ".diff.png";
- else
- _diff << "";
-
- c++;
- }
-
- return ret;
-}
-
-//returns true iff running the test changed the failure images.
-bool TestModel::runTest()
-{
- launchTester("-play");
- return false;//TODO: Actually check that
-}
-
-void TestModel::updateVisuals()
-{
- launchTester("-updatevisuals");
-}
-
-void TestModel::updatePlatformVisuals()
-{
- launchTester("-updateplatformvisuals");
-}
-
-void TestModel::launchTester(const QString &args)
-{
- QStringList arguments;
- arguments << args << _testPath;
-
- QString visualTest;
-#if defined(Q_WS_WIN) || defined(Q_WS_S60)
- visualTest = "tst_qmlvisual.exe";
-#else
- visualTest = "./tst_qmlvisual";
-#endif
-
- QProcess p;
- p.setProcessChannelMode(QProcess::ForwardedChannels);
- p.start(visualTest, arguments);
- p.waitForFinished();
-}
-
diff --git a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.h b/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.h
deleted file mode 100644
index fd64dc2..0000000
--- a/tests/auto/declarative/qmlvisual/shared/qmlvisualaids/testmodel.h
+++ /dev/null
@@ -1,50 +0,0 @@
-#ifndef TESTMODEL_H
-#define TESTMODEL_H
-
-#include
-#include
-#include
-
-class TestModel : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int snapshotCount READ snapshotCount CONSTANT)
- Q_PROPERTY(QStringList goodImages READ goodImages CONSTANT)//List of image locatoins
- Q_PROPERTY(QStringList badImages READ badImages CONSTANT)
- Q_PROPERTY(QStringList diffImages READ diffImages CONSTANT)
- Q_PROPERTY(QString testName READ testName CONSTANT) //The qml file name
- Q_PROPERTY(QString testCase READ testCase CONSTANT) //The actual contents, not the location
- Q_PROPERTY(QString testScript READ testScript CONSTANT) //The actual contents, not the location
-public:
- explicit TestModel(QObject *parent = 0);
- bool setTest(const QString &testPath);//testPath is the path to the test script, and assumes the file under test has the same name and is in the dir above
-
- int snapshotCount() { return _count; }
- QString testCase() { return _testCase; }
- QString testName() { return _testName; }
- QString testScript() {return _testScript; }
- QStringList goodImages() {return _good;}
- QStringList badImages() { return _bad; }
- QStringList diffImages() {return _diff;}
-
-signals:
- void moveOn();
-
-public slots:
- bool runTest();//returns true iff running the test changed the failure images.
- void updateVisuals();
- void updatePlatformVisuals();
-
-private:
- void launchTester(const QString &args);
-
- int _count;
- QStringList _good,_bad,_diff;
- QString _testCase;
- QString _testScript;
- QString _testPath;
- QString _testScriptPath;
- QString _testName;
-};
-
-#endif // TESTMODEL_H
--
cgit v0.12
From ba4eafaa3bd46cfad891a4bbf1dd7dccefc4702e Mon Sep 17 00:00:00 2001
From: Harald Fernengel
Date: Fri, 19 Nov 2010 10:58:09 +0100
Subject: silence compiler warnings
Silence shadowing warnings from gcc.
---
src/sql/models/qsqlrelationaldelegate.h | 10 +++++-----
src/testlib/qtesttouch.h | 4 ++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/sql/models/qsqlrelationaldelegate.h b/src/sql/models/qsqlrelationaldelegate.h
index 7600e52..96760e1 100644
--- a/src/sql/models/qsqlrelationaldelegate.h
+++ b/src/sql/models/qsqlrelationaldelegate.h
@@ -59,23 +59,23 @@ class QSqlRelationalDelegate: public QItemDelegate
{
public:
-explicit QSqlRelationalDelegate(QObject *parent = 0)
- : QItemDelegate(parent)
+explicit QSqlRelationalDelegate(QObject *aParent = 0)
+ : QItemDelegate(aParent)
{}
~QSqlRelationalDelegate()
{}
-QWidget *createEditor(QWidget *parent,
+QWidget *createEditor(QWidget *aParent,
const QStyleOptionViewItem &option,
const QModelIndex &index) const
{
const QSqlRelationalTableModel *sqlModel = qobject_cast(index.model());
QSqlTableModel *childModel = sqlModel ? sqlModel->relationModel(index.column()) : 0;
if (!childModel)
- return QItemDelegate::createEditor(parent, option, index);
+ return QItemDelegate::createEditor(aParent, option, index);
- QComboBox *combo = new QComboBox(parent);
+ QComboBox *combo = new QComboBox(aParent);
combo->setModel(childModel);
combo->setModelColumn(childModel->fieldIndex(sqlModel->relation(index.column()).displayColumn()));
combo->installEventFilter(const_cast(this));
diff --git a/src/testlib/qtesttouch.h b/src/testlib/qtesttouch.h
index 1beef85..6c58e4c 100644
--- a/src/testlib/qtesttouch.h
+++ b/src/testlib/qtesttouch.h
@@ -106,8 +106,8 @@ namespace QTest
}
private:
- QTouchEventSequence(QWidget *widget, QTouchEvent::DeviceType deviceType)
- : targetWidget(widget), deviceType(deviceType)
+ QTouchEventSequence(QWidget *widget, QTouchEvent::DeviceType aDeviceType)
+ : targetWidget(widget), deviceType(aDeviceType)
{
}
QTouchEventSequence(const QTouchEventSequence &v);
--
cgit v0.12
From 4258dd04e25c8831be9e8a7dc45b52d34782cb35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?=
Date: Fri, 19 Nov 2010 11:19:32 +0100
Subject: Fix the tests that got affected by the behaviour added in
604c51f1fc5c79
Task-number: QTBUG-13551
Task-number: QTBUG-7756
---
tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
index 2e52c4e..35ea059 100644
--- a/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
+++ b/tests/auto/qgraphicsgridlayout/tst_qgraphicsgridlayout.cpp
@@ -2541,7 +2541,7 @@ void tst_QGraphicsGridLayout::geometries_data()
.sizeHint(Qt::MaximumSize, QSizeF(5000,5000))
.heightForWidth(hfw1)
)
- << QSizeF(160, 401)
+ << QSizeF(160, 350)
<< (RectList()
<< QRectF( 0, 0, 80, 100) << QRectF( 80, 0, 80, 100)
<< QRectF( 0, 100, 80, 100) << QRectF( 80, 100, 80, 250)
@@ -2566,7 +2566,7 @@ void tst_QGraphicsGridLayout::geometries_data()
.sizeHint(Qt::MaximumSize, QSizeF(5000,5000))
.heightForWidth(hfw1)
)
- << QSizeF(500, 401)
+ << QSizeF(500, 200)
<< (RectList()
<< QRectF( 0, 0, 100, 100) << QRectF(100, 0, 100, 100)
<< QRectF( 0, 100, 100, 100) << QRectF(100, 100, 400, 50)
--
cgit v0.12
From 4e9b721af573e7d1a16b35778059b374520cf055 Mon Sep 17 00:00:00 2001
From: Sam Magnuson
Date: Fri, 19 Nov 2010 11:24:58 +0100
Subject: Compile with QT_NO_PROXYSCREEN.
Merge-request: 931
Reviewed-by: Oswald Buddenhagen
---
src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
index 2eeee24..fbc539b 100644
--- a/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
+++ b/src/plugins/gfxdrivers/directfb/qdirectfbwindowsurface.cpp
@@ -344,9 +344,11 @@ void QDirectFBWindowSurface::flush(QWidget *widget, const QRegion ®ion,
if (!win)
return;
+#ifndef QT_NO_QWS_PROXYSCREEN
QWExtra *extra = qt_widget_private(widget)->extraData();
if (extra && extra->proxyWidget)
return;
+#endif
const quint8 windowOpacity = quint8(win->windowOpacity() * 0xff);
const QRect windowGeometry = geometry();
--
cgit v0.12
From b0691b5a95c80ecd94867873e912e6952a2ec1b4 Mon Sep 17 00:00:00 2001
From: Sami Merila
Date: Fri, 19 Nov 2010 12:45:46 +0200
Subject: QS60Style: Null pointer crash when using itemviews in some cases
QS60Style attempts to use null pointer when drawing CE_ItemViewItem,
if the parameter widget is provided as null.
This leads to, for example, Chart example app crash in startup.
Reviewed-by: Janne Anttila
---
src/gui/styles/qs60style.cpp | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 5fe9050..22cb7d6 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -1438,10 +1438,11 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &voptAdj, widget);
QRect textRect = subElementRect(SE_ItemViewItemText, &voptAdj, widget);
const QAbstractItemView *itemView = qobject_cast(widget);
- const bool singleSelection =
- (itemView->selectionMode() == QAbstractItemView::SingleSelection ||
- itemView->selectionMode() == QAbstractItemView::NoSelection);
- const bool selectItems = (itemView->selectionBehavior() == QAbstractItemView::SelectItems);
+
+ const bool singleSelection = itemView &&
+ ((itemView->selectionMode() == QAbstractItemView::SingleSelection ||
+ itemView->selectionMode() == QAbstractItemView::NoSelection));
+ const bool selectItems = itemView && (itemView->selectionBehavior() == QAbstractItemView::SelectItems);
// draw themed background for itemview unless background brush has been defined.
if (vopt->backgroundBrush == Qt::NoBrush) {
--
cgit v0.12
From 1be70363b77b0a2ff75a23b5973861922f7a85c7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan-Arve=20S=C3=A6ther?=
Date: Fri, 19 Nov 2010 11:47:42 +0100
Subject: Fix code style
---
.../graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp b/tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
index 0dd9543..dc415fb 100644
--- a/tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
+++ b/tests/benchmarks/gui/graphicsview/qgraphicslinearlayout/tst_qgraphicslinearlayout.cpp
@@ -93,7 +93,7 @@ void tst_QGraphicsLinearLayout::heightForWidth()
QGraphicsLinearLayout *outerlayout = 0;
if (nested) {
outerlayout = new QGraphicsLinearLayout(form);
- for(int i = 0; i < 8; i++) {
+ for (int i = 0; i < 8; i++) {
QGraphicsLinearLayout *layout = new QGraphicsLinearLayout(Qt::Vertical);
outerlayout->addItem(layout);
outerlayout = layout;
--
cgit v0.12
From becc25ad78a89199764a54f45248e4113600f0af Mon Sep 17 00:00:00 2001
From: Sami Merila
Date: Fri, 19 Nov 2010 12:52:06 +0200
Subject: QS60Style: Null pointer crash when using itemviews in some cases
(pt2)
Also remove accidentally added whitespaces.
Task-number: QTBUG-15455
Reviewed-by: TrustMe
---
src/gui/styles/qs60style.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index a58c8e5..2f09529 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -1438,8 +1438,8 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
const QRect iconRect = subElementRect(SE_ItemViewItemDecoration, &voptAdj, widget);
QRect textRect = subElementRect(SE_ItemViewItemText, &voptAdj, widget);
const QAbstractItemView *itemView = qobject_cast(widget);
-
- const bool singleSelection = itemView &&
+
+ const bool singleSelection = itemView &&
((itemView->selectionMode() == QAbstractItemView::SingleSelection ||
itemView->selectionMode() == QAbstractItemView::NoSelection));
const bool selectItems = itemView && (itemView->selectionBehavior() == QAbstractItemView::SelectItems);
--
cgit v0.12
From 72f161739b270b01807f97cd853030440f0fd430 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt
Date: Fri, 19 Nov 2010 12:38:36 +0100
Subject: Fix possible corrupted text when gl glyph cache becomes full
When the OpenGL glyph cache filled up (the max texture size on the
hardware was exceeded) the characters would be drawn as black blocks
instead. As a work-around for this, the cache will now be cleared and
repopulated whenever this happens, meaning that once in a while (when
a lot of different glyphs have been drawn in a font) there will be a
performance hit. A more complete solution is described in QTBUG-13784,
but this requires so much refactoring that it was deemed too risky for
a patch release. This patch fixes the problem with a small penalty
and low risk.
Task-number: QT-3971
Reviewed-by: Samuel
---
src/gui/painting/qtextureglyphcache.cpp | 13 ++++++++++---
src/gui/painting/qtextureglyphcache_p.h | 2 +-
.../gl2paintengineex/qpaintengineex_opengl2.cpp | 9 +++++++--
src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp | 19 ++++++++++++++++++-
src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h | 2 ++
5 files changed, 38 insertions(+), 7 deletions(-)
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index b609f7b..2cd7780 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -65,7 +65,7 @@ static inline int qt_next_power_of_two(int v)
return v;
}
-void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs,
+bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs,
const QFixedPoint *)
{
#ifdef CACHE_DEBUG
@@ -119,7 +119,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
rowHeight = qMax(rowHeight, glyph_height);
}
if (listItemCoordinates.isEmpty())
- return;
+ return true;
rowHeight += margin * 2 + paddingDoubled;
if (isNull())
@@ -150,6 +150,13 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
int new_height = m_h*2;
while (new_height < m_cy + c.h)
new_height *= 2;
+
+ if (new_height > maxTextureHeight()) {
+ // We can't make a new texture of the required size, so
+ // bail out
+ return false;
+ }
+
// if no room in the current texture - realloc a larger texture
resizeTextureData(m_w, new_height);
m_h = new_height;
@@ -165,7 +172,7 @@ void QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
++iter;
}
-
+ return true;
}
QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g) const
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index e6d2b22..f84d1e6 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -96,7 +96,7 @@ public:
int baseLineY;
};
- void populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs,
+ bool populate(QFontEngine *fontEngine, int numGlyphs, const glyph_t *glyphs,
const QFixedPoint *positions);
virtual void createTextureData(int width, int height) = 0;
diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 37552ac..3ddc15a 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -1499,8 +1499,13 @@ void QGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type glyp
// cache so this text is performed before we test if the cache size has changed.
if (recreateVertexArrays) {
cache->setPaintEnginePrivate(this);
- cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs,
- staticTextItem->glyphs, staticTextItem->glyphPositions);
+ if (!cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs,
+ staticTextItem->glyphs, staticTextItem->glyphPositions)) {
+ // No space in cache. We need to clear the cache and try again
+ cache->clear();
+ cache->populate(staticTextItem->fontEngine(), staticTextItem->numGlyphs,
+ staticTextItem->glyphs, staticTextItem->glyphPositions);
+ }
}
if (cache->width() == 0 || cache->height() == 0)
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
index 28e8c40..705ad09 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl.cpp
@@ -78,7 +78,7 @@ void QGLTextureGlyphCache::setContext(QGLContext *context)
SLOT(contextDestroyed(const QGLContext*)));
}
-QGLTextureGlyphCache::~QGLTextureGlyphCache()
+void QGLTextureGlyphCache::clear()
{
if (ctx) {
QGLShareContextScope scope(ctx);
@@ -88,7 +88,24 @@ QGLTextureGlyphCache::~QGLTextureGlyphCache()
if (m_width || m_height)
glDeleteTextures(1, &m_texture);
+
+ m_fbo = 0;
+ m_texture = 0;
+ m_width = 0;
+ m_height = 0;
+ m_w = 0;
+ m_h = 0;
+ m_cx = 0;
+ m_cy = 0;
+ m_currentRowHeight = 0;
+ coords.clear();
}
+
+}
+
+QGLTextureGlyphCache::~QGLTextureGlyphCache()
+{
+ clear();
}
void QGLTextureGlyphCache::createTextureData(int width, int height)
diff --git a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
index fa2b091..aaef350 100644
--- a/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
+++ b/src/opengl/gl2paintengineex/qtextureglyphcache_gl_p.h
@@ -124,6 +124,8 @@ public Q_SLOTS:
}
}
+ void clear();
+
private:
QGLContext *ctx;
--
cgit v0.12
From eaa0529642c90de3ebc07d819c0c0e8ed96a79be Mon Sep 17 00:00:00 2001
From: Thiago Macieira
Date: Fri, 19 Nov 2010 13:29:04 +0100
Subject: Fix compilation with Sun Studio 12.1.
Error was:
"tst_qdbusconnection.cpp", line 301: Error: Could not find a match for QTest::qCompare(QObject*, MyObject*, const char[29], const char[5], const char[24], int) needed in tst_QDBusConnection::registerObject().
"tst_qdbusconnection.cpp", line 498: Error: Could not find a match for QTest::qCompare(QObject*, TestObject*, const char[39], const char[12], const char[24], int) needed in tst_QDBusConnection::callSelf().
Task-number: QTBUG-15324
Patch-by: Pavel Heimlich
Reviewed-by: Thiago Macieira
---
tests/auto/qdbusconnection/tst_qdbusconnection.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp
index 96209b1..599abbd 100644
--- a/tests/auto/qdbusconnection/tst_qdbusconnection.cpp
+++ b/tests/auto/qdbusconnection/tst_qdbusconnection.cpp
@@ -298,7 +298,7 @@ void tst_QDBusConnection::registerObject()
// register one object at root:
MyObject obj;
QVERIFY(con.registerObject(path, &obj, QDBusConnection::ExportAllSlots));
- QCOMPARE(con.objectRegisteredAt(path), &obj);
+ QCOMPARE(con.objectRegisteredAt(path), static_cast(&obj));
QVERIFY(callMethod(con, path));
QCOMPARE(obj.path, path);
}
@@ -495,7 +495,7 @@ void tst_QDBusConnection::callSelf()
QDBusConnection connection = QDBusConnection::sessionBus();
QVERIFY(connection.registerObject("/test", &testObject,
QDBusConnection::ExportAllContents));
- QCOMPARE(connection.objectRegisteredAt("/test"), &testObject);
+ QCOMPARE(connection.objectRegisteredAt("/test"), static_cast(&testObject));
QVERIFY(connection.registerService(serviceName()));
QDBusInterface interface(serviceName(), "/test");
QVERIFY(interface.isValid());
--
cgit v0.12
From 649719c29bc3b33ab6a5eb9577d53bd0ba897550 Mon Sep 17 00:00:00 2001
From: Eskil Abrahamsen Blomfeldt
Date: Fri, 19 Nov 2010 14:38:58 +0100
Subject: Fix possible missing glyphs in raster engine glyph cache
Two possible failures when using the glyph cache on raster engine and
populating the cache with very many glyphs:
1. Change 72f161739b270b01807f97cd853030440f0fd430 caused the maximum
height of the glyph cache to be 32768, which was not sufficient for
large fonts with very many characters (e.g. Chinese text)
2. Since we are using QPainter to draw into the glyph cache for RGB32
glyphcaches, and QPainter does not support very high coordinates,
we need to create a reference image that references a section of the
glyph cache and paint into that instead.
Task-number: QT-3971
Reviewed-by: Samuel
---
src/gui/painting/qtextureglyphcache.cpp | 21 ++++++++++++---------
src/gui/painting/qtextureglyphcache_p.h | 2 +-
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp
index 2cd7780..2daa1f0 100644
--- a/src/gui/painting/qtextureglyphcache.cpp
+++ b/src/gui/painting/qtextureglyphcache.cpp
@@ -151,11 +151,11 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const
while (new_height < m_cy + c.h)
new_height *= 2;
- if (new_height > maxTextureHeight()) {
- // We can't make a new texture of the required size, so
- // bail out
- return false;
- }
+ if (maxTextureHeight() > 0 && new_height > maxTextureHeight()) {
+ // We can't make a new texture of the required size, so
+ // bail out
+ return false;
+ }
// if no room in the current texture - realloc a larger texture
resizeTextureData(m_w, new_height);
@@ -266,11 +266,14 @@ void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g)
}
#endif
- if (m_type == QFontEngineGlyphCache::Raster_RGBMask) {
- QPainter p(&m_image);
+ if (m_type == QFontEngineGlyphCache::Raster_RGBMask) {
+ QImage ref(m_image.bits() + (c.x * 4 + c.y * m_image.bytesPerLine()),
+ qMax(mask.width(), c.w), qMax(mask.height(), c.h), m_image.bytesPerLine(),
+ m_image.format());
+ QPainter p(&ref);
p.setCompositionMode(QPainter::CompositionMode_Source);
- p.fillRect(c.x, c.y, c.w, c.h, QColor(0,0,0,0)); // TODO optimize this
- p.drawImage(c.x, c.y, mask);
+ p.fillRect(0, 0, c.w, c.h, QColor(0,0,0,0)); // TODO optimize this
+ p.drawImage(0, 0, mask);
p.end();
} else if (m_type == QFontEngineGlyphCache::Raster_Mono) {
if (mask.depth() > 1) {
diff --git a/src/gui/painting/qtextureglyphcache_p.h b/src/gui/painting/qtextureglyphcache_p.h
index f84d1e6..94cb555 100644
--- a/src/gui/painting/qtextureglyphcache_p.h
+++ b/src/gui/painting/qtextureglyphcache_p.h
@@ -118,7 +118,7 @@ public:
QImage textureMapForGlyph(glyph_t g) const;
virtual int maxTextureWidth() const { return QT_DEFAULT_TEXTURE_GLYPH_CACHE_WIDTH; }
- virtual int maxTextureHeight() const { return 32768; }
+ virtual int maxTextureHeight() const { return -1; }
protected:
QFontEngine *m_current_fontengine;
--
cgit v0.12
From 0b63c90f5f4f5d1948e63c12f8b9b3395d316809 Mon Sep 17 00:00:00 2001
From: aavit
Date: Fri, 19 Nov 2010 14:51:40 +0100
Subject: Added command to clear all baselines
---
tests/arthur/baselineserver/src/baselineserver.cpp | 42 ++++------------------
tests/arthur/baselineserver/src/baselineserver.h | 3 +-
tests/arthur/baselineserver/src/htmlpage.cpp | 26 ++++++--------
3 files changed, 18 insertions(+), 53 deletions(-)
diff --git a/tests/arthur/baselineserver/src/baselineserver.cpp b/tests/arthur/baselineserver/src/baselineserver.cpp
index 7679f13..416b58f 100644
--- a/tests/arthur/baselineserver/src/baselineserver.cpp
+++ b/tests/arthur/baselineserver/src/baselineserver.cpp
@@ -51,6 +51,7 @@
#include
#include
#include
+#include
QString BaselineServer::storage;
@@ -349,43 +350,14 @@ QString BaselineHandler::pathForItem(const ImageItem &item, bool isBaseline, boo
}
-QString BaselineHandler::updateAllBaselines(const QString &host, const QString &id,
- const QString &engine, const QString &format)
+QString BaselineHandler::clearAllBaselines(const QString &context)
{
-#if 0
- QString basePath(BaselineServer::storagePath());
- QString srcDir(basePath + host + QLC('/') + itemSubPath(engine, format, false) + id);
- QString dstDir(basePath + host + QLC('/') + itemSubPath(engine, format));
-
- QDir dir(srcDir);
- QStringList nameFilter;
- nameFilter << "*.metadata" << "*.png";
- QStringList fileList = dir.entryList(nameFilter, QDir::Files | QDir::NoDotAndDotDot);
-
- // remove the generated _fuzzycompared.png and _compared.png files from the list
- QMutableStringListIterator it(fileList);
- while (it.hasNext()) {
- it.next();
- if (it.value().endsWith(QLS("compared.png")))
- it.remove();
- }
+ QDirIterator it(BaselineServer::storagePath() + QLC('/') + context,
+ QStringList() << QLS("*.png") << QLS("*.metadata"));
+ while (it.hasNext())
+ QFile::remove(it.next());
- QString res;
- QProcess proc;
- proc.setWorkingDirectory(srcDir);
- proc.setProcessChannelMode(QProcess::MergedChannels);
- proc.start(QLS("cp"), QStringList() << QLS("-f") << fileList << dstDir);
- proc.waitForFinished();
- if (proc.exitCode() == 0)
- res = QLS("Successfully updated baseline for all failed tests.");
- else
- res = QString("Error updating baseline: %1
"
- "Command output: %2
").arg(proc.errorString(), proc.readAll().constData());
-
- return res;
-#else
- return QString();
-#endif
+ return QLS("All baselines cleared from context ") + context;
}
QString BaselineHandler::updateSingleBaseline(const QString &oldBaseline, const QString &newBaseline)
diff --git a/tests/arthur/baselineserver/src/baselineserver.h b/tests/arthur/baselineserver/src/baselineserver.h
index d49aedb..c5cb45e 100644
--- a/tests/arthur/baselineserver/src/baselineserver.h
+++ b/tests/arthur/baselineserver/src/baselineserver.h
@@ -100,8 +100,7 @@ public:
BaselineHandler(int socketDescriptor = -1);
void testPathMapping();
- static QString updateAllBaselines(const QString &host, const QString &id,
- const QString &engine, const QString &format);
+ static QString clearAllBaselines(const QString &context);
static QString updateSingleBaseline(const QString &oldBaseline, const QString &newBaseline);
static QString blacklistTest(const QString &context, const QString &itemId, bool removeFromBlacklist = false);
diff --git a/tests/arthur/baselineserver/src/htmlpage.cpp b/tests/arthur/baselineserver/src/htmlpage.cpp
index f75da88..fdbdfb8 100644
--- a/tests/arthur/baselineserver/src/htmlpage.cpp
+++ b/tests/arthur/baselineserver/src/htmlpage.cpp
@@ -89,19 +89,16 @@ void HTMLPage::writeHeader(const ImageItem &item)
out.setDevice(&file);
out << "Lancelot results from run " << id << "
\n\n";
- out << "Platform Info:
\n";
+ out << "Platform Info:
\n";
out << "\n";
foreach (QString key, plat.keys())
out << "" << key << " | " << plat.value(key) << " |
\n";
- out << "
\n";
-
-#if 0
- out << "
\n\n";
+
+ out << "Clear all baselines (They will be recreated by the next run)
\n\n";
+
+ out << "\n"
"\n"
"Script | \n"
"Baseline | \n"
@@ -114,7 +111,7 @@ void HTMLPage::writeHeader(const ImageItem &item)
void HTMLPage::writeFooter()
{
- out << "
\n\n";
+ out << "\n