30 m_shape_type (shape_type),
31 m_shape_item (nullptr),
32 m_help_horiz (nullptr),
33 m_help_verti (nullptr)
52 foreach (QGraphicsView *v,
m_diagram->views())
53 v->setContextMenuPolicy(Qt::DefaultContextMenu);
67 QPointF pos =
event->scenePos();
68 if (event->modifiers() != Qt::ControlModifier) {
73 if (event->button() == Qt::LeftButton)
80 event->setAccepted(
true);
100 event->setAccepted(
true);
104 if (event->button() == Qt::RightButton) {
105 event->setAccepted(
true);
120 QPointF pos =
event->scenePos();
121 if (event->modifiers() != Qt::ControlModifier) {
126 event->setAccepted(
true);
137 if (event->button() == Qt::RightButton)
147 QPointF pos =
event->scenePos();
148 if (event->modifiers() != Qt::ControlModifier)
152 event->setAccepted(
true);
160 event->setAccepted(
true);
168 event->setAccepted(
true);
189 if (polygon.first() == polygon.last())
196 event->setAccepted(
true);
202 foreach (QGraphicsView *v,
m_diagram->views())
203 v->setContextMenuPolicy(Qt::NoContextMenu);
218 pen.setCosmetic(
true);
225 m_help_horiz =
new QGraphicsLineItem(rect.topLeft().x(), 0, rect.topRight().x(), 0);
232 m_help_verti =
new QGraphicsLineItem(0, rect.topLeft().y(), 0, rect.bottomLeft().y());
QetShapeItem::ShapeType m_shape_type
DiagramEventAddShape(Diagram *diagram, QetShapeItem::ShapeType shape_type)
DiagramEventAddShape::DiagramEventAddShape Default constructor.
void removePoints(int number=1)
QetShapeItem::removePoints Number of point to remove on the polygon If is superior to number of poly...
QetShapeItem * m_shape_item
QRectF insideBorderRect() const
BorderTitleBlock::insideBorderRect.
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override
DiagramEventAddShape::mouseDoubleClickEvent Action when mouse button is double clicked.
bool isReadOnly() const
Diagram::isReadOnly.
The AddItemCommand class This command add an item in a diagram The item to add is template...
QGraphicsLineItem * m_help_verti
void updateHelpCross(const QPointF &p)
DiagramEventAddShape::updateHelpCross Create and update the position of the cross to help user for dr...
void setP2(const QPointF &P2)
QetShapeItem::setP2 Set the second point of this item. If this item is a polyline, the last point of the polyline is replaced by P2.
virtual void removeItem(QGraphicsItem *item)
Diagram::removeItem Réimplemented from QGraphicsScene::removeItem(QGraphicsItem *item) Do some specif...
void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override
DiagramEventAddShape::mouseMoveEvent Action when mouse move.
int pointsCount() const
QetShapeItem::pointCount.
~DiagramEventAddShape() override
DiagramEventAddShape::~DiagramEventAddShape.
void setClosed(bool close)
QetShapeItem::setClosed Close this item, have effect only if this item is a polygon.
bool setRect(const QRectF &rect)
QetShapeItem::setRect Set this item geometry to rect (only available if shape is a rectangle or an el...
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override
DiagramEventAddShape::mouseReleaseEvent Action when mouse button is released.
The QetShapeItem class this class is used to draw a basic shape (line, rectangle, ellipse) into a dia...
static QColor background_color
background color of diagram
static QPointF snapToGrid(const QPointF &p)
Diagram::snapToGrid Return a nearest snap point of p.
The DiagramEventInterface class isRunning() return true if action is running (do something). By default return false.
QGraphicsLineItem * m_help_horiz
ShapeType shapeType() const
virtual void addItem(QGraphicsItem *item)
Diagram::addItem Réimplemented from QGraphicsScene::addItem(QGraphicsItem *item) Do some specific ope...
BorderTitleBlock border_and_titleblock
Diagram dimensions and title block.
void mousePressEvent(QGraphicsSceneMouseEvent *event) override
DiagramEventAddShape::mousePressEvent Action when mouse is pressed.
void setNextPoint(QPointF P)
QetShapeItem::setNextPoint Add a new point to the curent polygon.