1 /******************************************************************* 2 3 Part of the Fritzing project - http://fritzing.org 4 Copyright (c) 2007-2014 Fachhochschule Potsdam - http://fh-potsdam.de 5 6 Fritzing is free software: you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation, either version 3 of the License, or 9 (at your option) any later version. 10 11 Fritzing is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with Fritzing. If not, see <http://www.gnu.org/licenses/>. 18 19 ******************************************************************** 20 21 $Revision: 6904 $: 22 $Author: irascibl@gmail.com $: 23 $Date: 2013-02-26 16:26:03 +0100 (Di, 26. Feb 2013) $ 24 25 ********************************************************************/ 26 27 #ifndef NONCONNECTORITEM_H 28 #define NONCONNECTORITEM_H 29 30 #include <QGraphicsRectItem> 31 #include <QGraphicsSceneHoverEvent> 32 #include <QPen> 33 #include <QBrush> 34 #include <QXmlStreamWriter> 35 #include <QPointer> 36 37 #include "../items/itembase.h" 38 39 class NonConnectorItem : public QObject, public QGraphicsRectItem 40 { 41 Q_OBJECT 42 43 public: 44 NonConnectorItem(ItemBase* attachedTo); 45 ~NonConnectorItem(); 46 47 ItemBase * attachedTo(); 48 virtual void setHidden(bool hidden); 49 bool hidden(); 50 virtual void setInactive(bool inactivate); 51 bool inactive(); 52 virtual void setLayerHidden(bool hidden); 53 bool layerHidden(); 54 long attachedToID(); 55 const QString & attachedToTitle(); 56 const QString & attachedToInstanceTitle(); 57 void setCircular(bool); 58 void setRadius(double radius, double strokeWidth); 59 double radius(); 60 double strokeWidth(); 61 void setShape(QPainterPath &); 62 void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 ); 63 QPainterPath shape() const; 64 void setIsPath(bool); 65 bool isPath(); 66 int attachedToItemType(); 67 68 protected: 69 bool doNotPaint(); 70 71 enum Effectively { 72 EffectivelyCircular = 1, 73 EffectivelyRectangular, 74 EffectivelyPolygonal, 75 EffectivelyUnknown 76 }; 77 78 protected: 79 QPointer<ItemBase> m_attachedTo; 80 bool m_hidden; 81 bool m_layerHidden; 82 bool m_inactive; 83 bool m_paint; 84 double m_opacity; 85 bool m_circular; 86 Effectively m_effectively; 87 double m_radius; 88 double m_strokeWidth; 89 double m_negativePenWidth; 90 bool m_negativeOffsetRect; 91 QPainterPath m_shape; 92 bool m_isPath; 93 94 }; 95 96 #endif 97