56 for(QGraphicsItem *item : diagram->selectedItems())
63 else if(item->type() == QGraphicsItemGroup::Type)
65 if(dynamic_cast<ElementTextItemGroup *>(item))
92 QPointF current_parent_pos;
93 QPointF button_down_parent_pos;
95 current_parent_pos = qgi->mapToParent(qgi->mapFromScene(event->scenePos()));
96 button_down_parent_pos = qgi->mapToParent(qgi->mapFromScene(event->buttonDownScenePos(Qt::LeftButton)));
98 QPointF new_pos =
m_items_hash.value(qgi) + current_parent_pos - button_down_parent_pos;
99 event->modifiers() == Qt::ControlModifier ? qgi->setPos(new_pos) : qgi->setPos(
Diagram::snapToGrid(new_pos));
118 QUndoCommand *undo =
new QUndoCommand(
undoText());
122 if(QObject *
object = dynamic_cast<QObject *>(qgi))
139 undo_text.append(
QObject::tr(
"Déplacer un texte d'élément"));
145 if(undo_text.isEmpty())
151 undo_text.append(
QObject::tr(
" un groupe de texte"));
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
int beginMovement(Diagram *diagram, QGraphicsItem *driver_item=nullptr)
ElementTextsMover::beginMovement Begin a movement.
void enableAnimation(bool animate=true)
QPropertyUndoCommand::enableAnimation True to enable animation.
QHash< QGraphicsItem *, QPointF > m_items_hash
void continueMovement(QGraphicsSceneMouseEvent *event)
QGraphicsItem * m_movement_driver
static QPointF snapToGrid(const QPointF &p)
Diagram::snapToGrid Return a nearest snap point of p.
ElementTextsMover()
ElementTextsMover::ElementTextsMover.
bool isReady() const
ElementTextsMover::isReady.
void endMovement()
ElementTextsMover::endMovement Finish the movement by pushing an undo command to the parent diagram o...