aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@nokia.com>2011-05-03 14:41:52 +0200
committerYoann Lopes <yoann.lopes@nokia.com>2011-05-03 14:41:52 +0200
commit9267a7bce715924a96c8636a3110d90879e5927c (patch)
tree8b52a8feb99f3eaaef12ba45aaefa68830ee6549
parentd3be822c1bc167878ae75943c39dfb3f40bb3800 (diff)
Added antialiasing property to QSGPaintedItem.
-rw-r--r--examples/declarative/painteditem/main.cpp5
-rw-r--r--src/declarative/items/qsgpainteditem.cpp33
-rw-r--r--src/declarative/items/qsgpainteditem.h3
-rw-r--r--src/declarative/items/qsgpainteditem_p.h1
4 files changed, 41 insertions, 1 deletions
diff --git a/examples/declarative/painteditem/main.cpp b/examples/declarative/painteditem/main.cpp
index 1308325ca3..10bd4302c9 100644
--- a/examples/declarative/painteditem/main.cpp
+++ b/examples/declarative/painteditem/main.cpp
@@ -47,6 +47,11 @@ class MyPaintItem : public QSGPaintedItem
{
Q_OBJECT
public:
+ MyPaintItem() : QSGPaintedItem()
+ {
+ setAntialiasing(true);
+ }
+
virtual void paint(QPainter *p)
{
QRectF rect(0, 0, width(), height());
diff --git a/src/declarative/items/qsgpainteditem.cpp b/src/declarative/items/qsgpainteditem.cpp
index 8eb8afe8be..e0d63fa436 100644
--- a/src/declarative/items/qsgpainteditem.cpp
+++ b/src/declarative/items/qsgpainteditem.cpp
@@ -186,6 +186,37 @@ void QSGPaintedItem::setOpaquePainting(bool opaque)
QSGItem::update();
}
+/*!
+ Returns true if antialiased painting is enabled; otherwise, false is returned.
+
+ By default, antialiasing is not enabled.
+
+ \sa setAntialiasing()
+*/
+bool QSGPaintedItem::antialiasing() const
+{
+ Q_D(const QSGPaintedItem);
+ return d->antialiasing;
+}
+
+/*!
+ If \a enable is true, antialiased painting is enabled.
+
+ By default, antialiasing is not enabled.
+
+ \sa antialiasing()
+*/
+void QSGPaintedItem::setAntialiasing(bool enable)
+{
+ Q_D(QSGPaintedItem);
+
+ if (d->antialiasing == enable)
+ return;
+
+ d->antialiasing = enable;
+ update();
+}
+
QSize QSGPaintedItem::contentsSize() const
{
// XXX todo
@@ -337,7 +368,7 @@ QSGNode *QSGPaintedItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *
node->setPreferredRenderTarget(d->renderTarget);
node->setSize(QSize(d->width, d->height));
- node->setSmoothPainting(d->smooth);
+ node->setSmoothPainting(d->antialiasing);
node->setLinearFiltering(d->smooth);
node->setOpaquePainting(d->opaquePainting);
node->setFillColor(d->fillColor);
diff --git a/src/declarative/items/qsgpainteditem.h b/src/declarative/items/qsgpainteditem.h
index 23becfefa4..85255243c2 100644
--- a/src/declarative/items/qsgpainteditem.h
+++ b/src/declarative/items/qsgpainteditem.h
@@ -75,6 +75,9 @@ public:
bool opaquePainting() const;
void setOpaquePainting(bool opaque);
+ bool antialiasing() const;
+ void setAntialiasing(bool enable);
+
QSize contentsSize() const;
void setContentsSize(const QSize &);
void resetContentsSize();
diff --git a/src/declarative/items/qsgpainteditem_p.h b/src/declarative/items/qsgpainteditem_p.h
index c49da5098f..ee76319a92 100644
--- a/src/declarative/items/qsgpainteditem_p.h
+++ b/src/declarative/items/qsgpainteditem_p.h
@@ -60,6 +60,7 @@ public:
bool geometryDirty : 1;
bool contentsDirty : 1;
bool opaquePainting: 1;
+ bool antialiasing: 1;
};
QT_END_NAMESPACE