Changeset View
Changeset View
Standalone View
Standalone View
src/items/text/KReportItemText.cpp
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Lesser General Public | 14 | * You should have received a copy of the GNU Lesser General Public | ||
15 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 15 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
16 | */ | 16 | */ | ||
17 | 17 | | |||
18 | #include "KReportItemText.h" | 18 | #include "KReportItemText.h" | ||
19 | #include "KReportRenderObjects.h" | 19 | #include "KReportRenderObjects.h" | ||
20 | #include "kreportplugin_debug.h" | 20 | #include "kreportplugin_debug.h" | ||
21 | #include "KReportUtils.h" | ||||
21 | 22 | | |||
22 | #include <KPropertySet> | 23 | #include <KPropertySet> | ||
23 | 24 | | |||
24 | #include <QPrinter> | 25 | #include <QPrinter> | ||
25 | #include <QApplication> | 26 | #include <QApplication> | ||
26 | #include <QPalette> | 27 | #include <QPalette> | ||
27 | #include <QFontMetrics> | 28 | #include <QFontMetrics> | ||
28 | #include <QDomNodeList> | 29 | #include <QDomNodeList> | ||
29 | #include <QRegularExpression> | 30 | #include <QRegularExpression> | ||
30 | 31 | | |||
31 | KReportItemText::KReportItemText() | 32 | KReportItemText::KReportItemText() | ||
32 | : m_bottomPadding(0.0) | 33 | : m_bottomPadding(0.0) | ||
33 | { | 34 | { | ||
34 | createProperties(); | 35 | createProperties(); | ||
35 | } | 36 | } | ||
36 | 37 | | |||
37 | KReportItemText::KReportItemText(const QDomNode & element) | 38 | KReportItemText::KReportItemText(const QDomNode & element) | ||
38 | : KReportItemText() | 39 | : KReportItemText() | ||
39 | { | 40 | { | ||
40 | nameProperty()->setValue(element.toElement().attribute(QLatin1String("report:name"))); | 41 | nameProperty()->setValue(KReportUtils::readNameAttribute(element.toElement())); | ||
41 | m_controlSource->setValue(element.toElement().attribute(QLatin1String("report:item-data-source"))); | 42 | m_controlSource->setValue(element.toElement().attribute(QLatin1String("report:item-data-source"))); | ||
42 | m_itemValue->setValue(element.toElement().attribute(QLatin1String("report:value"))); | 43 | m_itemValue->setValue(element.toElement().attribute(QLatin1String("report:value"))); | ||
43 | setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble()); | 44 | setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble()); | ||
44 | m_horizontalAlignment->setValue(element.toElement().attribute(QLatin1String("report:horizontal-align"))); | 45 | m_horizontalAlignment->setValue(element.toElement().attribute(QLatin1String("report:horizontal-align"))); | ||
45 | m_verticalAlignment->setValue(element.toElement().attribute(QLatin1String("report:vertical-align"))); | 46 | m_verticalAlignment->setValue(element.toElement().attribute(QLatin1String("report:vertical-align"))); | ||
46 | m_bottomPadding = element.toElement().attribute(QLatin1String("report:bottom-padding")).toDouble(); | 47 | m_bottomPadding = element.toElement().attribute(QLatin1String("report:bottom-padding")).toDouble(); | ||
47 | 48 | | |||
48 | parseReportRect(element.toElement()); | 49 | parseReportRect(element.toElement()); | ||
▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Line(s) | 109 | { | |||
132 | 133 | | |||
133 | m_lineWeight = new KProperty("line-weight", 1.0, tr("Line Weight")); | 134 | m_lineWeight = new KProperty("line-weight", 1.0, tr("Line Weight")); | ||
134 | m_lineWeight->setOption("step", 1.0); | 135 | m_lineWeight->setOption("step", 1.0); | ||
135 | m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); | 136 | m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); | ||
136 | m_lineStyle = new KProperty("line-style", static_cast<int>(Qt::NoPen), tr("Line Style"), QString(), KProperty::LineStyle); | 137 | m_lineStyle = new KProperty("line-style", static_cast<int>(Qt::NoPen), tr("Line Style"), QString(), KProperty::LineStyle); | ||
137 | m_backgroundOpacity = new KProperty("background-opacity", QVariant(0), tr("Background Opacity")); | 138 | m_backgroundOpacity = new KProperty("background-opacity", QVariant(0), tr("Background Opacity")); | ||
138 | m_backgroundOpacity->setOption("max", 100); | 139 | m_backgroundOpacity->setOption("max", 100); | ||
139 | m_backgroundOpacity->setOption("min", 0); | 140 | m_backgroundOpacity->setOption("min", 0); | ||
140 | m_backgroundOpacity->setOption("unit", QLatin1String("%")); | 141 | m_backgroundOpacity->setOption("suffix", QLatin1String("%")); | ||
141 | 142 | | |||
142 | propertySet()->addProperty(m_controlSource); | 143 | propertySet()->addProperty(m_controlSource); | ||
143 | propertySet()->addProperty(m_itemValue); | 144 | propertySet()->addProperty(m_itemValue); | ||
144 | propertySet()->addProperty(m_horizontalAlignment); | 145 | propertySet()->addProperty(m_horizontalAlignment); | ||
145 | propertySet()->addProperty(m_verticalAlignment); | 146 | propertySet()->addProperty(m_verticalAlignment); | ||
146 | propertySet()->addProperty(m_font); | 147 | propertySet()->addProperty(m_font); | ||
147 | propertySet()->addProperty(m_backgroundColor); | 148 | propertySet()->addProperty(m_backgroundColor); | ||
148 | propertySet()->addProperty(m_foregroundColor); | 149 | propertySet()->addProperty(m_foregroundColor); | ||
▲ Show 20 Lines • Show All 172 Lines • Show Last 20 Lines |