mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-17 20:50:34 +01:00
Implemented a primitive decorator, allowing groups of primitives to be easily resized.
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2027 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -391,4 +391,42 @@ class ChangeInformationsCommand : public ElementEditionCommand {
|
||||
/// New information
|
||||
QString new_informations_;
|
||||
};
|
||||
|
||||
/**
|
||||
This command scales primitives when editing an electrical element.
|
||||
*/
|
||||
class ScalePartsCommand : public ElementEditionCommand {
|
||||
// constructors, destructor
|
||||
public:
|
||||
ScalePartsCommand(ElementScene * = 0, QUndoCommand * = 0);
|
||||
virtual ~ScalePartsCommand();
|
||||
private:
|
||||
ScalePartsCommand(const ScalePartsCommand &);
|
||||
|
||||
// methods
|
||||
public:
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
ElementScene *elementScene() const;
|
||||
void setScaledPrimitives(const QList<CustomElementPart *> &);
|
||||
QList<CustomElementPart *> scaledPrimitives() const;
|
||||
void setTransformation(const QRectF &, const QRectF &);
|
||||
QPair<QRectF, QRectF> transformation();
|
||||
|
||||
protected:
|
||||
void scale(const QRectF &before, const QRectF &after);
|
||||
void adjustText();
|
||||
|
||||
// attributes
|
||||
private:
|
||||
/// List of moved primitives
|
||||
QList<CustomElementPart *> scaled_primitives_;
|
||||
/// original rect items fit in
|
||||
QRectF original_rect_;
|
||||
/// new rect items should fit in
|
||||
QRectF new_rect_;
|
||||
/// Prevent the first call to redo()
|
||||
bool first_redo;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user