KDStateMachineEditor API Documentation 2.1
Loading...
Searching...
No Matches
quickpen.cpp
Go to the documentation of this file.
1/*
2 This file is part of the KDAB State Machine Editor Library.
3
4 SPDX-FileCopyrightText: 2014 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.com>
5 Author: Kevin Funk <kevin.funk@kdab.com>
6
7 SPDX-License-Identifier: LGPL-2.1-only OR LicenseRef-KDAB-KDStateMachineEditor
8
9 Licensees holding valid commercial KDAB State Machine Editor Library
10 licenses may use this file in accordance with the KDAB State Machine Editor
11 Library License Agreement provided with the Software.
12
13 Contact info@kdab.com if any conditions of this licensing are not clear to you.
14*/
15
16#include "quickpen_p.h"
17
18#include <QPen>
19
20QuickPen::QuickPen(QObject *parent)
21 : QObject(parent)
22 , m_width(0.0)
23 , m_color(Qt::black)
24 , m_style(Qt::SolidLine)
25{
26}
27
28void QuickPen::modifyPen(QPen *pen) const
29{
30 Q_ASSERT(pen);
31 pen->setWidthF(m_width);
32 pen->setColor(m_color);
33 pen->setStyle(m_style);
34}
35
36QPen QuickPen::toQPen() const
37{
38 QPen pen;
39 modifyPen(&pen);
40 return pen;
41}
42
43qreal QuickPen::width() const
44{
45 return m_width;
46}
47
48void QuickPen::setWidth(qreal width)
49{
50 m_width = width;
51 Q_EMIT penChanged();
52}
53
54QColor QuickPen::color() const
55{
56 return m_color;
57}
58
59void QuickPen::setColor(const QColor &color)
60{
61 m_color = color;
62 Q_EMIT penChanged();
63}
64
65Qt::PenStyle QuickPen::style() const
66{
67 return m_style;
68}
69
70void QuickPen::setStyle(Qt::PenStyle style)
71{
72 m_style = style;
73 Q_EMIT penChanged();
74}
void setWidth(qreal width)
Definition quickpen.cpp:48
qreal width
Definition quickpen_p.h:35
QuickPen(QObject *parent=nullptr)
Definition quickpen.cpp:20
QPen toQPen() const
Definition quickpen.cpp:36
QColor color
Definition quickpen_p.h:36
void modifyPen(QPen *pen) const
Definition quickpen.cpp:28
void setStyle(Qt::PenStyle style)
Definition quickpen.cpp:70
Qt::PenStyle style
Definition quickpen_p.h:37
void setColor(const QColor &color)
Definition quickpen.cpp:59
void penChanged()

© Klarälvdalens Datakonsult AB (KDAB)
"The Qt, C++ and OpenGL Experts"
https://www.kdab.com/
KDStateMachineEditor
Create Qt State Machine metacode using a graphical user interface
https://github.com/KDAB/KDStateMachineEditor
Generated on Tue Jul 15 2025 15:21:47 for KDStateMachineEditor API Documentation by doxygen 1.9.8