QElectroTech  0.8-dev
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>

Inherits QUndoCommand.

Collaboration diagram for QPropertyUndoCommand:
Collaboration graph

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 object. 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 object. More...
 
 QPropertyUndoCommand (const QPropertyUndoCommand *other)
 QPropertyUndoCommand::QPropertyUndoCommand. More...
 
void setNewValue (const QVariant &new_value)
 QPropertyUndoCommand::setNewValue Set the new value of the property (set with redo) to new_value. 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.

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 object.

Parameters
object
property_name
old_value
new_value
parent

◆ 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 object.

Parameters
object
property_name
old_value
parent

◆ QPropertyUndoCommand() [3/3]

QPropertyUndoCommand::QPropertyUndoCommand ( const QPropertyUndoCommand other)

Member Function Documentation

◆ enableAnimation()

void QPropertyUndoCommand::enableAnimation ( bool  animate = true)

QPropertyUndoCommand::enableAnimation True to enable animation.

Parameters
animate
Here is the caller graph for this function:

◆ id()

int QPropertyUndoCommand::id ( ) const
inlineoverride

◆ 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
Here is the call graph for this function:

◆ redo()

void QPropertyUndoCommand::redo ( )
override

QPropertyUndoCommand::redo Redo this command.

◆ 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.
Here is the caller graph for this function:

◆ setNewValue()

void QPropertyUndoCommand::setNewValue ( const QVariant &  new_value)

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

Parameters
new_value
Here is the caller graph for this function:

◆ undo()

void QPropertyUndoCommand::undo ( )
override

QPropertyUndoCommand::undo Undo this command.

Here is the caller graph for this function:

Member Data Documentation

◆ m_animate

bool QPropertyUndoCommand::m_animate = false
private

◆ m_first_time

bool QPropertyUndoCommand::m_first_time = true
private

◆ m_new_value

QVariant QPropertyUndoCommand::m_new_value
private

◆ m_object

QObject* QPropertyUndoCommand::m_object = nullptr
private

◆ m_old_value

QVariant QPropertyUndoCommand::m_old_value
private

◆ m_property_name

const char* QPropertyUndoCommand::m_property_name
private

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