diff options
author | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-10-09 10:10:42 (GMT) |
---|---|---|
committer | Kim Motoyoshi Kalland <kim.kalland@nokia.com> | 2009-10-09 10:24:48 (GMT) |
commit | 803bebe62face37310fd8d8b97ca7faa1d4284a8 (patch) | |
tree | 5d29ae5e96ac9880e1697cab595bf628c4b411f1 /src/gui/painting | |
parent | 606e1150e381e0d824e6850befb101a2ed8e0542 (diff) | |
download | Qt-803bebe62face37310fd8d8b97ca7faa1d4284a8.zip Qt-803bebe62face37310fd8d8b97ca7faa1d4284a8.tar.gz Qt-803bebe62face37310fd8d8b97ca7faa1d4284a8.tar.bz2 |
Made QPen::setDashOffset() work with non-custom dashed lines.
Task-number: QTBUG-2738
Reviewed-by: Trond
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qpen.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gui/painting/qpen.cpp b/src/gui/painting/qpen.cpp index a050cb2..41efc80 100644 --- a/src/gui/painting/qpen.cpp +++ b/src/gui/painting/qpen.cpp @@ -411,6 +411,8 @@ Qt::PenStyle QPen::style() const pattern using the setDashPattern() function which implicitly converts the style of the pen to Qt::CustomDashLine. + \note This function resets the dash offset to zero. + \sa style(), {QPen#Pen Style}{Pen Style} */ @@ -420,7 +422,9 @@ void QPen::setStyle(Qt::PenStyle s) return; detach(); d->style = s; - static_cast<QPenData *>(d)->dashPattern.clear(); + QPenData *dd = static_cast<QPenData *>(d); + dd->dashPattern.clear(); + dd->dashOffset = 0; } /*! @@ -538,8 +542,12 @@ void QPen::setDashOffset(qreal offset) if (qFuzzyCompare(offset, static_cast<QPenData *>(d)->dashOffset)) return; detach(); - static_cast<QPenData *>(d)->dashOffset = offset; - d->style = Qt::CustomDashLine; + QPenData *dd = static_cast<QPenData *>(d); + dd->dashOffset = offset; + if (d->style != Qt::CustomDashLine) { + dd->dashPattern = dashPattern(); + d->style = Qt::CustomDashLine; + } } /*! |