QElectroTech  0.70
Public Member Functions | Private Attributes | List of all members
QPropertyUndoCommand Class Reference

The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can use QPropertyAnimation to animate the change when undo/redo is call To use animation call setAnimated(true). By default animation is disable. Some QVariant date can't be animated and result this command don't work. More...

#include <qpropertyundocommand.h>

Public Member Functions

 QPropertyUndoCommand (QObject *object, const char *property_name, const QVariant &old_value, const QVariant &new_value, QUndoCommand *parent=nullptr)
 QPropertyUndoCommand::QPropertyUndoCommand Default constructor with old and new value This command don't take ownership of . More...
 
 QPropertyUndoCommand (QObject *object, const char *property_name, const QVariant &old_value, QUndoCommand *parent=nullptr)
 QPropertyUndoCommand::QPropertyUndoCommand Default constructor with old value. Call setNewValue to setup the new value of the edited QObject This command don't take ownership of . More...
 
 QPropertyUndoCommand (const QPropertyUndoCommand *other)
 
void setNewValue (const QVariant &new_value)
 QPropertyUndoCommand::setNewValue Set the new value of the property (set with redo) to . More...
 
void enableAnimation (bool animate=true)
 QPropertyUndoCommand::enableAnimation True to enable animation. More...
 
void setAnimated (bool animate=true, bool first_time=true)
 QPropertyUndoCommand::setAnimated. More...
 
int id () const override
 
bool mergeWith (const QUndoCommand *other) override
 QPropertyUndoCommand::mergeWith Try to merge this command with other command. More...
 
void redo () override
 QPropertyUndoCommand::redo Redo this command. More...
 
void undo () override
 QPropertyUndoCommand::undo Undo this command. More...
 

Private Attributes

QObject * m_object = nullptr
 
const char * m_property_name
 
QVariant m_old_value
 
QVariant m_new_value
 
bool m_animate = false
 
bool m_first_time = true
 

Detailed Description

The QPropertyUndoCommand class This undo command manage QProperty of a QObject. This undo command can use QPropertyAnimation to animate the change when undo/redo is call To use animation call setAnimated(true). By default animation is disable. Some QVariant date can't be animated and result this command don't work.

Definition at line 33 of file qpropertyundocommand.h.

Constructor & Destructor Documentation

◆ QPropertyUndoCommand() [1/3]

QPropertyUndoCommand::QPropertyUndoCommand ( QObject *  object,
const char *  property_name,
const QVariant &  old_value,
const QVariant &  new_value,
QUndoCommand *  parent = nullptr 
)

QPropertyUndoCommand::QPropertyUndoCommand Default constructor with old and new value This command don't take ownership of .

Parameters
object
old_value
new_value

Definition at line 29 of file qpropertyundocommand.cpp.

◆ QPropertyUndoCommand() [2/3]

QPropertyUndoCommand::QPropertyUndoCommand ( QObject *  object,
const char *  property_name,
const QVariant &  old_value,
QUndoCommand *  parent = nullptr 
)

QPropertyUndoCommand::QPropertyUndoCommand Default constructor with old value. Call setNewValue to setup the new value of the edited QObject This command don't take ownership of .

Parameters
object
old_value
parent

Definition at line 46 of file qpropertyundocommand.cpp.

◆ QPropertyUndoCommand() [3/3]

QPropertyUndoCommand::QPropertyUndoCommand ( const QPropertyUndoCommand other)

Member Function Documentation

◆ enableAnimation()

void QPropertyUndoCommand::enableAnimation ( bool  animate = true)

◆ id()

int QPropertyUndoCommand::id ( ) const
inlineoverride

Definition at line 44 of file qpropertyundocommand.h.

◆ mergeWith()

bool QPropertyUndoCommand::mergeWith ( const QUndoCommand *  other)
override

QPropertyUndoCommand::mergeWith Try to merge this command with other command.

Parameters
other
Returns
true if was merged, else false

Definition at line 100 of file qpropertyundocommand.cpp.

References m_new_value, m_object, m_property_name, and undo().

◆ redo()

void QPropertyUndoCommand::redo ( )
override

◆ setAnimated()

void QPropertyUndoCommand::setAnimated ( bool  animate = true,
bool  first_time = true 
)

QPropertyUndoCommand::setAnimated.

Parameters
animate= true for animate this undo
first_time= if true, the first animation is done at the first call of redo
if false, the first animation is done at the second call of redo.

Definition at line 88 of file qpropertyundocommand.cpp.

References m_animate, and m_first_time.

Referenced by IndiTextPropertiesWidget::associatedUndo(), RectangleEditor::editingFinished(), PartRectangle::handlerMouseReleaseEvent(), QetShapeItem::handlerMouseReleaseEvent(), DynamicElementTextModel::undoForEditedGroup(), and DynamicElementTextModel::undoForEditedText().

◆ setNewValue()

void QPropertyUndoCommand::setNewValue ( const QVariant &  new_value)

QPropertyUndoCommand::setNewValue Set the new value of the property (set with redo) to .

Parameters
new_value

Definition at line 69 of file qpropertyundocommand.cpp.

References m_new_value.

Referenced by PartEllipse::handlerMouseReleaseEvent(), PartArc::handlerMouseReleaseEvent(), PartPolygon::handlerMouseReleaseEvent(), and PartLine::handlerMouseReleaseEvent().

◆ undo()

void QPropertyUndoCommand::undo ( )
override

QPropertyUndoCommand::undo Undo this command.

Definition at line 138 of file qpropertyundocommand.cpp.

References m_animate, m_new_value, m_object, m_old_value, and m_property_name.

Referenced by mergeWith().

Member Data Documentation

◆ m_animate

bool QPropertyUndoCommand::m_animate = false
private

Definition at line 53 of file qpropertyundocommand.h.

Referenced by enableAnimation(), QPropertyUndoCommand(), redo(), setAnimated(), and undo().

◆ m_first_time

bool QPropertyUndoCommand::m_first_time = true
private

Definition at line 54 of file qpropertyundocommand.h.

Referenced by QPropertyUndoCommand(), redo(), and setAnimated().

◆ m_new_value

QVariant QPropertyUndoCommand::m_new_value
private

Definition at line 52 of file qpropertyundocommand.h.

Referenced by mergeWith(), QPropertyUndoCommand(), redo(), setNewValue(), and undo().

◆ m_object

QObject* QPropertyUndoCommand::m_object = nullptr
private

Definition at line 50 of file qpropertyundocommand.h.

Referenced by mergeWith(), QPropertyUndoCommand(), redo(), and undo().

◆ m_old_value

QVariant QPropertyUndoCommand::m_old_value
private

Definition at line 52 of file qpropertyundocommand.h.

Referenced by QPropertyUndoCommand(), redo(), and undo().

◆ m_property_name

const char* QPropertyUndoCommand::m_property_name
private

Definition at line 51 of file qpropertyundocommand.h.

Referenced by mergeWith(), QPropertyUndoCommand(), redo(), and undo().


The documentation for this class was generated from the following files: