Changeset View
Changeset View
Standalone View
Standalone View
src/items/label/KReportItemLabel.cpp
Show All 11 Lines | |||||
12 | * Lesser General Public License for more details. | 12 | * Lesser General Public License for more details. | ||
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 "KReportItemLabel.h" | 18 | #include "KReportItemLabel.h" | ||
19 | #include "KReportRenderObjects.h" | 19 | #include "KReportRenderObjects.h" | ||
20 | #include "KReportUtils.h" | ||||
20 | #include "kreportplugin_debug.h" | 21 | #include "kreportplugin_debug.h" | ||
21 | 22 | | |||
22 | #include <KPropertySet> | 23 | #include <KPropertySet> | ||
23 | 24 | | |||
24 | #include <QFontDatabase> | 25 | #include <QFontDatabase> | ||
25 | #include <QPalette> | 26 | #include <QPalette> | ||
26 | #include <QDomNodeList> | 27 | #include <QDomNodeList> | ||
27 | 28 | | |||
28 | KReportItemLabel::KReportItemLabel() | 29 | KReportItemLabel::KReportItemLabel() | ||
29 | { | 30 | { | ||
30 | createProperties(); | 31 | createProperties(); | ||
31 | } | 32 | } | ||
32 | 33 | | |||
33 | KReportItemLabel::KReportItemLabel(const QDomNode & element) | 34 | KReportItemLabel::KReportItemLabel(const QDomNode & element) | ||
34 | : KReportItemLabel() | 35 | : KReportItemLabel() | ||
35 | { | 36 | { | ||
36 | nameProperty()->setValue(element.toElement().attribute(QLatin1String("report:name"))); | 37 | nameProperty()->setValue(KReportUtils::readNameAttribute(element.toElement())); | ||
37 | m_text->setValue(element.toElement().attribute(QLatin1String("report:caption"))); | 38 | m_text->setValue(element.toElement().attribute(QLatin1String("report:caption"))); | ||
38 | setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble()); | 39 | setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble()); | ||
39 | m_horizontalAlignment->setValue(element.toElement().attribute(QLatin1String("report:horizontal-align"))); | 40 | m_horizontalAlignment->setValue(element.toElement().attribute(QLatin1String("report:horizontal-align"))); | ||
40 | m_verticalAlignment->setValue(element.toElement().attribute(QLatin1String("report:vertical-align"))); | 41 | m_verticalAlignment->setValue(element.toElement().attribute(QLatin1String("report:vertical-align"))); | ||
41 | 42 | | |||
42 | parseReportRect(element.toElement()); | 43 | parseReportRect(element.toElement()); | ||
43 | 44 | | |||
44 | QDomNodeList nl = element.childNodes(); | 45 | QDomNodeList nl = element.childNodes(); | ||
Show All 36 Lines | |||||
81 | 82 | | |||
82 | void KReportItemLabel::setText(const QString& t) | 83 | void KReportItemLabel::setText(const QString& t) | ||
83 | { | 84 | { | ||
84 | m_text->setValue(t); | 85 | m_text->setValue(t); | ||
85 | } | 86 | } | ||
86 | 87 | | |||
87 | void KReportItemLabel::createProperties() | 88 | void KReportItemLabel::createProperties() | ||
88 | { | 89 | { | ||
89 | m_text = new KProperty("caption", QLatin1String("Label"), tr("Caption")); | 90 | m_text = new KProperty("caption", QLatin1String("Label"), tr("Text")); | ||
90 | QStringList keys, strings; | 91 | QStringList keys, strings; | ||
91 | 92 | | |||
92 | keys << QLatin1String("left") << QLatin1String("center") << QLatin1String("right"); | 93 | keys << QLatin1String("left") << QLatin1String("center") << QLatin1String("right"); | ||
93 | strings << tr("Left") << tr("Center") << tr("Right"); | 94 | strings << tr("Left") << tr("Center") << tr("Right"); | ||
94 | m_horizontalAlignment = new KProperty("horizontal-align", keys, strings, QLatin1String("left"), tr("Horizontal Alignment")); | 95 | m_horizontalAlignment = new KProperty("horizontal-align", keys, strings, QLatin1String("left"), tr("Horizontal Alignment")); | ||
95 | 96 | | |||
96 | keys.clear(); | 97 | keys.clear(); | ||
97 | strings.clear(); | 98 | strings.clear(); | ||
98 | keys << QLatin1String("top") << QLatin1String("center") << QLatin1String("bottom"); | 99 | keys << QLatin1String("top") << QLatin1String("center") << QLatin1String("bottom"); | ||
99 | strings << tr("Top") << tr("Center") << tr("Bottom"); | 100 | strings << tr("Top") << tr("Center") << tr("Bottom"); | ||
100 | m_verticalAlignment = new KProperty("vertical-align", keys, strings, QLatin1String("center"), tr("Vertical Alignment")); | 101 | m_verticalAlignment = new KProperty("vertical-align", keys, strings, QLatin1String("center"), tr("Vertical Alignment")); | ||
101 | 102 | | |||
102 | m_font = new KProperty("font", QFontDatabase::systemFont(QFontDatabase::GeneralFont), tr("Font"), tr("Font")); | 103 | m_font = new KProperty("font", QFontDatabase::systemFont(QFontDatabase::GeneralFont), tr("Font"), tr("Font")); | ||
103 | 104 | | |||
104 | m_backgroundColor = new KProperty("background-color", QColor(Qt::white), tr("Background Color")); | 105 | m_backgroundColor = new KProperty("background-color", QColor(Qt::white), tr("Background Color")); | ||
105 | m_foregroundColor = new KProperty("foreground-color", QColor(Qt::black), tr("Foreground Color")); | 106 | m_foregroundColor = new KProperty("foreground-color", QColor(Qt::black), tr("Foreground Color")); | ||
106 | 107 | | |||
107 | m_backgroundOpacity = new KProperty("background-opacity", QVariant(0), tr("Background Opacity")); | 108 | m_backgroundOpacity = new KProperty("background-opacity", QVariant(0), tr("Background Opacity")); | ||
108 | m_backgroundOpacity->setOption("max", 100); | 109 | m_backgroundOpacity->setOption("max", 100); | ||
109 | m_backgroundOpacity->setOption("min", 0); | 110 | m_backgroundOpacity->setOption("min", 0); | ||
110 | m_backgroundOpacity->setOption("unit", QLatin1String("%")); | 111 | m_backgroundOpacity->setOption("suffix", QLatin1String("%")); | ||
111 | 112 | | |||
112 | m_lineWeight = new KProperty("line-weight", 1.0, tr("Line Weight")); | 113 | m_lineWeight = new KProperty("line-weight", 1.0, tr("Line Weight")); | ||
113 | m_lineWeight->setOption("step", 1.0); | 114 | m_lineWeight->setOption("step", 1.0); | ||
114 | m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); | 115 | m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); | ||
115 | m_lineStyle = new KProperty("line-style", static_cast<int>(Qt::NoPen), tr("Line Style"), QString(), KProperty::LineStyle); | 116 | m_lineStyle = new KProperty("line-style", static_cast<int>(Qt::NoPen), tr("Line Style"), QString(), KProperty::LineStyle); | ||
116 | 117 | | |||
117 | propertySet()->addProperty(m_text); | 118 | propertySet()->addProperty(m_text); | ||
118 | propertySet()->addProperty(m_horizontalAlignment); | 119 | propertySet()->addProperty(m_horizontalAlignment); | ||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |