41 lines
1.1 KiB
C++
41 lines
1.1 KiB
C++
#ifndef ITEMPORT_H
|
|
#define ITEMPORT_H
|
|
|
|
#include "graphicsItem/handleRect.h"
|
|
|
|
class ElectricConnectLineItem;
|
|
|
|
class ItemPort : public HandleRect
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
ItemPort(QGraphicsItem *parent,QString uuid = "");
|
|
virtual ~ItemPort();
|
|
|
|
public:
|
|
void setPortPos(PortPos p){_pos = p;}
|
|
PortPos portPos() const {return _pos;}
|
|
void setConnect(ElectricConnectLineItem* ptr){_ptr = ptr;}
|
|
void disConnect(){_ptr = nullptr;}
|
|
bool connected() const {return _ptr == nullptr?false:true;}
|
|
ElectricConnectLineItem* getConnectPtr() const {return _ptr;}
|
|
void setId(const QString& id){_uuid = id;}
|
|
QString getId() {return _uuid;}
|
|
void setName(const QString& str) {_name = str;}
|
|
QString getName() const {return _name;}
|
|
void setSourcePortId(const QString& id) {_sourcePortId = id;}
|
|
QString getSourcePortId() {return _sourcePortId;}
|
|
protected:
|
|
virtual void paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget*) override;
|
|
|
|
private:
|
|
QString _uuid;
|
|
QString _name;
|
|
PortPos _pos;
|
|
ElectricConnectLineItem* _ptr;
|
|
QString _sourcePortId; //被哪个port生成
|
|
};
|
|
|
|
#endif
|