summaryrefslogtreecommitdiffstats
path: root/src/gui/painting/qpainterpath.cpp
diff options
context:
space:
mode:
authorSergio Ahumada <sergio.ahumada@nokia.com>2012-04-17 10:38:24 +0200
committerQt by Nokia <qt-info@nokia.com>2012-04-17 10:38:24 +0200
commit16b53b2f0e3f8f64a59c465493a6209eb7f9ab47 (patch)
treebbb63401eb3c56c32ad9bd9be66bae8d3590de6b /src/gui/painting/qpainterpath.cpp
parent2c13dc7482690756280cfefe8515eb809b069721 (diff)
parent9bd032355163d92cda5e7e59ecd21214b131f187 (diff)
Merge "Merge remote-tracking branch 'origin/master' into api_changes" into refs/staging/api_changes
Diffstat (limited to 'src/gui/painting/qpainterpath.cpp')
-rw-r--r--src/gui/painting/qpainterpath.cpp37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index e098e7c761..0e8811b934 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -478,14 +478,26 @@ static void qt_debug_path(const QPainterPath &path)
\sa ElementType, elementAt(), isEmpty()
*/
+int QPainterPath::elementCount() const
+{
+ return d_ptr ? d_ptr->elements.size() : 0;
+}
+
/*!
- \fn const QPainterPath::Element &QPainterPath::elementAt(int index) const
+ \fn QPainterPath::Element QPainterPath::elementAt(int index) const
Returns the element at the given \a index in the painter path.
\sa ElementType, elementCount(), isEmpty()
*/
+QPainterPath::Element QPainterPath::elementAt(int i) const
+{
+ Q_ASSERT(d_ptr);
+ Q_ASSERT(i >= 0 && i < elementCount());
+ return d_ptr->elements.at(i);
+}
+
/*!
\fn void QPainterPath::setElementPositionAt(int index, qreal x, qreal y)
\since 4.2
@@ -494,6 +506,17 @@ static void qt_debug_path(const QPainterPath &path)
x and \a y.
*/
+void QPainterPath::setElementPositionAt(int i, qreal x, qreal y)
+{
+ Q_ASSERT(d_ptr);
+ Q_ASSERT(i >= 0 && i < elementCount());
+ detach();
+ QPainterPath::Element &e = d_ptr->elements[i];
+ e.x = x;
+ e.y = y;
+}
+
+
/*###
\fn QPainterPath &QPainterPath::operator +=(const QPainterPath &other)
@@ -535,6 +558,13 @@ QPainterPath::QPainterPath(const QPointF &startPoint)
d_func()->elements << e;
}
+void QPainterPath::detach()
+{
+ if (d_ptr->ref.load() != 1)
+ detach_helper();
+ setDirty(true);
+}
+
/*!
\internal
*/
@@ -1451,6 +1481,11 @@ QRectF QPainterPath::controlPointRect() const
\sa elementCount()
*/
+bool QPainterPath::isEmpty() const
+{
+ return !d_ptr || (d_ptr->elements.size() == 1 && d_ptr->elements.first().type == MoveToElement);
+}
+
/*!
Creates and returns a reversed copy of the path.