diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-10-17 17:12:04 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-12-12 15:53:39 +0100 |
commit | e6c8b86b84172816ef316f8fdcb8a86702208150 (patch) | |
tree | 884a6bb4a0bb9a8a5f021788ca1729ce61c54dd1 /src/gui/painting/qpainterpath.cpp | |
parent | 72ea1d59923ffb8591a8298c2b817940db81b615 (diff) |
Automatically create QPainterPathStroke based on QPen
Based a recent problem where one property of QPen was not properly copied
to QPainterPathStroke, I believe we should add a method to automatically
create a QPainterPathStroke based on all the relevant information in a QPen.
This patch adds a constructor that automatically does so.
Change-Id: Id2849b36426f2e3b06b4b508292063a0917ca61c
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src/gui/painting/qpainterpath.cpp')
-rw-r--r-- | src/gui/painting/qpainterpath.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 156e411154..b4c42f7060 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -2551,6 +2551,26 @@ QPainterPathStroker::QPainterPathStroker() } /*! + Creates a new stroker based on \a pen. + + \since 5.3 + */ +QPainterPathStroker::QPainterPathStroker(const QPen &pen) + : d_ptr(new QPainterPathStrokerPrivate) +{ + setWidth(pen.widthF()); + setCapStyle(pen.capStyle()); + setJoinStyle(pen.joinStyle()); + setMiterLimit(pen.miterLimit()); + setDashOffset(pen.dashOffset()); + + if (pen.style() == Qt::CustomDashLine) + setDashPattern(pen.dashPattern()); + else + setDashPattern(pen.style()); +} + +/*! Destroys the stroker. */ QPainterPathStroker::~QPainterPathStroker() |