"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/ellipseitem.cpp" between
kpl-4.1.tar.gz and kpl-5.0.tar.gz

About: Kpl is a KDE program for two- and three-dimensional graphical presentation (plots) of data sets and functions. Multidimensional nonlinear parameter and general linear least square parameter fits can be performed.

ellipseitem.cpp  (kpl-4.1):ellipseitem.cpp  (kpl-5.0)
/*************************************************************************** /***************************************************************************
ellipseitem.cpp - description ellipseitem.cpp - description
------------------- -------------------
begin : Sun Apr 29 2001 begin : Sun Apr 29 2001
copyright : (C) 2015 by Werner Stille copyright : (C) 2017 by Werner Stille
email : stille@uni-freiburg.de email : kpl@werner-stille.de
***************************************************************************/ ***************************************************************************/
/*************************************************************************** /***************************************************************************
* * * *
* This program is free software; you can redistribute it and/or modify * * This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by * * it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or * * the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. * * (at your option) any later version. *
* * * *
***************************************************************************/ ***************************************************************************/
#include <QBrush> #include <QBrush>
#include <KConfigGroup> #include <KConfigGroup>
#include "ellipseitem.h" #include "ellipseitem.h"
#include "kplscene.h" #include "kplscene.h"
EllipseItem::EllipseItem(double x0, double y0, unsigned color, EllipseItem::EllipseItem(double x0, double y0, unsigned color,
QGraphicsItem* parent, double width, double height, QGraphicsItem* parent, double width, double height,
bool visible, FillStyle fill, double relSize, bool visible, FillStyle fill, Symbol symbol,
double dir) : double relSize, double dir) :
DecoItem(color, x0, y0, relSize), QGraphicsEllipseItem(parent), DecoItem(color, x0, y0, relSize), QGraphicsEllipseItem(parent),
m_fillStyle(fill), m_width(width), m_height(height), m_dir(dir) m_fillStyle(fill), m_width(width), m_height(height), m_dir(dir),
m_symbol(symbol)
{ {
if (!visible) if (!visible)
hide(); hide();
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
} }
EllipseItem::EllipseItem(const EllipseItem& a) : EllipseItem::EllipseItem(const EllipseItem& a) :
DecoItem(a), QGraphicsEllipseItem(), m_fillStyle(a.m_fillStyle), DecoItem(a), QGraphicsEllipseItem(), m_fillStyle(a.m_fillStyle),
m_width(a.m_width), m_height(a.m_height), m_dir(a.m_dir) m_width(a.m_width), m_height(a.m_height), m_dir(a.m_dir), m_symbol(a.m_symbol)
{ {
setZValue(a.zValue()); setZValue(a.zValue());
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
setSelected(a.isSelected()); setSelected(a.isSelected());
setVisible(a.isVisible()); setVisible(a.isVisible());
} }
EllipseItem::EllipseItem(const KConfigGroup* plo, unsigned color, EllipseItem::EllipseItem(const KConfigGroup* plo, unsigned color,
QGraphicsItem* parent) : QGraphicsItem* parent) :
DecoItem(plo, color), QGraphicsEllipseItem(parent) DecoItem(plo, color), QGraphicsEllipseItem(parent)
{ {
if (!plo->readEntry("active", true)) if (!plo->readEntry("active", true))
hide(); hide();
m_fillStyle = FillStyle(plo->readEntry("fillstyle", 0)); m_fillStyle = FillStyle(plo->readEntry("fillstyle", 0));
if (!m_fillStyle) if (!m_fillStyle)
if (plo->readEntry("filled", false)) if (plo->readEntry("filled", false))
m_fillStyle = SolidPattern; m_fillStyle = SolidPattern;
m_width = plo->readEntry("width", 3.0); m_width = plo->readEntry("width", 3.0);
m_height = plo->readEntry("height", 2.0); m_height = plo->readEntry("height", 2.0);
m_dir = plo->readEntry("dir", 0.0); m_dir = plo->readEntry("dir", 0.0);
m_symbol = Symbol(plo->readEntry("symb", int(SolidLine)));
setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable); setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
} }
EllipseItem::~EllipseItem() EllipseItem::~EllipseItem()
{ {
} }
QPixmap EllipseItem::pixmap() const QPixmap EllipseItem::pixmap() const
{ {
return KplItem::pixmap(QPen(m_color), return KplItem::pixmap(QPen(m_color),
skipping to change at line 106 skipping to change at line 108
void EllipseItem::writePlo(KConfigGroup* plo) const void EllipseItem::writePlo(KConfigGroup* plo) const
{ {
plo->writeEntry("Type", "ELLIPSEITEM"); plo->writeEntry("Type", "ELLIPSEITEM");
DecoItem::writePlo(plo, isVisible()); DecoItem::writePlo(plo, isVisible());
plo->writeEntry("fillstyle", int(m_fillStyle)); plo->writeEntry("fillstyle", int(m_fillStyle));
plo->writeEntry("width", m_width); plo->writeEntry("width", m_width);
plo->writeEntry("height", m_height); plo->writeEntry("height", m_height);
if (m_dir) if (m_dir)
plo->writeEntry("dir", m_dir); plo->writeEntry("dir", m_dir);
plo->writeEntry("symb", int(m_symbol));
} }
void EllipseItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) void EllipseItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
{ {
QGraphicsEllipseItem::mouseReleaseEvent(event); QGraphicsEllipseItem::mouseReleaseEvent(event);
((KplScene*)scene())->updatePos(this); ((KplScene*)scene())->updatePos(this);
} }
void EllipseItem::setProperties() void EllipseItem::setProperties()
{ {
double w = m_matrix.m11() * m_width; double w = m_matrix.m11() * m_width;
double h = qAbs(m_matrix.m22() * m_height); double h = qAbs(m_matrix.m22() * m_height);
setRect(-0.5 * w, -0.5 * h, w, h); setRect(-0.5 * w, -0.5 * h, w, h);
setPos(m_matrix.map(QPointF(m_x0, m_y0))); setPos(m_matrix.map(QPointF(m_x0, m_y0)));
#if QT_VERSION < 0x040600
setTransform(QTransform().rotate(-m_dir));
#else
setRotation(-m_dir); setRotation(-m_dir);
#endif
if (m_fillStyle) { if (m_fillStyle) {
setBrush(createBrush(m_color, m_fillStyle)); setBrush(createBrush(m_color, m_fillStyle));
setPen(Qt::NoPen); setPen(Qt::NoPen);
} else } else
setPen(createPen(this, m_color)); setPen(createPen(this, m_color, DataPen, m_symbol));
} }
 End of changes. 9 change blocks. 
11 lines changed or deleted 10 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS