Qt 4.8
Public Functions | Public Variables | List of all members
QUndoStackPrivate Class Reference

#include <qundostack_p.h>

Inheritance diagram for QUndoStackPrivate:
QObjectPrivate QObjectData

Public Functions

bool checkUndoLimit ()
 If the number of commands on the stack exceedes the undo limit, deletes commands from the bottom of the stack. More...
 
 QUndoStackPrivate ()
 
void setIndex (int idx, bool clean)
 Sets the current index to idx, emitting appropriate signals. More...
 
- Public Functions inherited from QObjectPrivate
void _q_reregisterTimers (void *pointer)
 
void addConnection (int signal, Connection *c)
 
void cleanConnectionLists ()
 
void connectNotify (const char *signal)
 
void deleteChildren ()
 
void disconnectNotify (const char *signal)
 
bool isSender (const QObject *receiver, const char *signal) const
 
bool isSignalConnected (uint signalIdx) const
 Returns true if the signal with index signal_index from object sender is connected. More...
 
void moveToThread_helper ()
 
 QObjectPrivate (int version=QObjectPrivateVersion)
 
QObjectList receiverList (const char *signal) const
 
QObjectList senderList () const
 
void setParent_helper (QObject *)
 
void setThreadData_helper (QThreadData *currentData, QThreadData *targetData)
 
int signalIndex (const char *signalName) const
 Returns the signal index used in the internal connectionLists vector. More...
 
virtual ~QObjectPrivate ()
 
- Public Functions inherited from QObjectData
virtual ~QObjectData ()=0
 

Public Variables

int clean_index
 
QList< QUndoCommand * > command_list
 
QUndoGroupgroup
 
int index
 
QList< QUndoCommand * > macro_stack
 
int undo_limit
 
- Public Variables inherited from QObjectPrivate
union {
   QObject *   currentChildBeingDeleted
 
   QAbstractDeclarativeData *   declarativeData
 
}; 
 
quint32 connectedSignals [2]
 
QObjectConnectionListVectorconnectionLists
 
SendercurrentSender
 
QList< QPointer< QObject > > eventFilters
 
ExtraDataextraData
 
QString objectName
 
Connectionsenders
 
QAtomicPointer< QtSharedPointer::ExternalRefCountData > sharedRefcount
 
QThreadDatathreadData
 
void * unused
 
- Public Variables inherited from QObjectData
uint blockSig: 1
 
QObjectList children
 
uint hasGuards: 1
 
uint inEventHandler: 1
 
uint inThreadChangeEvent: 1
 
uint isWidget: 1
 
QMetaObjectmetaObject
 
uint ownObjectName: 1
 
QObjectparent
 
uint pendTimer: 1
 
int postedEvents
 
QObjectq_ptr
 
uint receiveChildEvents: 1
 
uint sendChildEvents: 1
 
uint unused: 22
 
uint wasDeleted: 1
 

Additional Inherited Members

- Public Types inherited from QObjectPrivate
typedef void(* StaticMetaCallFunction) (QObject *, QMetaObject::Call, int, void **)
 
- Static Public Functions inherited from QObjectPrivate
static void clearGuards (QObject *)
 
static QObjectPrivateget (QObject *o)
 
static void resetCurrentSender (QObject *receiver, Sender *currentSender, Sender *previousSender)
 
static SendersetCurrentSender (QObject *receiver, Sender *sender)
 
static void signalSignature (const QMetaMethod &signal, QVarLengthArray< char > *result)
 

Detailed Description

Definition at line 79 of file qundostack_p.h.

Constructors and Destructors

◆ QUndoStackPrivate()

QUndoStackPrivate::QUndoStackPrivate ( )
inline

Definition at line 83 of file qundostack_p.h.

Functions

◆ checkUndoLimit()

bool QUndoStackPrivate::checkUndoLimit ( )

If the number of commands on the stack exceedes the undo limit, deletes commands from the bottom of the stack.

Warning
This function is not part of the public interface.

Returns true if commands were deleted.

Definition at line 484 of file qundostack.cpp.

485 {
487  return false;
488 
489  int del_count = command_list.count() - undo_limit;
490 
491  for (int i = 0; i < del_count; ++i)
492  delete command_list.takeFirst();
493 
494  index -= del_count;
495  if (clean_index != -1) {
496  if (clean_index < del_count)
497  clean_index = -1; // we've deleted the clean command
498  else
499  clean_index -= del_count;
500  }
501 
502  return true;
503 }
QList< QUndoCommand * > macro_stack
Definition: qundostack_p.h:86
QList< QUndoCommand * > command_list
Definition: qundostack_p.h:85
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
bool isEmpty() const
Returns true if the list contains no items; otherwise returns false.
Definition: qlist.h:152
T takeFirst()
Removes the first item in the list and returns it.
Definition: qlist.h:489

◆ setIndex()

void QUndoStackPrivate::setIndex ( int  idx,
bool  clean 
)

Sets the current index to idx, emitting appropriate signals.

Warning
This function is not part of the public interface. If clean is true, makes idx the clean index as well.

Definition at line 451 of file qundostack.cpp.

452 {
453  Q_Q(QUndoStack);
454 
455  bool was_clean = index == clean_index;
456 
457  if (idx != index) {
458  index = idx;
459  emit q->indexChanged(index);
460  emit q->canUndoChanged(q->canUndo());
461  emit q->undoTextChanged(q->undoText());
462  emit q->canRedoChanged(q->canRedo());
463  emit q->redoTextChanged(q->redoText());
464  }
465 
466  if (clean)
467  clean_index = index;
468 
469  bool is_clean = index == clean_index;
470  if (is_clean != was_clean)
471  emit q->cleanChanged(is_clean);
472 }
#define Q_Q(Class)
Definition: qglobal.h:2483
#define emit
Definition: qobjectdefs.h:76
The QUndoStack class is a stack of QUndoCommand objects.
Definition: qundostack.h:91

Properties

◆ clean_index

int QUndoStackPrivate::clean_index

Definition at line 88 of file qundostack_p.h.

◆ command_list

QList<QUndoCommand*> QUndoStackPrivate::command_list

Definition at line 85 of file qundostack_p.h.

◆ group

QUndoGroup* QUndoStackPrivate::group

Definition at line 89 of file qundostack_p.h.

◆ index

int QUndoStackPrivate::index

Definition at line 87 of file qundostack_p.h.

◆ macro_stack

QList<QUndoCommand*> QUndoStackPrivate::macro_stack

Definition at line 86 of file qundostack_p.h.

◆ undo_limit

int QUndoStackPrivate::undo_limit

Definition at line 90 of file qundostack_p.h.


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