diff --git a/autotests/format/FormatTest.cpp b/autotests/format/FormatTest.cpp --- a/autotests/format/FormatTest.cpp +++ b/autotests/format/FormatTest.cpp @@ -27,8 +27,6 @@ #include "KReportDocument.h" #include "KReportDesignerSectionDetail.h" #include "KReportSection.h" -#include "KReportPosition.h" -#include "KReportSize.h" #include "KReportDesignerItemLine.h" #include "KReportItemLine.h" #include "KReportDesignerItemRectBase.h" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -9,8 +9,6 @@ set(kreport_LIB_SRCS common/kreport_debug.cpp common/kreportplugin_debug.cpp - common/KReportPosition.cpp - common/KReportSize.cpp common/KReportItemBase.cpp common/KReportAsyncItemBase.cpp common/KReportSectionData.cpp @@ -259,8 +257,6 @@ KReportUnit KReportUtils KReportDesign - KReportSize - KReportPosition KReportDocument KReportSectionData KReportRenderObjects diff --git a/src/common/KReportItemBase.h b/src/common/KReportItemBase.h --- a/src/common/KReportItemBase.h +++ b/src/common/KReportItemBase.h @@ -20,9 +20,8 @@ #include "config-kreport.h" #include "kreport_export.h" -#include "KReportPosition.h" -#include "KReportSize.h" #include "KReportDpi.h" +#include "KReportUnit.h" #include #include diff --git a/src/common/KReportItemLine.h b/src/common/KReportItemLine.h --- a/src/common/KReportItemLine.h +++ b/src/common/KReportItemLine.h @@ -19,7 +19,6 @@ #define KREPORTITEMLINE_H #include "KReportItemBase.h" -#include "KReportPosition.h" #include "kreport_export.h" class QDomNode; @@ -44,12 +43,12 @@ virtual void setUnit(const KReportUnit&); - KReportPosition startPosition() const; - KReportPosition endPosition() const; + QPointF startPosition() const; + QPointF endPosition() const; protected: - KReportPosition m_start; - KReportPosition m_end; + KProperty *m_start; + KProperty *m_end; KProperty *m_lineColor; KProperty *m_lineWeight; KProperty *m_lineStyle; diff --git a/src/common/KReportItemLine.cpp b/src/common/KReportItemLine.cpp --- a/src/common/KReportItemLine.cpp +++ b/src/common/KReportItemLine.cpp @@ -21,6 +21,7 @@ #include +#include #include KReportItemLine::KReportItemLine() @@ -43,8 +44,8 @@ _s.setY(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:y1"), QLatin1String("1cm")))); _e.setX(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:x2"), QLatin1String("1cm")))); _e.setY(KReportUnit::parseValue(element.toElement().attribute(QLatin1String("svg:y2"), QLatin1String("2cm")))); - m_start.setPointPos(_s); - m_end.setPointPos(_e); + m_start->setValue(_s); + m_end->setValue(_e); for (int i = 0; i < nl.count(); i++) { node = nl.item(i); @@ -69,14 +70,19 @@ void KReportItemLine::createProperties() { - m_lineWeight = new KProperty("line-weight", 1, tr("Line Weight")); + m_start = new KProperty("startposition", QPointF(), QCoreApplication::translate("StartPosition", "Start Position")); + m_end = new KProperty("endposition", QPointF(), QCoreApplication::translate("EndPosition", "End Position")); + + m_lineWeight = new KProperty("line-weight", 1.0, tr("Line Weight")); 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_start.setName(QLatin1String("Start")); - m_end.setName(QLatin1String("End")); - - propertySet()->addProperty(m_start.property()); - propertySet()->addProperty(m_end.property()); + + //Remove the unused properies from KReportItemBase + propertySet()->removeProperty("size"); + propertySet()->removeProperty("position"); + + propertySet()->addProperty(m_start); + propertySet()->addProperty(m_end); propertySet()->addProperty(m_lineWeight); propertySet()->addProperty(m_lineColor); propertySet()->addProperty(m_lineStyle); @@ -113,8 +119,8 @@ Q_UNUSED(data) OROLine * ln = new OROLine(); - QPointF s = m_start.toScene(); - QPointF e = m_end.toScene(); + QPointF s = scenePosition(m_start->value().toPointF()); + QPointF e = scenePosition(m_end->value().toPointF()); s += offset; e += offset; @@ -125,26 +131,26 @@ if (page) page->insertPrimitive(ln); OROLine *l2 = dynamic_cast(ln->clone()); - l2->setStartPoint(m_start.toPoint()); - l2->setEndPoint(m_end.toPoint()); + l2->setStartPoint(m_start->value().toPointF()); + l2->setEndPoint(m_end->value().toPointF()); if (section) section->addPrimitive(l2); return 0; } void KReportItemLine::setUnit(const KReportUnit &u) { - m_start.setUnit(u); - m_end.setUnit(u); + m_start->setOption("unit", u.symbol()); + m_end->setOption("unit", u.symbol()); } -KReportPosition KReportItemLine::startPosition() const +QPointF KReportItemLine::startPosition() const { - return m_start; + return m_start->value().toPointF(); } -KReportPosition KReportItemLine::endPosition() const +QPointF KReportItemLine::endPosition() const { - return m_end; + return m_end->value().toPointF(); } diff --git a/src/common/KReportPosition.h b/src/common/KReportPosition.h deleted file mode 100644 --- a/src/common/KReportPosition.h +++ /dev/null @@ -1,61 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) - * Copyright (C) 2010 Jarosław Staniek - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#ifndef KRPOS_H -#define KRPOS_H - -#include - -#include "kreport_export.h" -#include "KReportUnit.h" - -class KProperty; - -/** -*/ -class KREPORT_EXPORT KReportPosition -{ -public: - enum UpdatePropertyFlag { - UpdateProperty, - DontUpdateProperty - }; - - explicit KReportPosition(const KReportUnit& unit = KReportUnit(KReportUnit::Centimeter)); - - ~KReportPosition(); - QPointF toUnit() const; - QPointF toPoint() const; - QPointF toScene() const; - void setScenePos(const QPointF&, UpdatePropertyFlag update = UpdateProperty); - void setUnitPos(const QPointF&, UpdatePropertyFlag update = UpdateProperty); - void setPointPos(const QPointF&, UpdatePropertyFlag update = UpdateProperty); - void setUnit(const KReportUnit& unit); - void setName(const QString& name); - KReportUnit unit() const { return m_unit; } - - KProperty* property() const { - return m_property; - } -private: - QPointF m_pointPos; - KReportUnit m_unit; - KProperty* m_property; -}; - -#endif diff --git a/src/common/KReportPosition.cpp b/src/common/KReportPosition.cpp deleted file mode 100644 --- a/src/common/KReportPosition.cpp +++ /dev/null @@ -1,101 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) - * Copyright (C) 2010 Jarosław Staniek - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include "KReportPosition.h" -#include "KReportDpi.h" - -#include - -#include - -KReportPosition::KReportPosition(const KReportUnit& unit) -{ - m_unit = unit; - m_property = new KProperty("position", toScene(), QCoreApplication::translate("KReportPosition", "Position")); -} - -void KReportPosition::setName(const QString& name) -{ - m_property->setName(name.toLatin1()); - m_property->setCaption(name); -} - -KReportPosition::~KReportPosition() -{ -} - -void KReportPosition::setScenePos(const QPointF& pos, UpdatePropertyFlag update) -{ - const qreal x = INCH_TO_POINT(pos.x() / KReportDpi::dpiX()); - const qreal y = INCH_TO_POINT(pos.y() / KReportDpi::dpiY()); - - m_pointPos.setX(x); - m_pointPos.setY(y); - - if (update == UpdateProperty) - m_property->setValue(toUnit()); -} - -void KReportPosition::setUnitPos(const QPointF& pos, UpdatePropertyFlag update) -{ - const qreal x = m_unit.fromUserValue(pos.x()); - const qreal y = m_unit.fromUserValue(pos.y()); - - m_pointPos.setX(x); - m_pointPos.setY(y); - - if (update == UpdateProperty) - m_property->setValue(toUnit()); -} - -void KReportPosition::setPointPos(const QPointF& pos, UpdatePropertyFlag update) -{ - m_pointPos.setX(pos.x()); - m_pointPos.setY(pos.y()); - - if (update == UpdateProperty) - m_property->setValue(toUnit()); -} - -void KReportPosition::setUnit(const KReportUnit& u) -{ - m_unit = u; - m_property->setValue(toUnit()); -} - -QPointF KReportPosition::toPoint() const -{ - return m_pointPos; -} - -QPointF KReportPosition::toScene() const -{ - const qreal x = POINT_TO_INCH(m_pointPos.x()) * KReportDpi::dpiX(); - const qreal y = POINT_TO_INCH(m_pointPos.y()) * KReportDpi::dpiY(); - - return QPointF(x, y); -} - -QPointF KReportPosition::toUnit() const -{ - const qreal x = m_unit.toUserValue(m_pointPos.x()); - const qreal y = m_unit.toUserValue(m_pointPos.y()); - - return QPointF(x, y); -} - diff --git a/src/common/KReportSize.h b/src/common/KReportSize.h deleted file mode 100644 --- a/src/common/KReportSize.h +++ /dev/null @@ -1,56 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ -#ifndef KREPORTSIZE_H -#define KREPORTSIZE_H - -#include - -#include "KReportUnit.h" -#include "kreport_export.h" - -class KProperty; - -/** -*/ -class KREPORT_EXPORT KReportSize -{ -public: - enum UpdatePropertyFlag { - UpdateProperty, - DontUpdateProperty - }; - explicit KReportSize(const KReportUnit& unit = KReportUnit(KReportUnit::Centimeter)); - - ~KReportSize(); - QSizeF toUnit() const; - QSizeF toPoint() const; - QSizeF toScene() const; - void setSceneSize(const QSizeF&, UpdatePropertyFlag update = UpdateProperty); - void setUnitSize(const QSizeF&, UpdatePropertyFlag update = UpdateProperty); - void setPointSize(const QSizeF&, UpdatePropertyFlag update = UpdateProperty); - void setUnit(KReportUnit); - - KProperty* property() const { - return m_property; - } -private: - QSizeF m_pointSize; - KReportUnit m_unit; - KProperty* m_property; -}; - -#endif diff --git a/src/common/KReportSize.cpp b/src/common/KReportSize.cpp deleted file mode 100644 --- a/src/common/KReportSize.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* This file is part of the KDE project - * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include "KReportSize.h" -#include "KReportDpi.h" - -#include - -#include - -KReportSize::KReportSize(const KReportUnit& unit) -{ - m_unit = unit; - m_property = new KProperty("size", toScene(), QCoreApplication::translate("KReportSize", "Size")); -} - - -KReportSize::~KReportSize() -{ -} - -void KReportSize::setSceneSize(const QSizeF& s, UpdatePropertyFlag update) -{ - qreal w, h; - - w = INCH_TO_POINT(s.width() / KReportDpi::dpiX()); - h = INCH_TO_POINT(s.height() / KReportDpi::dpiY()); - m_pointSize.setWidth(w); - m_pointSize.setHeight(h); - - if (update == UpdateProperty) - m_property->setValue(toUnit()); -} - -void KReportSize::setUnitSize(const QSizeF& s, UpdatePropertyFlag update) -{ - qreal w, h; - w = m_unit.fromUserValue(s.width()); - h = m_unit.fromUserValue(s.height()); - m_pointSize.setWidth(w); - m_pointSize.setHeight(h); - - if (update == UpdateProperty) - m_property->setValue(toUnit()); -} - -void KReportSize::setPointSize(const QSizeF& s, UpdatePropertyFlag update) -{ - m_pointSize.setWidth(s.width()); - m_pointSize.setHeight(s.height()); - - if (update == UpdateProperty) - m_property->setValue(toUnit()); -} - -void KReportSize::setUnit(KReportUnit u) -{ - m_unit = u; - m_property->setValue(toUnit()); -} - -QSizeF KReportSize::toPoint() const -{ - return m_pointSize; -} - -QSizeF KReportSize::toScene() const -{ - qreal w, h; - w = POINT_TO_INCH(m_pointSize.width()) * KReportDpi::dpiX(); - h = POINT_TO_INCH(m_pointSize.height()) * KReportDpi::dpiY(); - return QSizeF(w, h); -} - -QSizeF KReportSize::toUnit() const -{ - qreal w, h; - w = m_unit.toUserValue(m_pointSize.width()); - h = m_unit.toUserValue(m_pointSize.height()); - - return QSizeF(w, h); -} diff --git a/src/common/KReportUtils.cpp b/src/common/KReportUtils.cpp --- a/src/common/KReportUtils.cpp +++ b/src/common/KReportUtils.cpp @@ -19,8 +19,6 @@ #include "KReportUtils.h" #include "KReportUnit.h" -#include "KReportPosition.h" -#include "KReportSize.h" #include "KReportItemBase.h" #include "KReportLineStyle.h" @@ -502,6 +500,7 @@ return false; } +#if 0 bool KReportUtils::parseReportRect(const QDomElement & elemSource, KReportPosition *pos, KReportSize *size) { Q_ASSERT(pos); @@ -523,6 +522,7 @@ size->setPointSize(_siz); return true; } +#endif class PageIds : private QHash { diff --git a/src/items/check/KReportItemCheck.h b/src/items/check/KReportItemCheck.h --- a/src/items/check/KReportItemCheck.h +++ b/src/items/check/KReportItemCheck.h @@ -19,8 +19,6 @@ #define KREPORTITEMCHECKBOX_H #include "KReportItemBase.h" -#include "KReportPosition.h" -#include "KReportSize.h" class QDomNode; diff --git a/src/items/check/KReportScriptCheck.cpp b/src/items/check/KReportScriptCheck.cpp --- a/src/items/check/KReportScriptCheck.cpp +++ b/src/items/check/KReportScriptCheck.cpp @@ -18,6 +18,9 @@ #include "KReportScriptCheck.h" #include +#include +#include + namespace Scripting { diff --git a/src/items/field/KReportItemField.h b/src/items/field/KReportItemField.h --- a/src/items/field/KReportItemField.h +++ b/src/items/field/KReportItemField.h @@ -19,7 +19,6 @@ #define KREPORTITEMFIELD_H #include "KReportItemBase.h" -#include "KReportSize.h" #include diff --git a/src/items/field/KReportScriptField.cpp b/src/items/field/KReportScriptField.cpp --- a/src/items/field/KReportScriptField.cpp +++ b/src/items/field/KReportScriptField.cpp @@ -17,6 +17,10 @@ #include "KReportScriptField.h" +#include +#include + + namespace Scripting { Field::Field(KReportItemField *f) diff --git a/src/items/image/KReportItemImage.h b/src/items/image/KReportItemImage.h --- a/src/items/image/KReportItemImage.h +++ b/src/items/image/KReportItemImage.h @@ -19,8 +19,6 @@ #define KREPORTITEMIMAGE_H #include "KReportItemBase.h" -#include "KReportPosition.h" -#include "KReportSize.h" class QDomNode; diff --git a/src/items/label/KReportItemLabel.h b/src/items/label/KReportItemLabel.h --- a/src/items/label/KReportItemLabel.h +++ b/src/items/label/KReportItemLabel.h @@ -19,8 +19,6 @@ #define KReportItemLabel_H #include "KReportItemBase.h" -#include "KReportPosition.h" -#include "KReportSize.h" #include diff --git a/src/items/label/KReportScriptLabel.cpp b/src/items/label/KReportScriptLabel.cpp --- a/src/items/label/KReportScriptLabel.cpp +++ b/src/items/label/KReportScriptLabel.cpp @@ -17,6 +17,9 @@ #include "KReportScriptLabel.h" +#include +#include + namespace Scripting { Label::Label(KReportItemLabel *l) diff --git a/src/items/text/KReportItemText.h b/src/items/text/KReportItemText.h --- a/src/items/text/KReportItemText.h +++ b/src/items/text/KReportItemText.h @@ -19,8 +19,6 @@ #define KREPORTITEMTEXT_H #include "KReportItemBase.h" -#include "KReportPosition.h" -#include "KReportSize.h" #include diff --git a/src/items/text/KReportScriptText.cpp b/src/items/text/KReportScriptText.cpp --- a/src/items/text/KReportScriptText.cpp +++ b/src/items/text/KReportScriptText.cpp @@ -18,6 +18,9 @@ #include #include +#include +#include + #include "kreportplugin_debug.h" namespace Scripting diff --git a/src/plugins/maps/KReportItemMaps.h b/src/plugins/maps/KReportItemMaps.h --- a/src/plugins/maps/KReportItemMaps.h +++ b/src/plugins/maps/KReportItemMaps.h @@ -26,8 +26,6 @@ #include -#include "KReportPosition.h" -#include "KReportSize.h" #include "KReportMapRenderer.h" #include diff --git a/src/plugins/web/KReportItemWeb.h b/src/plugins/web/KReportItemWeb.h --- a/src/plugins/web/KReportItemWeb.h +++ b/src/plugins/web/KReportItemWeb.h @@ -22,8 +22,6 @@ #define KREPORTITEMWEB_H #include "KReportAsyncItemBase.h" -#include "KReportPosition.h" -#include "KReportSize.h" #include "KReportData.h" #include diff --git a/src/renderer/KReportAsyncItemManager_p.cpp b/src/renderer/KReportAsyncItemManager_p.cpp --- a/src/renderer/KReportAsyncItemManager_p.cpp +++ b/src/renderer/KReportAsyncItemManager_p.cpp @@ -21,6 +21,8 @@ #include "KReportAsyncItemBase.h" #include "kreport_debug.h" +#include + namespace KReportPrivate { class RenderData { diff --git a/src/renderer/scripting/KReportScriptDraw.cpp b/src/renderer/scripting/KReportScriptDraw.cpp --- a/src/renderer/scripting/KReportScriptDraw.cpp +++ b/src/renderer/scripting/KReportScriptDraw.cpp @@ -17,8 +17,6 @@ #include "KReportScriptDraw.h" #include "KReportRenderObjects.h" -#include "KReportPosition.h" -#include "KReportSize.h" #include #include @@ -48,12 +46,8 @@ { if (m_curPage) { ORORect *r = new ORORect(); - KReportPosition p; - KReportSize s; - p.setPointPos(QPointF(x, y)); - s.setPointSize(QSizeF(w, h)); - r->setRect(QRectF(p.toScene() + m_curOffset, s.toScene())); + r->setRect(QRectF(KReportItemBase::scenePosition(QPointF(x, y)) + m_curOffset, KReportItemBase::sceneSize(QSizeF(w, h)))); QPen pen(QColor(lc), lw); QColor c(fc); @@ -70,12 +64,8 @@ { if (m_curPage) { OROEllipse *e = new OROEllipse(); - KReportPosition p; - KReportSize s; - p.setPointPos(QPointF(x, y)); - s.setPointSize(QSizeF(w, h)); - e->setRect(QRectF(p.toScene() + m_curOffset, s.toScene())); + e->setRect(QRectF(KReportItemBase::scenePosition(QPointF(x, y)) + m_curOffset, KReportItemBase::sceneSize(QSizeF(w, h)))); QPen pen(QColor(lc), lw); QColor c(fc); @@ -92,14 +82,9 @@ { if (m_curPage) { OROLine *ln = new OROLine(); - KReportPosition s; - KReportPosition e; - s.setPointPos(QPointF(x1, y1)); - e.setPointPos(QPointF(x2, y2)); - - ln->setStartPoint(s.toScene() + m_curOffset); - ln->setEndPoint(e.toScene() + m_curOffset); + ln->setStartPoint(KReportItemBase::scenePosition(QPointF(x1, y1) + m_curOffset)); + ln->setEndPoint(KReportItemBase::scenePosition(QPointF(x2, y2) + m_curOffset)); KReportLineStyle ls; ls.setColor(QColor(lc)); diff --git a/src/renderer/scripting/KReportScriptLine.cpp b/src/renderer/scripting/KReportScriptLine.cpp --- a/src/renderer/scripting/KReportScriptLine.cpp +++ b/src/renderer/scripting/KReportScriptLine.cpp @@ -67,21 +67,21 @@ QPointF Line::startPosition() { - return m_line->m_start.toPoint(); + return m_line->m_start->value().toPointF(); } void Line::setStartPosition(const QPointF& p) { - m_line->m_start.setPointPos(p); + m_line->m_start->setValue(p); } QPointF Line::endPosition() { - return m_line->m_end.toPoint(); + return m_line->m_end->value().toPointF(); } void Line::setEndPosition(const QPointF& p) { - m_line->m_end.setPointPos(p); + m_line->m_end->setValue(p); } } diff --git a/src/wrtembed/KReportDesignerItemLine.cpp b/src/wrtembed/KReportDesignerItemLine.cpp --- a/src/wrtembed/KReportDesignerItemLine.cpp +++ b/src/wrtembed/KReportDesignerItemLine.cpp @@ -68,7 +68,10 @@ : KReportItemLine(entity), KReportDesignerItemBase(d, this) { init(scene, d); - setLine ( m_start.toScene().x(), m_start.toScene().y(), m_end.toScene().x(), m_end.toScene().y() ); + QPointF s = scenePosition(m_start->value().toPointF()); + QPointF e = scenePosition(m_end->value().toPointF()); + + setLine ( s.x(), s.y(), e.x(), e.y() ); } KReportDesignerItemLine* KReportDesignerItemLine::clone() @@ -111,10 +114,10 @@ // properties addPropertyAsAttribute(&entity, nameProperty()); entity.setAttribute(QLatin1String("report:z-index"), zValue()); - KReportUtils::setAttribute(&entity, QLatin1String("svg:x1"), m_start.toPoint().x()); - KReportUtils::setAttribute(&entity, QLatin1String("svg:y1"), m_start.toPoint().y()); - KReportUtils::setAttribute(&entity, QLatin1String("svg:x2"), m_end.toPoint().x()); - KReportUtils::setAttribute(&entity, QLatin1String("svg:y2"), m_end.toPoint().y()); + KReportUtils::setAttribute(&entity, QLatin1String("svg:x1"), m_start->value().toPointF().x()); + KReportUtils::setAttribute(&entity, QLatin1String("svg:y1"), m_start->value().toPointF().y()); + KReportUtils::setAttribute(&entity, QLatin1String("svg:x2"), m_end->value().toPointF().x()); + KReportUtils::setAttribute(&entity, QLatin1String("svg:y2"), m_end->value().toPointF().y()); buildXMLLineStyle(doc, &entity, lineStyle()); @@ -125,13 +128,11 @@ { Q_UNUSED(s); - if (p.name() == "Start" || p.name() == "End") { - if (p.name() == "Start") - m_start.setUnitPos(p.value().toPointF(), KReportPosition::DontUpdateProperty); - if (p.name() == "End") - m_end.setUnitPos(p.value().toPointF(), KReportPosition::DontUpdateProperty); - - setLine(m_start.toScene().x(), m_start.toScene().y(), m_end.toScene().x(), m_end.toScene().y()); + if (p.name() == "startposition" || p.name() == "endposition") { + QPointF s = scenePosition(m_start->value().toPointF()); + QPointF e = scenePosition(m_end->value().toPointF()); + + setLine ( s.x(), s.y(), e.x(), e.y() ); } else if (p.name() == "name") { //For some reason p.oldValue returns an empty string @@ -181,10 +182,10 @@ switch (m_grabAction) { case 1: - m_start.setScenePos(QPointF(x,y)); + m_start->setValue(positionFromScene(QPointF(x,y))); break; case 2: - m_end.setScenePos(QPointF(x,y)); + m_end->setValue(positionFromScene(QPointF(x,y))); break; default: QPointF d = mapToItem(this, dynamic_cast(scene())->gridPoint(event->scenePos())) - mapToItem(this, dynamic_cast(scene())->gridPoint(event->lastScenePos())); @@ -235,8 +236,10 @@ void KReportDesignerItemLine::setLineScene(QLineF l) { - m_start.setScenePos(l.p1(), KReportPosition::DontUpdateProperty); - m_end.setScenePos(l.p2()); + m_start->setValue(positionFromScene(l.p1())); + m_end->setValue(positionFromScene(l.p2())); + + setLine(l); } void KReportDesignerItemLine::move(const QPointF& m) diff --git a/src/wrtembed/KReportDesignerItemRectBase.cpp b/src/wrtembed/KReportDesignerItemRectBase.cpp --- a/src/wrtembed/KReportDesignerItemRectBase.cpp +++ b/src/wrtembed/KReportDesignerItemRectBase.cpp @@ -19,8 +19,6 @@ #include "KReportDesignerItemRectBase.h" #include "KReportDesignerSectionView.h" #include "KReportDesigner.h" -#include "KReportPosition.h" -#include "KReportSize.h" #include "KReportDesignerSectionScene.h" #include "KReportDpi.h"