ICF 3.0.5.47
Technical documentation of ICF Libraries
CGraphicsConnectorItem.h
Go to the documentation of this file.
1/********************************************************************************
2** This file is part of the ICF Framework. Copyright (C) Witold Gantzke & Kirill Lepskiy
3** ICF Framework may be used under the terms of the LGPL License v. 2.1 by the Free Software Foundation.
4********************************************************************************/
5
6#pragma once
7
8
9// Qt includes
10#include <QtCore/QObject>
11#include <QtWidgets/QGraphicsItem>
12
13// ICF includes
15
16
17namespace icmpstr
18{
19
20
21class CComponentSceneItem;
22class CRegistryElementShape;
23
24
26 public QObject,
27 public QGraphicsItem
28{
29 Q_OBJECT
30
31public:
32 typedef QGraphicsItem BaseClass;
33
35 {
36 CF_FACTORY = 0x0001,
37 CF_EMBEDDED =0x0002
38 };
39
46
48 const icmpstr::ISceneProvider& sceneProvider,
49 int connectFlags = 0,
50 QGraphicsItem* parent = nullptr);
51
52 void InitEnds(CRegistryElementShape* sourceShapePtr, CRegistryElementShape* destShapePtr);
53
54 // reimplemented (QGraphicsItem)
55 virtual int type() const;
56 virtual QPainterPath shape() const;
57 virtual bool contains(const QPointF& point) const;
58
59protected:
60 void Adjust();
61
62 // reimplemented (QGraphicsItem)
63 virtual QRectF boundingRect() const;
64 virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
65
66protected Q_SLOTS:
67 void OnSourceRectMoved(const QRectF& rect);
68 void OnDestRectMoved(const QRectF& rect);
69 void OnSourceSelected(bool state);
70 void OnDestSelected(bool state);
71
72private:
73 const icmpstr::ISceneProvider& m_sceneProvider;
74
75 int m_connectFlags;
76
77 QPolygonF m_connectionLine;
78 QPointF m_touchPoint;
79
80 QRectF m_sourceRect;
81 QRectF m_destRect;
82 bool m_isSourceSelected;
83 bool m_isDestSelected;
84};
85
86
87} // namespace icmpstr
88
89
CGraphicsConnectorItem(const icmpstr::ISceneProvider &sceneProvider, int connectFlags=0, QGraphicsItem *parent=nullptr)
void InitEnds(CRegistryElementShape *sourceShapePtr, CRegistryElementShape *destShapePtr)
virtual QPainterPath shape() const
virtual QRectF boundingRect() const
virtual bool contains(const QPointF &point) const
void OnSourceRectMoved(const QRectF &rect)
void OnDestRectMoved(const QRectF &rect)
void OnSourceSelected(bool state)
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Visualization of geometrical registry elements.
Interface for GUI objects managing scene.
This package contains (Qt based) implementations of compositor components.

© Witold Gantzke and Kirill Lepskiy