Files
qelectrotech-source-mirror/sources/qetgraphicsitem/crossrefitem.h
blacksun 6c77a8ae07 cross ref item : grow the size of the cross according to the number of linked elements
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2923 bfdf4180-ca20-0410-9c96-a3a8aa849046
2014-03-13 14:59:40 +00:00

68 lines
1.9 KiB
C++

/*
Copyright 2006-2014 The QElectroTech Team
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 CROSSREFITEM_H
#define CROSSREFITEM_H
#include "qetgraphicsitem/qetgraphicsitem.h"
class element;
/**
* @brief The CrossRefItem class
* This clas provide an item, for show the cross reference, like the contacts linked to a coil.
* The item setpos automaticaly when parent move.
* All slave displayed in cross ref will be updated when folio position change in the project.
* It's the responsability of the parent to informe displayed slave are moved,
* by calling the slot @updateLabel
*/
class CrossRefItem : public QetGraphicsItem
{
Q_OBJECT
//Methods
public:
explicit CrossRefItem(Element *elmt, QetGraphicsItem *parent = 0);
~CrossRefItem();
QRectF boundingRect() const;
signals:
public slots:
void updateLabel();
void autoPos();
protected:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *e);
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *e);
private:
void setUpBoundingRect();
void fillCrossRef(QPainter *painter);
//Attributes
private:
Element *element_; //element to display the cross reference
QRectF bounding_rect_;
QPicture drawing_;
bool b;
};
#endif // CROSSREFITEM_H