diff options
author | Warwick Allison <warwick.allison@nokia.com> | 2009-05-18 06:46:12 (GMT) |
---|---|---|
committer | Warwick Allison <warwick.allison@nokia.com> | 2009-05-19 01:20:46 (GMT) |
commit | 692782c4d11cf7352a7923633cb015c3580e2704 (patch) | |
tree | 9fe49f61456d379244b796eb3bc2a2c1b46fce4b /src/declarative/canvas | |
parent | 86cc7c0d6dffc5cabe215606cb6fadf98e8214cc (diff) | |
download | Qt-692782c4d11cf7352a7923633cb015c3580e2704.zip Qt-692782c4d11cf7352a7923633cb015c3580e2704.tar.gz Qt-692782c4d11cf7352a7923633cb015c3580e2704.tar.bz2 |
Fix pens.
Now corresponds to standard Qt painting; in particular, penwidth extends
outside rectangle.
Task-number: 249318
Diffstat (limited to 'src/declarative/canvas')
-rw-r--r-- | src/declarative/canvas/qsimplecanvasitem.cpp | 10 | ||||
-rw-r--r-- | src/declarative/canvas/qsimplecanvasitem.h | 1 | ||||
-rw-r--r-- | src/declarative/canvas/qsimplecanvasitem_p.h | 3 |
3 files changed, 12 insertions, 2 deletions
diff --git a/src/declarative/canvas/qsimplecanvasitem.cpp b/src/declarative/canvas/qsimplecanvasitem.cpp index 12c725c..4449e2b 100644 --- a/src/declarative/canvas/qsimplecanvasitem.cpp +++ b/src/declarative/canvas/qsimplecanvasitem.cpp @@ -180,10 +180,18 @@ void QSimpleCanvasItem::childrenChanged() { } +int QSimpleCanvasItem::setPaintMargin(qreal margin) +{ + Q_D(QSimpleCanvasItem); + if (margin < d->paintmargin) + update(); // schedule repaint of old boundingRect + d->paintmargin = margin; +} + QRectF QSimpleCanvasItem::boundingRect() const { Q_D(const QSimpleCanvasItem); - return QRectF(0., 0., d->width, d->height); + return QRectF(-d->paintmargin, -d->paintmargin, d->width+d->paintmargin*2, d->height+d->paintmargin*2); } void QSimpleCanvasItem::paintContents(QPainter &) diff --git a/src/declarative/canvas/qsimplecanvasitem.h b/src/declarative/canvas/qsimplecanvasitem.h index cab8492..1c729b1 100644 --- a/src/declarative/canvas/qsimplecanvasitem.h +++ b/src/declarative/canvas/qsimplecanvasitem.h @@ -183,6 +183,7 @@ public: }; + int setPaintMargin(qreal margin); QRectF boundingRect() const; virtual void paintContents(QPainter &); virtual void paintGLContents(GLPainter &); diff --git a/src/declarative/canvas/qsimplecanvasitem_p.h b/src/declarative/canvas/qsimplecanvasitem_p.h index cfe0bba..7fe16a3 100644 --- a/src/declarative/canvas/qsimplecanvasitem_p.h +++ b/src/declarative/canvas/qsimplecanvasitem_p.h @@ -139,7 +139,7 @@ public: focusable(false), wantsActiveFocusPanelPendingCanvas(false), hasBeenActiveFocusPanel(false), hasFocus(false), hasActiveFocus(false), needsZOrder(false), - widthValid(false), heightValid(false), width(0), height(0), scale(1), + widthValid(false), heightValid(false), width(0), height(0), paintmargin(0), scale(1), graphicsItem(0), data_ptr(0) { } @@ -173,6 +173,7 @@ public: qreal width; qreal height; + qreal paintmargin; qreal scale; QSimpleGraphicsItem *graphicsItem; |