mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-23 18:50:52 +01:00
Wrap code for better readability
This commit is contained in:
@@ -27,19 +27,25 @@
|
|||||||
@param old_info : old info of element
|
@param old_info : old info of element
|
||||||
@param new_info : new info of element
|
@param new_info : new info of element
|
||||||
*/
|
*/
|
||||||
ChangeElementInformationCommand::ChangeElementInformationCommand(Element *elmt, DiagramContext &old_info, DiagramContext &new_info, QUndoCommand *parent) :
|
ChangeElementInformationCommand::ChangeElementInformationCommand(
|
||||||
|
Element *elmt,
|
||||||
|
DiagramContext &old_info,
|
||||||
|
DiagramContext &new_info,
|
||||||
|
QUndoCommand *parent) :
|
||||||
QUndoCommand (parent),
|
QUndoCommand (parent),
|
||||||
m_element (elmt),
|
m_element (elmt),
|
||||||
m_old_info (old_info),
|
m_old_info (old_info),
|
||||||
m_new_info (new_info)
|
m_new_info (new_info)
|
||||||
{
|
{
|
||||||
setText(QObject::tr("Modifier les informations de l'élément : %1").arg(elmt -> name()));
|
setText(QObject::tr("Modifier les informations de l'élément : %1")
|
||||||
|
.arg(elmt -> name()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChangeElementInformationCommand::mergeWith(const QUndoCommand *other)
|
bool ChangeElementInformationCommand::mergeWith(const QUndoCommand *other)
|
||||||
{
|
{
|
||||||
if (id() != other->id()) return false;
|
if (id() != other->id()) return false;
|
||||||
ChangeElementInformationCommand const *undo = static_cast<const ChangeElementInformationCommand*>(other);
|
ChangeElementInformationCommand const *undo =
|
||||||
|
static_cast<const ChangeElementInformationCommand*>(other);
|
||||||
if (m_element != undo->m_element) return false;
|
if (m_element != undo->m_element) return false;
|
||||||
m_new_info = undo->m_new_info;
|
m_new_info = undo->m_new_info;
|
||||||
return true;
|
return true;
|
||||||
@@ -64,6 +70,7 @@ void ChangeElementInformationCommand::redo() {
|
|||||||
void ChangeElementInformationCommand::updateProjectDB()
|
void ChangeElementInformationCommand::updateProjectDB()
|
||||||
{
|
{
|
||||||
if(m_element->diagram()) {
|
if(m_element->diagram()) {
|
||||||
m_element->diagram()->project()->dataBase()->elementInfoChanged(m_element);
|
m_element->diagram()->project()->dataBase()->elementInfoChanged(
|
||||||
|
m_element);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,7 +30,11 @@ class Element;
|
|||||||
class ChangeElementInformationCommand : public QUndoCommand
|
class ChangeElementInformationCommand : public QUndoCommand
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ChangeElementInformationCommand(Element *elmt, DiagramContext &old_info, DiagramContext &new_info, QUndoCommand *parent = nullptr);
|
ChangeElementInformationCommand(
|
||||||
|
Element *elmt,
|
||||||
|
DiagramContext &old_info,
|
||||||
|
DiagramContext &new_info,
|
||||||
|
QUndoCommand *parent = nullptr);
|
||||||
|
|
||||||
int id() const override {return 1;}
|
int id() const override {return 1;}
|
||||||
bool mergeWith(const QUndoCommand *other) override;
|
bool mergeWith(const QUndoCommand *other) override;
|
||||||
|
|||||||
Reference in New Issue
Block a user