From 1137318384b99420def3a5355f0abd7941756a2b Mon Sep 17 00:00:00 2001 From: scorpio810 Date: Fri, 29 Dec 2017 23:13:35 +0000 Subject: [PATCH] Basic shape add new CustomDashLine style with Dash Pattern (<< 10 << 10 ); git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@5194 bfdf4180-ca20-0410-9c96-a3a8aa849046 --- sources/qetxml.cpp | 3 +++ sources/ui/shapegraphicsitempropertieswidget.cpp | 6 ++++++ sources/ui/shapegraphicsitempropertieswidget.ui | 7 ++++++- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/sources/qetxml.cpp b/sources/qetxml.cpp index 2d26c2f0f..3440f5ea7 100644 --- a/sources/qetxml.cpp +++ b/sources/qetxml.cpp @@ -39,6 +39,7 @@ QDomElement QETXML::penToXml(QDomDocument &parent_document,QPen pen) case Qt::DotLine : style = "DotLine"; break; case Qt::DashDotLine : style = "DashDotLine"; break; case Qt::DashDotDotLine : style = "DashDotDotLine"; break; + case Qt::CustomDashLine : style = "CustomDashLine"; break; default : style = "Unknow"; break; } @@ -71,6 +72,8 @@ QPen QETXML::penFromXml(const QDomElement &element) else if (style == "DotLine") pen.setStyle(Qt::DotLine); else if (style == "DashDotLine") pen.setStyle(Qt::DashDotLine); else if (style == "DashDotDotLine") pen.setStyle(Qt::DashDotDotLine); + else if (style == "CustomDashLine") pen.setStyle(Qt::CustomDashLine), + pen.setDashPattern( QVector() << 10 << 10 ); else pen.setStyle(Qt::DashLine); pen.setColor(QColor(element.attribute("color", "#000000"))); diff --git a/sources/ui/shapegraphicsitempropertieswidget.cpp b/sources/ui/shapegraphicsitempropertieswidget.cpp index 86c081589..d0e6a3a63 100644 --- a/sources/ui/shapegraphicsitempropertieswidget.cpp +++ b/sources/ui/shapegraphicsitempropertieswidget.cpp @@ -109,6 +109,12 @@ QUndoCommand* ShapeGraphicsItemPropertiesWidget::associatedUndo() const new_pen.setStyle(Qt::PenStyle(ui->m_style_cb->currentIndex() + 1)); new_pen.setWidthF(ui->m_size_dsb->value()); + + if (ui->m_style_cb->currentIndex() ==5) { + new_pen.setDashPattern( QVector() << 10 << 10 ); + new_pen.setStyle( Qt::CustomDashLine ); + } + //painter.setPen( new_pen ); new_pen.setColor(ui->m_color_pb->palette().color(QPalette::Button)); if (new_pen != old_pen) diff --git a/sources/ui/shapegraphicsitempropertieswidget.ui b/sources/ui/shapegraphicsitempropertieswidget.ui index a580ba3cb..bbfcfd40c 100644 --- a/sources/ui/shapegraphicsitempropertieswidget.ui +++ b/sources/ui/shapegraphicsitempropertieswidget.ui @@ -7,7 +7,7 @@ 0 0 261 - 293 + 346 @@ -54,6 +54,11 @@ Traits points points + + + Tiret custom + +