/*
Copyright 2006-2026 The QElectroTech Team
This file is part of QElectroTech.
QElectroTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
QElectroTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QElectroTech. If not, see .
*/
#ifndef ALIGNSELECTIONCOMMAND_H
#define ALIGNSELECTIONCOMMAND_H
#include
#include
class Diagram;
/**
@brief The AlignSelectionCommand class
Moves each selected item by its own amount, as one undo step.
Symbols, pictures and free texts take part; locked items are left
where they are and counted, so the caller can say so.
*/
class AlignSelectionCommand : public QUndoCommand
{
public:
enum Mode {
SnapToGrid ///< put each item where a drag would have left it
};
AlignSelectionCommand(Diagram *diagram, Mode mode, QUndoCommand *parent = nullptr);
void undo() override;
void redo() override;
bool isValid() const;
int movedCount() const;
int lockedCount() const;
private:
QPointer m_diagram;
int m_locked_count = 0;
};
#endif // ALIGNSELECTIONCOMMAND_H