30 #include <QGraphicsItem> 40 for (QGraphicsItem *item :
m_diagram->selectedItems())
45 m_undo <<
new QPropertyUndoCommand(item->toGraphicsObject(),
"rotation", QVariant(item->rotation()), QVariant(item->rotation()+angle),
this);
49 m_cond_text << static_cast<ConductorTextItem *>(item);
50 m_undo <<
new QPropertyUndoCommand(item->toGraphicsObject(),
"rotation", QVariant(item->rotation()), QVariant(item->rotation()+angle),
this);
54 m_undo <<
new QPropertyUndoCommand(item->toGraphicsObject(),
"rotation", QVariant(item->rotation()), QVariant(item->rotation()+angle),
this);
58 if(item->parentItem() && !item->parentItem()->isSelected())
59 m_undo <<
new QPropertyUndoCommand(item->toGraphicsObject(),
"rotation", QVariant(item->rotation()), QVariant(item->rotation()+angle),
this);
62 case QGraphicsItemGroup::Type:
65 if(grp->parentElement() && !grp->parentElement()->isSelected())
70 m_undo <<
new QPropertyUndoCommand(item->toGraphicsObject(),
"rotation", QVariant(item->rotation()), QVariant(item->rotation()+angle),
this);
78 undo->setAnimated(
true,
false);
90 for(
const QPointer<ConductorTextItem>& cti :
m_cond_text)
93 if(!cti->wasRotateByUser())
94 cti->parentConductor()->calculateTextItemPosition();
104 QUndoCommand::redo();
106 for(
const QPointer<ConductorTextItem>& cti :
m_cond_text)
109 cti->forceRotateByUser(
true);
The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can...
void redo() override
RotateSelectionCommand::redo.
QList< QPropertyUndoCommand * > m_undo
bool isReadOnly() const
Diagram::isReadOnly.
bool isValid()
RotateSelectionCommand::isValid.
RotateSelectionCommand(Diagram *diagram, qreal angle=90, QUndoCommand *parent=nullptr)
QList< QPointer< ConductorTextItem > > m_cond_text
The ElementTextItemGroup class This class represent a group of element text Texts in the group can be...
QHash< ConductorTextItem *, bool > m_rotate_by_user
void undo() override
RotateSelectionCommand::undo.