Go to the documentation of this file.
26void setElementGeometry(
Element *item,
const QRectF &geometry)
28 item->
setPos(geometry.topLeft());
50 m_moveByData = QPointF(dx, dy);
57 m_newGeometry = geometry;
65 qCDebug(KDSME_VIEW) <<
"Invalid item or no operation requested";
71 m_item->setPos(m_item->pos() + m_moveByData);
74 m_oldGeometry = QRectF(m_item->pos(), QSizeF(m_item->width(), m_item->height()));
75 setElementGeometry(m_item.data(), m_newGeometry);
83 qCDebug(KDSME_VIEW) <<
"Invalid item or no operation requested";
89 m_item->setPos(m_item->pos() - m_moveByData);
92 setElementGeometry(m_item.data(), m_oldGeometry);
99 if (other->id() !=
id()) {
104 if (cmd->m_item != m_item || cmd->m_operation !=
m_operation) {
108 m_moveByData += cmd->m_moveByData;
109 m_newGeometry = cmd->m_newGeometry;
113void KDSME::ModifyElementCommand::updateText()
115 const QString itemLabel = m_item ? m_item->label() : tr(
"<Unknown>");
117 switch (m_operation) {
119 setText(tr(
"Moving item %1").arg(itemLabel));
121 case SetGeometryOperation:
122 setText(tr(
"Resizing item %1").arg(itemLabel));
Command(StateModel *model, QUndoCommand *parent=nullptr)
void setPos(const QPointF &pos)
void setWidth(qreal width)
void setHeight(qreal height)
Q_INVOKABLE void moveBy(qreal dx, qreal dy)
ModifyElementCommand(Element *item, QUndoCommand *parent=nullptr)
bool mergeWith(const QUndoCommand *other) override
Q_INVOKABLE void setGeometry(const QRectF &geometry)