mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-09-13 20:23:04 +02:00
Wrap code for better readability
This commit is contained in:
parent
8a484ef901
commit
8144e9b21b
@ -27,19 +27,25 @@
|
||||
@param old_info : old 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),
|
||||
m_element (elmt),
|
||||
m_old_info (old_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)
|
||||
{
|
||||
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;
|
||||
m_new_info = undo->m_new_info;
|
||||
return true;
|
||||
@ -64,6 +70,7 @@ void ChangeElementInformationCommand::redo() {
|
||||
void ChangeElementInformationCommand::updateProjectDB()
|
||||
{
|
||||
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
|
||||
{
|
||||
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;}
|
||||
bool mergeWith(const QUndoCommand *other) override;
|
||||
|
Loading…
x
Reference in New Issue
Block a user