diff --git a/src/common/KReportItemLine.h b/src/common/KReportItemLine.h --- a/src/common/KReportItemLine.h +++ b/src/common/KReportItemLine.h @@ -55,8 +55,8 @@ KProperty *m_lineStyle; KReportLineStyle lineStyle() const; - int weight() const; - void setWeight(int w); + qreal weight() const; + void setWeight(qreal w); private: virtual void createProperties(); diff --git a/src/common/KReportItemLine.cpp b/src/common/KReportItemLine.cpp --- a/src/common/KReportItemLine.cpp +++ b/src/common/KReportItemLine.cpp @@ -55,7 +55,7 @@ if (parseReportLineStyleData(node.toElement(), &ls)) { m_lineWeight->setValue(ls.width()); m_lineColor->setValue(ls.color()); - m_lineStyle->setValue(int(ls.penStyle())); + m_lineStyle->setValue(static_cast(ls.penStyle())); } } else { kreportWarning() << "while parsing line element encountered unknown element: " << n; @@ -72,9 +72,11 @@ { m_set = new KPropertySet; - m_lineWeight = new KProperty("line-weight", 1, tr("Line Weight")); + m_lineWeight = new KProperty("line-weight", 1.0, tr("Line Weight")); + m_lineWeight->setOption("step", 1.0); + m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); - m_lineStyle = new KProperty("line-style", (int)Qt::SolidLine, tr("Line Style"), tr("Line Style"), KProperty::LineStyle); + m_lineStyle = new KProperty("line-style", static_cast(Qt::SolidLine), tr("Line Style"), tr("Line Style"), KProperty::LineStyle); m_start.setName(QLatin1String("Start")); m_end.setName(QLatin1String("End")); @@ -89,18 +91,18 @@ KReportLineStyle KReportItemLine::lineStyle() const { KReportLineStyle ls; - ls.setWidth(m_lineWeight->value().toInt()); + ls.setWidth(m_lineWeight->value().toReal()); ls.setColor(m_lineColor->value().value()); ls.setPenStyle((Qt::PenStyle)m_lineStyle->value().toInt()); return ls; } -int KReportItemLine::weight() const +qreal KReportItemLine::weight() const { - return m_lineWeight->value().toInt(); + return m_lineWeight->value().toReal(); } -void KReportItemLine::setWeight(int w) +void KReportItemLine::setWeight(qreal w) { m_lineWeight->setValue(w); } diff --git a/src/common/KReportUtils.cpp b/src/common/KReportUtils.cpp --- a/src/common/KReportUtils.cpp +++ b/src/common/KReportUtils.cpp @@ -482,7 +482,7 @@ Q_ASSERT(ls); if (elemSource.tagName() == QLatin1String("report:line-style")) { ls->setColor(QColor(elemSource.attribute(QLatin1String("report:line-color"), QLatin1String("#ffffff")))); - ls->setWidth(elemSource.attribute(QLatin1String("report:line-weight"), QLatin1String("0")).toInt()); + ls->setWidth(elemSource.attribute(QLatin1String("report:line-weight"), QLatin1String("0.0")).toDouble()); QString l = elemSource.attribute(QLatin1String("report:line-style"), QLatin1String("nopen")); if (l == QLatin1String("nopen")) { diff --git a/src/items/check/KReportItemCheck.cpp b/src/items/check/KReportItemCheck.cpp --- a/src/items/check/KReportItemCheck.cpp +++ b/src/items/check/KReportItemCheck.cpp @@ -57,7 +57,7 @@ if (parseReportLineStyleData(node.toElement(), &ls)) { m_lineWeight->setValue(ls.width()); m_lineColor->setValue(ls.color()); - m_lineStyle->setValue(QPen(ls.penStyle())); + m_lineStyle->setValue(static_cast(ls.penStyle())); } } else { kreportpluginWarning() << "while parsing check element encountered unknown element: " << n; @@ -86,9 +86,10 @@ m_foregroundColor = new KProperty("foreground-color", QColor(Qt::black), tr("Foreground Color")); - m_lineWeight = new KProperty("line-weight", 1, tr("Line Weight")); + m_lineWeight = new KProperty("line-weight", 1.0, tr("Line Weight")); + m_lineWeight->setOption("step", 1.0); m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); - m_lineStyle = new KProperty("line-style", QPen(Qt::SolidLine), tr("Line Style"), tr("Line Style"), KProperty::LineStyle); + m_lineStyle = new KProperty("line-style", static_cast(Qt::SolidLine), tr("Line Style"), tr("Line Style"), KProperty::LineStyle); m_staticValue = new KProperty("value", QVariant(false), tr("Value"), tr("Value used if not bound to a field")); addDefaultProperties(); @@ -104,7 +105,7 @@ KReportLineStyle KReportItemCheckBox::lineStyle() { KReportLineStyle ls; - ls.setWidth(m_lineWeight->value().toInt()); + ls.setWidth(m_lineWeight->value().toReal()); ls.setColor(m_lineColor->value().value()); ls.setPenStyle((Qt::PenStyle)m_lineStyle->value().toInt()); return ls; diff --git a/src/items/field/KReportItemField.cpp b/src/items/field/KReportItemField.cpp --- a/src/items/field/KReportItemField.cpp +++ b/src/items/field/KReportItemField.cpp @@ -71,7 +71,7 @@ if (parseReportLineStyleData(node.toElement(), &ls)) { m_lineWeight->setValue(ls.width()); m_lineColor->setValue(ls.color()); - m_lineStyle->setValue(QPen(ls.penStyle())); + m_lineStyle->setValue(static_cast(ls.penStyle())); } } else { kreportpluginWarning() << "while parsing field element encountered unknown element: " << n; @@ -115,9 +115,10 @@ m_backgroundOpacity->setOption("min", 0); m_backgroundOpacity->setOption("unit", QLatin1String("%")); - m_lineWeight = new KProperty("line-weight", 1, tr("Line Weight")); + m_lineWeight = new KProperty("line-weight", 1.0, tr("Line Weight")); + m_lineWeight->setOption("step", 1.0); m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); - m_lineStyle = new KProperty("line-style", QPen(Qt::NoPen), tr("Line Style"), tr("Line Style"), KProperty::LineStyle); + m_lineStyle = new KProperty("line-style", static_cast(Qt::NoPen), tr("Line Style"), tr("Line Style"), KProperty::LineStyle); m_wordWrap = new KProperty("word-wrap", QVariant(false), tr("Word Wrap")); m_canGrow = new KProperty("can-grow", QVariant(false), tr("Can Grow")); @@ -204,7 +205,7 @@ KReportLineStyle KReportItemField::lineStyle() const { KReportLineStyle ls; - ls.setWidth(m_lineWeight->value().toInt()); + ls.setWidth(m_lineWeight->value().toReal()); ls.setColor(m_lineColor->value().value()); ls.setPenStyle((Qt::PenStyle)m_lineStyle->value().toInt()); return ls; diff --git a/src/items/label/KReportItemLabel.cpp b/src/items/label/KReportItemLabel.cpp --- a/src/items/label/KReportItemLabel.cpp +++ b/src/items/label/KReportItemLabel.cpp @@ -63,7 +63,7 @@ if (parseReportLineStyleData(node.toElement(), &ls)) { m_lineWeight->setValue(ls.width()); m_lineColor->setValue(ls.color()); - m_lineStyle->setValue(QPen(ls.penStyle())); + m_lineStyle->setValue(static_cast(ls.penStyle())); } } else { kreportpluginWarning() << "while parsing label element encountered unknown element: " << n; @@ -113,9 +113,10 @@ m_backgroundOpacity->setOption("min", 0); m_backgroundOpacity->setOption("unit", QLatin1String("%")); - m_lineWeight = new KProperty("line-weight", 1, tr("Line Weight")); + m_lineWeight = new KProperty("line-weight", 1.0, tr("Line Weight")); + m_lineWeight->setOption("step", 1.0); m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); - m_lineStyle = new KProperty("line-style", QPen(Qt::NoPen), tr("Line Style"), tr("Line Style"), KProperty::LineStyle); + m_lineStyle = new KProperty("line-style", static_cast(Qt::NoPen), tr("Line Style"), tr("Line Style"), KProperty::LineStyle); addDefaultProperties(); m_set->addProperty(m_text); @@ -166,7 +167,7 @@ KReportLineStyle KReportItemLabel::lineStyle() const { KReportLineStyle ls; - ls.setWidth(m_lineWeight->value().toInt()); + ls.setWidth(m_lineWeight->value().toReal()); ls.setColor(m_lineColor->value().value()); ls.setPenStyle((Qt::PenStyle)m_lineStyle->value().toInt()); return ls; diff --git a/src/items/text/KReportItemText.cpp b/src/items/text/KReportItemText.cpp --- a/src/items/text/KReportItemText.cpp +++ b/src/items/text/KReportItemText.cpp @@ -67,7 +67,7 @@ if (parseReportLineStyleData(node.toElement(), &ls)) { m_lineWeight->setValue(ls.width()); m_lineColor->setValue(ls.color()); - m_lineStyle->setValue(QPen(ls.penStyle())); + m_lineStyle->setValue(static_cast(ls.penStyle())); } } else { kreportpluginWarning() << "while parsing field element encountered unknown element: " << n; @@ -132,9 +132,10 @@ m_backgroundColor = new KProperty("background-color", QColor(Qt::white), tr("Background Color")); m_foregroundColor = new KProperty("foreground-color", QColor(Qt::black), tr("Foreground Color")); - m_lineWeight = new KProperty("line-weight", 1, tr("Line Weight")); + m_lineWeight = new KProperty("line-weight", 1.0, tr("Line Weight")); + m_lineWeight->setOption("step", 1.0); m_lineColor = new KProperty("line-color", QColor(Qt::black), tr("Line Color")); - m_lineStyle = new KProperty("line-style", QPen(Qt::NoPen), tr("Line Style"), tr("Line Style"), KProperty::LineStyle); + m_lineStyle = new KProperty("line-style", static_cast(Qt::NoPen), tr("Line Style"), tr("Line Style"), KProperty::LineStyle); m_backgroundOpacity = new KProperty("background-opacity", QVariant(0), tr("Background Opacity")); m_backgroundOpacity->setOption("max", 100); m_backgroundOpacity->setOption("min", 0); @@ -185,7 +186,7 @@ KReportLineStyle KReportItemText::lineStyle() const { KReportLineStyle ls; - ls.setWidth(m_lineWeight->value().toInt()); + ls.setWidth(m_lineWeight->value().toReal()); ls.setColor(m_lineColor->value().value()); ls.setPenStyle((Qt::PenStyle)m_lineStyle->value().toInt()); return ls;