Skip to content

Commit

Permalink
Add Qt::SvgMiterJoin option to pathstroke example
Browse files Browse the repository at this point in the history
Qt::SvgMiterJoin is more important than the name suggests: It is used
not only by SVG but also by PDF. It differs from Qt::MiterJoin in the
miter limit behavior.

Task-number: QTBUG-52640
Change-Id: I8ad04b1231958628caab18a233d54d42ea6449e7
Reviewed-by: Sze Howe Koh <[email protected]>
  • Loading branch information
dg0yt committed Mar 21, 2018
1 parent fc8fd50 commit 4c0e27a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/widgets/painting/pathstroke/pathstroke.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,12 @@ void PathStrokeControls::createCommonControls(QWidget* parent)
m_joinGroup->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
QRadioButton *bevelJoin = new QRadioButton(m_joinGroup);
QRadioButton *miterJoin = new QRadioButton(m_joinGroup);
QRadioButton *svgMiterJoin = new QRadioButton(m_joinGroup);
QRadioButton *roundJoin = new QRadioButton(m_joinGroup);
m_joinGroup->setTitle(tr("Join Style"));
bevelJoin->setText(tr("Bevel"));
miterJoin->setText(tr("Miter"));
svgMiterJoin->setText(tr("SvgMiter"));
roundJoin->setText(tr("Round"));

m_styleGroup = new QGroupBox(parent);
Expand Down Expand Up @@ -145,6 +147,7 @@ void PathStrokeControls::createCommonControls(QWidget* parent)
QVBoxLayout *joinGroupLayout = new QVBoxLayout(m_joinGroup);
joinGroupLayout->addWidget(bevelJoin);
joinGroupLayout->addWidget(miterJoin);
joinGroupLayout->addWidget(svgMiterJoin);
joinGroupLayout->addWidget(roundJoin);

QVBoxLayout *styleGroupLayout = new QVBoxLayout(m_styleGroup);
Expand All @@ -167,6 +170,7 @@ void PathStrokeControls::createCommonControls(QWidget* parent)

connect(bevelJoin, SIGNAL(clicked()), m_renderer, SLOT(setBevelJoin()));
connect(miterJoin, SIGNAL(clicked()), m_renderer, SLOT(setMiterJoin()));
connect(svgMiterJoin, SIGNAL(clicked()), m_renderer, SLOT(setSvgMiterJoin()));
connect(roundJoin, SIGNAL(clicked()), m_renderer, SLOT(setRoundJoin()));

connect(curveMode, SIGNAL(clicked()), m_renderer, SLOT(setCurveMode()));
Expand Down
1 change: 1 addition & 0 deletions examples/widgets/painting/pathstroke/pathstroke.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public slots:

void setBevelJoin() { m_joinStyle = Qt::BevelJoin; update(); }
void setMiterJoin() { m_joinStyle = Qt::MiterJoin; update(); }
void setSvgMiterJoin() { m_joinStyle = Qt::SvgMiterJoin; update(); }
void setRoundJoin() { m_joinStyle = Qt::RoundJoin; update(); }

void setCurveMode() { m_pathMode = CurveMode; update(); }
Expand Down

0 comments on commit 4c0e27a

Please sign in to comment.