From e74d609b93f3480c239c4921c1683b3944aff44f Mon Sep 17 00:00:00 2001 From: Gunnar Sletta Date: Tue, 14 Sep 2010 07:28:14 +0200 Subject: Fix top-left corner of rounded rects in QPaintEngineEx Reviewed-by: Rhys Weatherley --- src/gui/painting/qpaintengineex.cpp | 2 +- src/openvg/qpaintengine_vg.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 881bd6e..1e857e4 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -768,7 +768,7 @@ void QPaintEngineEx::drawRoundedRect(const QRectF &rect, qreal xRadius, qreal yR x1, y2 - (1 - KAPPA) * yRadius, x1, y2 - yRadius, x1, y1 + yRadius, // LineTo - x1, y1 + KAPPA * yRadius, // CurveTo + x1, y1 + (1 - KAPPA) * yRadius, // CurveTo x1 + (1 - KAPPA) * xRadius, y1, x1 + xRadius, y1 }; diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp index 1b0c5e8..3c2fd3d 100644 --- a/src/openvg/qpaintengine_vg.cpp +++ b/src/openvg/qpaintengine_vg.cpp @@ -1008,7 +1008,7 @@ VGPath QVGPaintEnginePrivate::roundedRectPath(const QRectF &rect, qreal xRadius, x1, y2 - (1 - KAPPA) * yRadius, x1, y2 - yRadius, x1, y1 + yRadius, // LineTo - x1, y1 + KAPPA * yRadius, // CurveTo + x1, y1 + (1 - KAPPA) * yRadius, // CurveTo x1 + (1 - KAPPA) * xRadius, y1, x1 + xRadius, y1 }; -- cgit v0.12 From 39accdb3bbb86a298665507ca2700b20f56ba64d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 14 Sep 2010 10:33:39 +0200 Subject: Fixed missing background for regular Qt applications with MeeGo system. Setting NoSystemBackground means that top-level widget backgrounds don't get painted any more. Another work-around must be found to prevent flickering. Reviewed-by: Gunnar Sletta --- src/plugins/graphicssystems/meego/qmeegographicssystem.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index e2c8425..2a64d49 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -73,7 +73,6 @@ QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const { QMeeGoGraphicsSystem::surfaceWasCreated = true; QWindowSurface *surface = new QGLWindowSurface(widget); - surface->window()->setAttribute(Qt::WA_NoSystemBackground); return surface; } -- cgit v0.12 From f8cf4296e2f1174610b8e095e9d0a496392fe70a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Nilsen?= Date: Tue, 14 Sep 2010 14:31:42 +0200 Subject: QGraphicsWidget update issues with ItemHasNoContents + effect Items with the ItemHasNoContents flag set are never drawn so the 'paintedViewBoundingRect' is never cached/updated resulting in updates wrongly being discarded. The solution is to always invalidate the children for such items. Auto test included. Task-number: QT-3803 --- src/gui/graphicsview/qgraphicsscene.cpp | 5 ++-- tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp | 29 ++++++++++++++++++++++ 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index 36a24db..921e121 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -4984,14 +4984,15 @@ void QGraphicsScenePrivate::markDirty(QGraphicsItem *item, const QRectF &rect, b return; } - bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents - && !item->d_ptr->graphicsEffect; + bool hasNoContents = item->d_ptr->flags & QGraphicsItem::ItemHasNoContents; if (!hasNoContents) { item->d_ptr->dirty = 1; if (fullItemUpdate) item->d_ptr->fullUpdatePending = 1; else if (!item->d_ptr->fullUpdatePending) item->d_ptr->needsRepaint |= rect; + } else if (item->d_ptr->graphicsEffect) { + invalidateChildren = true; } if (invalidateChildren) { diff --git a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp index fa6a5ec..e1bfb79 100644 --- a/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp +++ b/tests/auto/qgraphicseffect/tst_qgraphicseffect.cpp @@ -76,6 +76,7 @@ private slots: void dropShadowClipping(); void childrenVisibilityShouldInvalidateCache(); void prepareGeometryChangeInvalidateCache(); + void itemHasNoContents(); }; void tst_QGraphicsEffect::initTestCase() @@ -675,6 +676,34 @@ void tst_QGraphicsEffect::prepareGeometryChangeInvalidateCache() QCOMPARE(item->nbPaint, 0); } +void tst_QGraphicsEffect::itemHasNoContents() +{ + QGraphicsRectItem *parent = new QGraphicsRectItem; + parent->setFlag(QGraphicsItem::ItemHasNoContents); + + MyGraphicsItem *child = new MyGraphicsItem; + child->setParentItem(parent); + child->resize(200, 200); + + QGraphicsScene scene; + scene.addItem(parent); + + QGraphicsView view(&scene); + view.show(); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(child->nbPaint, 1); + + CustomEffect *effect = new CustomEffect; + parent->setGraphicsEffect(effect); + QTRY_COMPARE(effect->numRepaints, 1); + + for (int i = 0; i < 3; ++i) { + effect->reset(); + effect->update(); + QTRY_COMPARE(effect->numRepaints, 1); + } +} + QTEST_MAIN(tst_QGraphicsEffect) #include "tst_qgraphicseffect.moc" -- cgit v0.12