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

#include <qtextdocument_p.h>

Public Types

enum  Command {
  Inserted = 0, Removed = 1, CharFormatChanged = 2, BlockFormatChanged = 3,
  BlockInserted = 4, BlockRemoved = 5, BlockAdded = 6, BlockDeleted = 7,
  GroupFormatChange = 8, CursorMoved = 9, Custom = 256
}
 
enum  Operation { KeepCursor = 0, MoveCursor = 1 }
 

Public Functions

bool tryMerge (const QTextUndoCommand &other)
 

Public Variables

union {
   int   blockFormat
 
   QAbstractUndoItem *   custom
 
   quint32   length
 
   int   objectIndex
 
}; 
 
uint block_end: 1
 
uint block_padding: 6
 
uint block_part: 1
 
quint16 command
 
int format
 
quint8 operation
 
quint32 pos
 
quint32 revision
 
quint32 strPos
 

Detailed Description

Definition at line 123 of file qtextdocument_p.h.

Enumerations

◆ Command

Enumerator
Inserted 
Removed 
CharFormatChanged 
BlockFormatChanged 
BlockInserted 
BlockRemoved 
BlockAdded 
BlockDeleted 
GroupFormatChange 
CursorMoved 
Custom 

Definition at line 126 of file qtextdocument_p.h.

◆ Operation

Enumerator
KeepCursor 
MoveCursor 

Definition at line 139 of file qtextdocument_p.h.

Functions

◆ tryMerge()

bool QTextUndoCommand::tryMerge ( const QTextUndoCommand other)

Definition at line 145 of file qtextdocument_p.cpp.

Referenced by QTextDocumentPrivate::appendUndoItem().

146 {
147  if (command != other.command)
148  return false;
149 
150  if (command == Inserted
151  && (pos + length == other.pos)
152  && (strPos + length == other.strPos)
153  && format == other.format) {
154 
155  length += other.length;
156  return true;
157  }
158 
159  // removal to the 'right' using 'Delete' key
160  if (command == Removed
161  && pos == other.pos
162  && (strPos + length == other.strPos)
163  && format == other.format) {
164 
165  length += other.length;
166  return true;
167  }
168 
169  // removal to the 'left' using 'Backspace'
170  if (command == Removed
171  && (other.pos + other.length == pos)
172  && (other.strPos + other.length == strPos)
173  && (format == other.format)) {
174 
175  int l = length;
176  (*this) = other;
177 
178  length += l;
179  return true;
180  }
181 
182  return false;
183 }
QFactoryLoader * l

Properties

◆ @290

union { ... }

◆ block_end

uint QTextUndoCommand::block_end

Definition at line 145 of file qtextdocument_p.h.

Referenced by QTextDocumentPrivate::appendUndoItem().

◆ block_padding

uint QTextUndoCommand::block_padding

Definition at line 146 of file qtextdocument_p.h.

◆ block_part

uint QTextUndoCommand::block_part

Definition at line 144 of file qtextdocument_p.h.

Referenced by QTextDocumentPrivate::appendUndoItem().

◆ blockFormat

int QTextUndoCommand::blockFormat

◆ command

quint16 QTextUndoCommand::command

◆ custom

QAbstractUndoItem* QTextUndoCommand::custom

◆ format

int QTextUndoCommand::format

◆ length

quint32 QTextUndoCommand::length

Definition at line 153 of file qtextdocument_p.h.

Referenced by tryMerge(), and QTextDocumentPrivate::undoRedo().

◆ objectIndex

int QTextUndoCommand::objectIndex

Definition at line 155 of file qtextdocument_p.h.

Referenced by QTextDocumentPrivate::undoRedo().

◆ operation

quint8 QTextUndoCommand::operation

◆ pos

quint32 QTextUndoCommand::pos

◆ revision

quint32 QTextUndoCommand::revision

Definition at line 157 of file qtextdocument_p.h.

Referenced by QTextDocumentPrivate::undoRedo().

◆ strPos

quint32 QTextUndoCommand::strPos

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