From ddd1e4aefcb8e52125656588b0bb76ec246b5d29 Mon Sep 17 00:00:00 2001 From: Bill King Date: Wed, 7 Apr 2010 15:42:36 +1000 Subject: Fix test sql for sql server. Sql server requires explicitly setting fields to be nullable. --- tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp index 8a084bb..38e5387 100644 --- a/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp +++ b/tests/auto/qsqltablemodel/tst_qsqltablemodel.cpp @@ -181,7 +181,11 @@ void tst_QSqlTableModel::createTestTables() QVERIFY_SQL( q, exec("create table " + test3 + "(id int, random varchar(20), randomtwo varchar(20))")); - QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))")); + if(!tst_Databases::isSqlServer(db)) + QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50), column3 varchar(50))")); + else + QVERIFY_SQL( q, exec("create table " + qTableName("test4", __FILE__) + "(column1 varchar(50), column2 varchar(50) NULL, column3 varchar(50))")); + QVERIFY_SQL( q, exec("create table " + qTableName("emptytable", __FILE__) + "(id int)")); -- cgit v0.12 From 0102ee1de421a26a8bfd853146e485c3686baef6 Mon Sep 17 00:00:00 2001 From: Stefano Pironato Date: Mon, 29 Mar 2010 15:56:27 +0300 Subject: Fix valgrind report shows memory leak for QImage::save(). Reviewed-by: Marius Storm-Olsen --- src/gui/image/qimagewriter.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp index a5f7b31..503a1b2 100644 --- a/src/gui/image/qimagewriter.cpp +++ b/src/gui/image/qimagewriter.cpp @@ -197,6 +197,7 @@ static QImageIOHandler *createWriteHandlerHelper(QIODevice *device, for (int i = 0; i < keys.size(); ++i) { QImageIOPlugin *plugin = qobject_cast(l->instance(keys.at(i))); if (plugin && (plugin->capabilities(device, testFormat) & QImageIOPlugin::CanWrite)) { + delete handler; handler = plugin->create(device, testFormat); break; } -- cgit v0.12 From 7be934e98dd75d2c8902df4e88e2a1aceab9789f Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Tue, 6 Apr 2010 14:38:47 +0200 Subject: Fixes painting artifacts when scaling a QGraphicsProxyWidget. Incorrect simple conversion of the exposed rect from QRectF to QRect when rendering the widget. Task-number: QTBUG-7296 Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicsproxywidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/graphicsview/qgraphicsproxywidget.cpp b/src/gui/graphicsview/qgraphicsproxywidget.cpp index 483eb62..2132526 100644 --- a/src/gui/graphicsview/qgraphicsproxywidget.cpp +++ b/src/gui/graphicsview/qgraphicsproxywidget.cpp @@ -1435,7 +1435,7 @@ void QGraphicsProxyWidget::paint(QPainter *painter, const QStyleOptionGraphicsIt return; // Filter out repaints on the window frame. - const QRect exposedWidgetRect = (option->exposedRect & rect()).toRect(); + const QRect exposedWidgetRect = (option->exposedRect & rect()).toAlignedRect(); if (exposedWidgetRect.isEmpty()) return; -- cgit v0.12 From 2883580a3e10df16789ba1c9ee67507e508b95c1 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 7 Apr 2010 13:44:20 +0200 Subject: QTableView: fix spans corruption when removing spans. - We should not do -1 after erasing, as it is done later on. - We should consider the 0 height even if it is not the last span. - Added an assert. Task-number: QTBUG-9631 Reviewed-by: Gabriel --- src/gui/itemviews/qtableview.cpp | 9 ++++----- tests/auto/qtableview/tst_qtableview.cpp | 8 ++++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/gui/itemviews/qtableview.cpp b/src/gui/itemviews/qtableview.cpp index c824a8a..c4d1317 100644 --- a/src/gui/itemviews/qtableview.cpp +++ b/src/gui/itemviews/qtableview.cpp @@ -114,15 +114,14 @@ void QSpanCollection::updateSpan(QSpanCollection::Span *span, int old_height) } } else if (old_height > span->height()) { //remove the span from all the subspans lists that intersect the columns not covered anymore - Index::iterator it_y = index.lowerBound(-span->bottom()); - if (it_y == index.end()) - it_y = index.find(-span->top()); // This is the only span remaining and we are deleting it. + Index::iterator it_y = index.lowerBound(-qMax(span->bottom(), span->top())); //qMax usefull if height is 0 Q_ASSERT(it_y != index.end()); //it_y must exist since the span is in the list while (-it_y.key() <= span->top() + old_height -1) { if (-it_y.key() > span->bottom()) { - (*it_y).remove(-span->left()); + int removed = (*it_y).remove(-span->left()); + Q_ASSERT(removed == 1); Q_UNUSED(removed); if (it_y->isEmpty()) { - it_y = index.erase(it_y) - 1; + it_y = index.erase(it_y); } } if(it_y == index.begin()) diff --git a/tests/auto/qtableview/tst_qtableview.cpp b/tests/auto/qtableview/tst_qtableview.cpp index 54e32218..2062e8e 100644 --- a/tests/auto/qtableview/tst_qtableview.cpp +++ b/tests/auto/qtableview/tst_qtableview.cpp @@ -3035,6 +3035,14 @@ void tst_QTableView::spans_data() << QPoint(0, 0) << 1 << 1; + + QTest::newRow("QTBUG-9631: remove one span") + << 10 << 10 + << (SpanList() << QRect(1, 1, 2, 1) << QRect(2, 2, 2, 2) << QRect(1, 1, 1, 1)) + << false + << QPoint(1, 1) + << 1 + << 1; } void tst_QTableView::spans() -- cgit v0.12 From 4c23dd7e310c2af7dc7bf351eade0bd6d528561e Mon Sep 17 00:00:00 2001 From: Yoann Lopes Date: Wed, 7 Apr 2010 13:36:02 +0200 Subject: Fixes CursorChange and TooltipChange events delivery for QGraphicsWidget As the documentation mentions, these two events are delivered respectively after the cursor has changed and after the tooltip has changed. These two events were previously delivered just before. This patch is needed for fixing QTBUG-5349 even if it is not directly related. Auto-test included. Reviewed-by: bnilsen --- src/gui/graphicsview/qgraphicswidget.cpp | 4 +- tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp | 86 ++++++++++++++++++++++ 2 files changed, 88 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp index 4c5cffa..8b80bc8 100644 --- a/src/gui/graphicsview/qgraphicswidget.cpp +++ b/src/gui/graphicsview/qgraphicswidget.cpp @@ -1067,13 +1067,13 @@ QVariant QGraphicsWidget::itemChange(GraphicsItemChange change, const QVariant & QApplication::sendEvent(this, &event); break; } - case ItemCursorChange: { + case ItemCursorHasChanged: { // Deliver CursorChange. QEvent event(QEvent::CursorChange); QApplication::sendEvent(this, &event); break; } - case ItemToolTipChange: { + case ItemToolTipHasChanged: { // Deliver ToolTipChange. QEvent event(QEvent::ToolTipChange); QApplication::sendEvent(this, &event); diff --git a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp index 4a874be..1930a6f 100644 --- a/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp +++ b/tests/auto/qgraphicswidget/tst_qgraphicswidget.cpp @@ -165,6 +165,7 @@ private slots: void polishEvent2(); void initialShow(); void initialShow2(); + void itemChangeEvents(); // Task fixes void task236127_bspTreeIndexFails(); @@ -2886,6 +2887,91 @@ void tst_QGraphicsWidget::initialShow2() QTRY_COMPARE(widget->repaints, expectedRepaintCount); } +void tst_QGraphicsWidget::itemChangeEvents() +{ + class TestGraphicsWidget : public QGraphicsWidget + { public: + TestGraphicsWidget() : QGraphicsWidget() {} + QHash valueDuringEvents; + bool event(QEvent *event) { + Q_UNUSED(event); + switch (event->type()) { + case QEvent::EnabledChange: { + valueDuringEvents.insert(QEvent::EnabledChange, isEnabled()); + break; + } + case QEvent::ParentAboutToChange: { + valueDuringEvents.insert(QEvent::ParentAboutToChange, qVariantFromValue(parentItem())); + break; + } + case QEvent::ParentChange: { + valueDuringEvents.insert(QEvent::ParentChange, qVariantFromValue(parentItem())); + break; + } + case QEvent::CursorChange: { + valueDuringEvents.insert(QEvent::CursorChange, int(cursor().shape())); + break; + } + case QEvent::ToolTipChange: { + valueDuringEvents.insert(QEvent::ToolTipChange, toolTip()); + break; + } + default: { + break; + } + } + return true; + } + void showEvent(QShowEvent *event) { + Q_UNUSED(event); + valueDuringEvents.insert(QEvent::Show, isVisible()); + } + void hideEvent(QHideEvent *event) { + Q_UNUSED(event); + valueDuringEvents.insert(QEvent::Hide, isVisible()); + } + }; + + QGraphicsScene scene; + QGraphicsView view(&scene); + QGraphicsWidget *parent = new QGraphicsWidget; + scene.addItem(parent); + view.show(); + QTest::qWaitForWindowShown(&view); + + TestGraphicsWidget *item = new TestGraphicsWidget; + item->setParentItem(parent); + // ParentAboutToChange should be triggered before the parent has changed + QTRY_COMPARE(qVariantValue(item->valueDuringEvents.value(QEvent::ParentAboutToChange)), + static_cast(0)); + // ParentChange should be triggered after the parent has changed + QTRY_COMPARE(qVariantValue(item->valueDuringEvents.value(QEvent::ParentChange)), + static_cast(parent)); + + // ShowEvent should be triggered before the item is shown + QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::Show).toBool()); + + // HideEvent should be triggered after the item is hidden + QVERIFY(item->isVisible()); + item->setVisible(false); + QVERIFY(!item->isVisible()); + QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::Hide).toBool()); + + // CursorChange should be triggered after the cursor has changed + item->setCursor(Qt::PointingHandCursor); + QTRY_COMPARE(item->valueDuringEvents.value(QEvent::CursorChange).toInt(), int(item->cursor().shape())); + + // ToolTipChange should be triggered after the tooltip has changed + item->setToolTip("tooltipText"); + QTRY_COMPARE(item->valueDuringEvents.value(QEvent::ToolTipChange).toString(), item->toolTip()); + + // EnabledChange should be triggered after the enabled state has changed + QVERIFY(item->isEnabled()); + item->setEnabled(false); + QVERIFY(!item->isEnabled()); + QTRY_VERIFY(!item->valueDuringEvents.value(QEvent::EnabledChange).toBool()); +} + void tst_QGraphicsWidget::QT_BUG_6544_tabFocusFirstUnsetWhenRemovingItems() { QGraphicsScene scene; -- cgit v0.12 From a6e182f7a91b2dd9371e7b16f2553430cbae4509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Wed, 7 Apr 2010 16:21:57 +0200 Subject: Fixed caching of QPainter patterns in the GL 2 engine. The patterns all got the same cache key (e.g. 1), which caused the patterns to be uploaded as a texture every single time they were used. Reviewed-by: Kim --- src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp index 2b8e097..828849d 100644 --- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp +++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp @@ -184,7 +184,7 @@ void QGL2PaintEngineExPrivate::updateBrushTexture() QImage texImage = qt_imageForBrush(style, false); glActiveTexture(GL_TEXTURE0 + QT_BRUSH_TEXTURE_UNIT); - ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, true, QGLContext::InternalBindOption); + ctx->d_func()->bindTexture(texImage, GL_TEXTURE_2D, GL_RGBA, QGLContext::InternalBindOption); updateTextureFilter(GL_TEXTURE_2D, GL_REPEAT, q->state()->renderHints & QPainter::SmoothPixmapTransform); } else if (style >= Qt::LinearGradientPattern && style <= Qt::ConicalGradientPattern) { -- cgit v0.12 From 3900e09478f01798b4dbcaf573426d886fd2db23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Trond=20Kjern=C3=A5sen?= Date: Fri, 9 Apr 2010 13:15:16 +0200 Subject: Fixed possible data corruption in the triangulating stroker. In the case where a polygon or polyline that contains consequtive equal points, we end up calculating an invalid normal vector for the joins. This fix skips past duplicate consequtive points. Task-number: QTBUG-9548 Reviewed-by: Kim --- src/opengl/gl2paintengineex/qtriangulatingstroker.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp index 5229d3f..eaa3d57 100644 --- a/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp +++ b/src/opengl/gl2paintengineex/qtriangulatingstroker.cpp @@ -144,11 +144,17 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen) m_cos_theta = qFastCos(Q_PI / m_roundness); const qreal *endPts = pts + (count<<1); - const qreal *startPts; + const qreal *startPts = 0; Qt::PenCapStyle cap = m_cap_style; if (!types) { + // skip duplicate points + while((pts + 2) < endPts && pts[0] == pts[2] && pts[1] == pts[3]) + pts += 2; + if ((pts + 2) == endPts) + return; + startPts = pts; bool endsAtStart = startPts[0] == *(endPts-2) && startPts[1] == *(endPts-1); @@ -161,15 +167,17 @@ void QTriangulatingStroker::process(const QVectorPath &path, const QPen &pen) lineTo(pts); pts += 2; while (pts < endPts) { - join(pts); - lineTo(pts); + if (m_cx != pts[0] || m_cy != pts[1]) { + join(pts); + lineTo(pts); + } pts += 2; } endCapOrJoinClosed(startPts, pts-2, path.hasImplicitClose(), endsAtStart); } else { - bool endsAtStart; + bool endsAtStart = false; while (pts < endPts) { switch (*types) { case QPainterPath::MoveToElement: { -- cgit v0.12 From 1ab962d75bd6754331536034022b882f0474196d Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Fri, 9 Apr 2010 17:01:32 +0200 Subject: Doc: we don't ship a qconfig executable in the Windows CE packages Task-number: QTBUG-9655 Reviewed-by: thartman --- doc/src/platforms/emb-features.qdoc | 3 --- 1 file changed, 3 deletions(-) diff --git a/doc/src/platforms/emb-features.qdoc b/doc/src/platforms/emb-features.qdoc index 1974a45..ab549d3 100644 --- a/doc/src/platforms/emb-features.qdoc +++ b/doc/src/platforms/emb-features.qdoc @@ -105,9 +105,6 @@ \note The \c qconfig tool is intended to be built against Qt on desktop platforms. - \bold{Windows CE:} The Qt for Windows CE package contains a \c qconfig - executable that you can run on a Windows desktop to configure the build. - \image qt-embedded-qconfigtool.png The \c qconfig tool's interface displays all of Qt's -- cgit v0.12