diff --git a/src/common/KReportItemLine.h b/src/common/KReportItemLine.h --- a/src/common/KReportItemLine.h +++ b/src/common/KReportItemLine.h @@ -54,8 +54,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 @@ -74,13 +74,14 @@ m_end = new KProperty("endposition", QPointF(), QCoreApplication::translate("EndPosition", "End Position")); 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); - + //Remove the unused properies from KReportItemBase propertySet()->removeProperty("size"); propertySet()->removeProperty("position"); - + propertySet()->addProperty(m_start); propertySet()->addProperty(m_end); propertySet()->addProperty(m_lineWeight); @@ -91,18 +92,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); } @@ -134,7 +135,7 @@ if (l2) { l2->setStartPoint(m_start->value().toPointF()); l2->setEndPoint(m_end->value().toPointF()); - + if (section) section->addPrimitive(l2); } return 0; diff --git a/src/common/KReportUtils.cpp b/src/common/KReportUtils.cpp --- a/src/common/KReportUtils.cpp +++ b/src/common/KReportUtils.cpp @@ -479,7 +479,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; @@ -84,8 +84,9 @@ m_foregroundColor = new KProperty("foreground-color", QColor(Qt::black), tr("Foreground Color")); 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")); propertySet()->addProperty(m_controlSource); @@ -100,7 +101,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; @@ -134,7 +135,7 @@ } else { chk->setCheckType(OROCheckBox::Tick); } - + QString str; bool v = false; QString cs = itemDataSource(); 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; @@ -113,8 +113,9 @@ m_backgroundOpacity->setOption("unit", QLatin1String("%")); 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")); @@ -200,7 +201,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; @@ -111,8 +111,9 @@ m_backgroundOpacity->setOption("unit", QLatin1String("%")); 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); propertySet()->addProperty(m_text); propertySet()->addProperty(m_horizontalAlignment); @@ -162,7 +163,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 @@ -68,7 +68,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; @@ -131,8 +131,9 @@ m_foregroundColor = new KProperty("foreground-color", QColor(Qt::black), tr("Foreground Color")); 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); @@ -182,7 +183,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; @@ -213,7 +214,7 @@ } else { qstrValue = m_itemValue->value().toString(); } - + QPointF pos = scenePosition(position()); QSizeF siz = sceneSize(size()); pos += offset;