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 | #include <KPropertyListData> | 24 | #include <KPropertyListData> | ||
24 | 25 | | |||
25 | #include <QFontDatabase> | 26 | #include <QFontDatabase> | ||
26 | #include <QPalette> | 27 | #include <QPalette> | ||
27 | #include <QDomNodeList> | 28 | #include <QDomNodeList> | ||
28 | 29 | | |||
29 | KReportItemLabel::KReportItemLabel() | 30 | KReportItemLabel::KReportItemLabel() | ||
30 | { | 31 | { | ||
31 | createProperties(); | 32 | createProperties(); | ||
32 | } | 33 | } | ||
33 | 34 | | |||
34 | KReportItemLabel::KReportItemLabel(const QDomNode & element) | 35 | KReportItemLabel::KReportItemLabel(const QDomNode & element) | ||
35 | : KReportItemLabel() | 36 | : KReportItemLabel() | ||
36 | { | 37 | { | ||
37 | nameProperty()->setValue(element.toElement().attribute(QLatin1String("report:name"))); | 38 | nameProperty()->setValue(KReportUtils::readNameAttribute(element.toElement())); | ||
38 | m_text->setValue(element.toElement().attribute(QLatin1String("report:caption"))); | 39 | m_text->setValue(element.toElement().attribute(QLatin1String("report:caption"))); | ||
39 | setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble()); | 40 | setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble()); | ||
40 | m_horizontalAlignment->setValue(element.toElement().attribute(QLatin1String("report:horizontal-align"))); | 41 | m_horizontalAlignment->setValue(element.toElement().attribute(QLatin1String("report:horizontal-align"))); | ||
41 | m_verticalAlignment->setValue(element.toElement().attribute(QLatin1String("report:vertical-align"))); | 42 | m_verticalAlignment->setValue(element.toElement().attribute(QLatin1String("report:vertical-align"))); | ||
42 | 43 | | |||
43 | parseReportRect(element.toElement()); | 44 | parseReportRect(element.toElement()); | ||
44 | 45 | | |||
45 | QDomNodeList nl = element.childNodes(); | 46 | QDomNodeList nl = element.childNodes(); | ||
▲ Show 20 Lines • Show All 57 Lines • ▼ Show 20 Line(s) | 90 | { | |||
103 | m_font = new KProperty("font", QFontDatabase::systemFont(QFontDatabase::GeneralFont), tr("Font"), tr("Font")); | 104 | m_font = new KProperty("font", QFontDatabase::systemFont(QFontDatabase::GeneralFont), tr("Font"), tr("Font")); | ||
104 | 105 | | |||
105 | m_backgroundColor = new KProperty("background-color", QColor(Qt::white), tr("Background Color")); | 106 | m_backgroundColor = new KProperty("background-color", QColor(Qt::white), tr("Background Color")); | ||
106 | m_foregroundColor = new KProperty("foreground-color", QColor(Qt::black), tr("Foreground Color")); | 107 | m_foregroundColor = new KProperty("foreground-color", QColor(Qt::black), tr("Foreground Color")); | ||
107 | 108 | | |||
108 | m_backgroundOpacity = new KProperty("background-opacity", QVariant(0), tr("Background Opacity")); | 109 | m_backgroundOpacity = new KProperty("background-opacity", QVariant(0), tr("Background Opacity")); | ||
109 | m_backgroundOpacity->setOption("max", 100); | 110 | m_backgroundOpacity->setOption("max", 100); | ||
110 | m_backgroundOpacity->setOption("min", 0); | 111 | m_backgroundOpacity->setOption("min", 0); | ||
111 | m_backgroundOpacity->setOption("unit", QLatin1String("%")); | 112 | m_backgroundOpacity->setOption("suffix", QLatin1String("%")); | ||
112 | 113 | | |||
113 | m_lineWeight = new KProperty("line-weight", 1.0, tr("Line Weight")); | 114 | m_lineWeight = new KProperty("line-weight", 1.0, tr("Line Weight")); | ||
114 | m_lineWeight->setOption("step", 1.0); | 115 | m_lineWeight->setOption("step", 1.0); | ||
115 | m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); | 116 | m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); | ||
116 | m_lineStyle = new KProperty("line-style", static_cast<int>(Qt::NoPen), tr("Line Style"), QString(), KProperty::LineStyle); | 117 | m_lineStyle = new KProperty("line-style", static_cast<int>(Qt::NoPen), tr("Line Style"), QString(), KProperty::LineStyle); | ||
117 | 118 | | |||
118 | propertySet()->addProperty(m_text); | 119 | propertySet()->addProperty(m_text); | ||
119 | propertySet()->addProperty(m_horizontalAlignment); | 120 | propertySet()->addProperty(m_horizontalAlignment); | ||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |