QElectroTech 0.200.1-dev
Loading...
Searching...
No Matches
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.
 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.
 QPropertyUndoCommand (const QPropertyUndoCommand *other)
 QPropertyUndoCommand::QPropertyUndoCommand.
void setNewValue (const QVariant &new_value)
 QPropertyUndoCommand::setNewValue Set the new value of the property (set with redo) to new_value.
void enableAnimation (bool animate=true)
 QPropertyUndoCommand::enableAnimation True to enable animation.
void setAnimated (bool animate=true, bool first_time=true)
 QPropertyUndoCommand::setAnimated.
int id () const override
bool mergeWith (const QUndoCommand *other) override
 QPropertyUndoCommand::mergeWith Try to merge this command with other command.
void redo () override
 QPropertyUndoCommand::redo Redo this command.
void undo () override
 QPropertyUndoCommand::undo Undo this command.

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

◆ 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)

QPropertyUndoCommand::QPropertyUndoCommand.

Parameters
other
Here is the call graph for this function:

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. The same rule applies to undo, tracked independently: redo() always runs before the first undo() (QUndoStack::push() calls redo() immediately), so by the time undo() can run at all, redo()'s own m_first_time has already flipped true. Sharing that flag would leave undo() with no instant path ever reachable in practice – reusing it is not actually symmetric, it just looks like it is. m_undo_first_time gives undo() the same one-time grace period redo() has, on its own first call instead of redo's.
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

◆ 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

◆ m_undo_first_time

bool QPropertyUndoCommand::m_undo_first_time = true
private

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