2010-04-18 17:59:54 +00:00
|
|
|
/*
|
2014-01-29 18:37:45 +00:00
|
|
|
Copyright 2006-2014 The QElectroTech Team
|
2010-04-18 17:59:54 +00:00
|
|
|
This file is part of QElectroTech.
|
|
|
|
|
|
|
|
QElectroTech is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
QElectroTech 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 General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with QElectroTech. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#ifndef CONDUCTOR_TEXT_ITEM_H
|
|
|
|
#define CONDUCTOR_TEXT_ITEM_H
|
|
|
|
#include "diagramtextitem.h"
|
|
|
|
class Conductor;
|
|
|
|
/**
|
2012-11-09 21:09:24 +00:00
|
|
|
This class represents a text item attached to a parent conductor.
|
|
|
|
It may be moved and edited by users.
|
|
|
|
It may also be rotated to any angle.
|
|
|
|
Its movements are however limited to a particular distance around its
|
|
|
|
parent conductor.
|
2010-04-18 17:59:54 +00:00
|
|
|
*/
|
|
|
|
class ConductorTextItem : public DiagramTextItem {
|
|
|
|
Q_OBJECT
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// constructors, destructor
|
2010-04-18 17:59:54 +00:00
|
|
|
public:
|
|
|
|
ConductorTextItem(Conductor * = 0, Diagram * = 0);
|
|
|
|
ConductorTextItem(const QString &, Conductor * = 0, Diagram * = 0);
|
|
|
|
virtual ~ConductorTextItem();
|
|
|
|
private:
|
|
|
|
ConductorTextItem(const ConductorTextItem &);
|
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// attributes
|
2010-04-18 17:59:54 +00:00
|
|
|
public:
|
|
|
|
enum { Type = UserType + 1006 };
|
|
|
|
Conductor *parentConductor() const;
|
|
|
|
virtual void fromXml(const QDomElement &);
|
2014-11-14 13:06:24 +00:00
|
|
|
virtual void toXml (QDomElement &xml) const;
|
2010-04-18 17:59:54 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// methods
|
2010-04-18 17:59:54 +00:00
|
|
|
public:
|
|
|
|
virtual int type() const { return Type; }
|
2010-05-08 21:24:43 +00:00
|
|
|
virtual bool wasMovedByUser() const;
|
2013-06-09 19:09:27 +00:00
|
|
|
virtual bool wasRotateByUser() const;
|
2010-05-08 21:24:43 +00:00
|
|
|
virtual void forceMovedByUser(bool);
|
2013-06-09 19:09:27 +00:00
|
|
|
virtual void forceRotateByUser(bool);
|
2010-05-08 21:24:43 +00:00
|
|
|
|
|
|
|
protected:
|
2014-10-18 12:25:16 +00:00
|
|
|
virtual void mousePressEvent (QGraphicsSceneMouseEvent *event);
|
|
|
|
virtual void mouseMoveEvent (QGraphicsSceneMouseEvent *event);
|
|
|
|
virtual void mouseReleaseEvent (QGraphicsSceneMouseEvent *event);
|
2010-04-18 17:59:54 +00:00
|
|
|
|
2012-11-09 21:09:24 +00:00
|
|
|
// attributes
|
2010-04-18 17:59:54 +00:00
|
|
|
private:
|
|
|
|
Conductor *parent_conductor_;
|
2010-05-08 21:24:43 +00:00
|
|
|
bool moved_by_user_;
|
2013-06-09 19:09:27 +00:00
|
|
|
bool rotate_by_user_;
|
2010-05-08 21:24:43 +00:00
|
|
|
QPointF before_mov_pos_;
|
2010-04-18 17:59:54 +00:00
|
|
|
};
|
|
|
|
#endif
|