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 | KReportItemLine::KReportItemLine() | ||
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 | { | 27 | { | ||
28 | createProperties(); | 28 | createProperties(); | ||
29 | } | 29 | } | ||
30 | 30 | | |||
31 | KReportItemLine::KReportItemLine(const QDomNode & element) | 31 | KReportItemLine::KReportItemLine(const QDomNode & element) | ||
32 | { | 32 | { | ||
33 | createProperties(); | 33 | createProperties(); | ||
34 | QDomNodeList nl = element.childNodes(); | 34 | QDomNodeList nl = element.childNodes(); | ||
35 | QString n; | 35 | QString n; | ||
36 | QDomNode node; | 36 | QDomNode node; | ||
37 | QPointF _s, _e; | 37 | QPointF _s, _e; | ||
38 | 38 | | |||
39 | m_name->setValue(element.toElement().attribute(QLatin1String("report:name"))); | 39 | nameProperty()->setValue(element.toElement().attribute(QLatin1String("report:name"))); | ||
40 | Z = element.toElement().attribute(QLatin1String("report:z-index")).toDouble(); | 40 | setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble()); | ||
41 | 41 | | |||
42 | _s.setX(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:x1"), QLatin1String("1cm")))); | 42 | _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")))); | 43 | _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")))); | 44 | _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")))); | 45 | _e.setY(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:y2"), QLatin1String("2cm")))); | ||
46 | m_start.setPointPos(_s); | 46 | m_start.setPointPos(_s); | ||
47 | m_end.setPointPos(_e); | 47 | m_end.setPointPos(_e); | ||
48 | 48 | | |||
Show All 11 Lines | 49 | for (int i = 0; i < nl.count(); i++) { | |||
60 | } else { | 60 | } else { | ||
61 | kreportWarning() << "while parsing line element encountered unknow element: " << n; | 61 | kreportWarning() << "while parsing line element encountered unknow element: " << n; | ||
62 | } | 62 | } | ||
63 | } | 63 | } | ||
64 | } | 64 | } | ||
65 | 65 | | |||
66 | KReportItemLine::~KReportItemLine() | 66 | KReportItemLine::~KReportItemLine() | ||
67 | { | 67 | { | ||
68 | delete m_set; | | |||
69 | } | 68 | } | ||
70 | 69 | | |||
71 | void KReportItemLine::createProperties() | 70 | void KReportItemLine::createProperties() | ||
72 | { | 71 | { | ||
73 | m_set = new KPropertySet; | | |||
74 | | ||||
75 | m_lineWeight = new KProperty("line-weight", 1, tr("Line Weight")); | 72 | m_lineWeight = new KProperty("line-weight", 1, tr("Line Weight")); | ||
76 | m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); | 73 | 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); | 74 | m_lineStyle = new KProperty("line-style", (int)Qt::SolidLine, tr("Line Style"), tr("Line Style"), KProperty::LineStyle); | ||
78 | m_start.setName(QLatin1String("Start")); | 75 | m_start.setName(QLatin1String("Start")); | ||
79 | m_end.setName(QLatin1String("End")); | 76 | m_end.setName(QLatin1String("End")); | ||
80 | 77 | | |||
81 | m_set->addProperty(m_name); | 78 | propertySet()->addProperty(m_start.property()); | ||
82 | m_set->addProperty(m_start.property()); | 79 | propertySet()->addProperty(m_end.property()); | ||
83 | m_set->addProperty(m_end.property()); | 80 | propertySet()->addProperty(m_lineWeight); | ||
84 | m_set->addProperty(m_lineWeight); | 81 | propertySet()->addProperty(m_lineColor); | ||
85 | m_set->addProperty(m_lineColor); | 82 | propertySet()->addProperty(m_lineStyle); | ||
86 | m_set->addProperty(m_lineStyle); | | |||
87 | } | 83 | } | ||
88 | 84 | | |||
89 | KReportLineStyle KReportItemLine::lineStyle() const | 85 | KReportLineStyle KReportItemLine::lineStyle() const | ||
90 | { | 86 | { | ||
91 | KReportLineStyle ls; | 87 | KReportLineStyle ls; | ||
92 | ls.setWidth(m_lineWeight->value().toInt()); | 88 | ls.setWidth(m_lineWeight->value().toInt()); | ||
93 | ls.setColor(m_lineColor->value().value<QColor>()); | 89 | ls.setColor(m_lineColor->value().value<QColor>()); | ||
94 | ls.setPenStyle((Qt::PenStyle)m_lineStyle->value().toInt()); | 90 | 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?