Changeset View
Changeset View
Standalone View
Standalone View
src/common/KReportItemLine.cpp
Show All 17 Lines | |||||
18 | #include "KReportItemLine.h" | 18 | #include "KReportItemLine.h" | ||
19 | #include "KReportRenderObjects.h" | 19 | #include "KReportRenderObjects.h" | ||
20 | #include "kreport_debug.h" | 20 | #include "kreport_debug.h" | ||
21 | 21 | | |||
22 | #include <KPropertySet> | 22 | #include <KPropertySet> | ||
23 | 23 | | |||
24 | #include <QDomNode> | 24 | #include <QDomNode> | ||
25 | 25 | | |||
26 | KReportItemLine::KReportItemLine() | 26 | class Q_DECL_HIDDEN KReportItemLine::Private | ||
27 | { | ||||
28 | | ||||
29 | }; | ||||
30 | | ||||
31 | KReportItemLine::KReportItemLine() : d(new Private()) | ||||
staniek: Will move m_start etc here? | |||||
piggz: yes, i'll do this | |||||
How about intead making this a non exported class .... i think this is exported by accident as no other items are. piggz: How about intead making this a non exported class .... i think this is exported by accident as… | |||||
27 | { | 32 | { | ||
28 | createProperties(); | 33 | createProperties(); | ||
29 | } | 34 | } | ||
30 | 35 | | |||
31 | KReportItemLine::KReportItemLine(const QDomNode & element) | 36 | KReportItemLine::KReportItemLine(const QDomNode & element) : d(new Private()) | ||
32 | { | 37 | { | ||
33 | createProperties(); | 38 | createProperties(); | ||
34 | QDomNodeList nl = element.childNodes(); | 39 | QDomNodeList nl = element.childNodes(); | ||
35 | QString n; | 40 | QString n; | ||
36 | QDomNode node; | 41 | QDomNode node; | ||
37 | QPointF _s, _e; | 42 | QPointF _s, _e; | ||
38 | 43 | | |||
39 | m_name->setValue(element.toElement().attribute(QLatin1String("report:name"))); | 44 | nameProperty()->setValue(element.toElement().attribute(QLatin1String("report:name"))); | ||
40 | Z = element.toElement().attribute(QLatin1String("report:z-index")).toDouble(); | 45 | setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble()); | ||
41 | 46 | | |||
42 | _s.setX(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:x1"), QLatin1String("1cm")))); | 47 | _s.setX(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:x1"), QLatin1String("1cm")))); | ||
43 | _s.setY(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:y1"), QLatin1String("1cm")))); | 48 | _s.setY(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:y1"), QLatin1String("1cm")))); | ||
44 | _e.setX(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:x2"), QLatin1String("1cm")))); | 49 | _e.setX(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:x2"), QLatin1String("1cm")))); | ||
45 | _e.setY(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:y2"), QLatin1String("2cm")))); | 50 | _e.setY(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:y2"), QLatin1String("2cm")))); | ||
46 | m_start.setPointPos(_s); | 51 | m_start.setPointPos(_s); | ||
47 | m_end.setPointPos(_e); | 52 | m_end.setPointPos(_e); | ||
48 | 53 | | |||
Show All 11 Lines | 54 | for (int i = 0; i < nl.count(); i++) { | |||
60 | } else { | 65 | } else { | ||
61 | kreportWarning() << "while parsing line element encountered unknow element: " << n; | 66 | kreportWarning() << "while parsing line element encountered unknow element: " << n; | ||
62 | } | 67 | } | ||
63 | } | 68 | } | ||
64 | } | 69 | } | ||
65 | 70 | | |||
66 | KReportItemLine::~KReportItemLine() | 71 | KReportItemLine::~KReportItemLine() | ||
67 | { | 72 | { | ||
68 | delete m_set; | 73 | delete d; | ||
69 | } | 74 | } | ||
70 | 75 | | |||
71 | void KReportItemLine::createProperties() | 76 | void KReportItemLine::createProperties() | ||
72 | { | 77 | { | ||
73 | m_set = new KPropertySet; | | |||
74 | | ||||
75 | m_lineWeight = new KProperty("line-weight", 1, tr("Line Weight")); | 78 | m_lineWeight = new KProperty("line-weight", 1, tr("Line Weight")); | ||
76 | m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); | 79 | m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); | ||
77 | m_lineStyle = new KProperty("line-style", (int)Qt::SolidLine, tr("Line Style"), tr("Line Style"), KProperty::LineStyle); | 80 | m_lineStyle = new KProperty("line-style", (int)Qt::SolidLine, tr("Line Style"), tr("Line Style"), KProperty::LineStyle); | ||
78 | m_start.setName(QLatin1String("Start")); | 81 | m_start.setName(QLatin1String("Start")); | ||
79 | m_end.setName(QLatin1String("End")); | 82 | m_end.setName(QLatin1String("End")); | ||
80 | 83 | | |||
81 | m_set->addProperty(m_name); | 84 | propertySet()->addProperty(m_start.property()); | ||
82 | m_set->addProperty(m_start.property()); | 85 | propertySet()->addProperty(m_end.property()); | ||
83 | m_set->addProperty(m_end.property()); | 86 | propertySet()->addProperty(m_lineWeight); | ||
84 | m_set->addProperty(m_lineWeight); | 87 | propertySet()->addProperty(m_lineColor); | ||
85 | m_set->addProperty(m_lineColor); | 88 | propertySet()->addProperty(m_lineStyle); | ||
86 | m_set->addProperty(m_lineStyle); | | |||
87 | } | 89 | } | ||
88 | 90 | | |||
89 | KReportLineStyle KReportItemLine::lineStyle() const | 91 | KReportLineStyle KReportItemLine::lineStyle() const | ||
90 | { | 92 | { | ||
91 | KReportLineStyle ls; | 93 | KReportLineStyle ls; | ||
92 | ls.setWidth(m_lineWeight->value().toInt()); | 94 | ls.setWidth(m_lineWeight->value().toInt()); | ||
93 | ls.setColor(m_lineColor->value().value<QColor>()); | 95 | ls.setColor(m_lineColor->value().value<QColor>()); | ||
94 | ls.setPenStyle((Qt::PenStyle)m_lineStyle->value().toInt()); | 96 | ls.setPenStyle((Qt::PenStyle)m_lineStyle->value().toInt()); | ||
▲ Show 20 Lines • Show All 60 Lines • Show Last 20 Lines |
Will move m_start etc here?