From 03ff62841c5dae85fde40982a65980a91c5f3109 Mon Sep 17 00:00:00 2001 From: Christopher Ham Date: Thu, 2 Dec 2010 13:12:18 +1000 Subject: Rectangle should not paint with negative width or height Task-number: QTBUG-15250 Reviewed-by: Martin Jones --- src/declarative/graphicsitems/qdeclarativerectangle.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/declarative/graphicsitems/qdeclarativerectangle.cpp b/src/declarative/graphicsitems/qdeclarativerectangle.cpp index dedb3f7..59d1a84 100644 --- a/src/declarative/graphicsitems/qdeclarativerectangle.cpp +++ b/src/declarative/graphicsitems/qdeclarativerectangle.cpp @@ -470,6 +470,8 @@ void QDeclarativeRectangle::generateBorderedRect() void QDeclarativeRectangle::paint(QPainter *p, const QStyleOptionGraphicsItem *, QWidget *) { Q_D(QDeclarativeRectangle); + if (width() <= 0 || height() <= 0) + return; if (d->radius > 0 || (d->pen && d->pen->isValid()) || (d->gradient && d->gradient->gradient()) ) { drawRect(*p); -- cgit v0.12