Qt 4.8
Macros | Functions
qtextdocument_p.cpp File Reference
#include <private/qtools_p.h>
#include <qdebug.h>
#include "qtextdocument_p.h"
#include "qtextdocument.h"
#include <qtextformat.h>
#include "qtextformat_p.h"
#include "qtextobject_p.h"
#include "qtextcursor.h"
#include "qtextimagehandler_p.h"
#include "qtextcursor_p.h"
#include "qtextdocumentlayout_p.h"
#include "qtexttable.h"
#include "qtextengine_p.h"
#include <stdlib.h>

Go to the source code of this file.

Macros

#define PMDEBUG   if(0) qDebug
 
#define QT_INIT_TEXTUNDOCOMMAND(c, a1, a2, a3, a4, a5, a6, a7, a8)   QTextUndoCommand c = { a1, a2, 0, 0, quint8(a3), a4, quint32(a5), quint32(a6), { int(a7) }, quint32(a8) }
 

Functions

static QTextFramefindChildFrame (QTextFrame *f, int pos)
 
static bool isAncestorFrame (QTextFrame *possibleAncestor, QTextFrame *child)
 
static bool isValidBlockSeparator (const QChar &ch)
 
static bool noBlockInString (const QString &str)
 

Macro Definition Documentation

◆ PMDEBUG

#define PMDEBUG   if(0) qDebug

◆ QT_INIT_TEXTUNDOCOMMAND

#define QT_INIT_TEXTUNDOCOMMAND (   c,
  a1,
  a2,
  a3,
  a4,
  a5,
  a6,
  a7,
  a8 
)    QTextUndoCommand c = { a1, a2, 0, 0, quint8(a3), a4, quint32(a5), quint32(a6), { int(a7) }, quint32(a8) }

Function Documentation

◆ findChildFrame()

static QTextFrame* findChildFrame ( QTextFrame f,
int  pos 
)
static

Definition at line 1423 of file qtextdocument_p.cpp.

Referenced by QTextDocumentPrivate::frameAt().

1424 {
1425  /* Binary search for frame at pos */
1426  const QList<QTextFrame *> children = f->childFrames();
1427  int first = 0;
1428  int last = children.size() - 1;
1429  while (first <= last) {
1430  int mid = (first + last) / 2;
1431  QTextFrame *c = children.at(mid);
1432  if (pos > c->lastPosition())
1433  first = mid + 1;
1434  else if (pos < c->firstPosition())
1435  last = mid - 1;
1436  else
1437  return c;
1438  }
1439  return 0;
1440 }
unsigned char c[8]
Definition: qnumeric_p.h:62
The QTextFrame class represents a frame in a QTextDocument.
Definition: qtextobject.h:122
int lastPosition() const
Returns the last document position inside the frame.
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
QList< QTextFrame * > childFrames() const
Returns a (possibly empty) list of the frame&#39;s child frames.
int size() const
Returns the number of items in the list.
Definition: qlist.h:137
The QList class is a template class that provides lists.
Definition: qdatastream.h:62

◆ isAncestorFrame()

static bool isAncestorFrame ( QTextFrame possibleAncestor,
QTextFrame child 
)
static

Definition at line 567 of file qtextdocument_p.cpp.

Referenced by QTextDocumentPrivate::move().

568 {
569  while (child) {
570  if (child == possibleAncestor)
571  return true;
572  child = child->parentFrame();
573  }
574  return false;
575 }
QTextFrame * parentFrame() const
Returns the frame&#39;s parent frame.

◆ isValidBlockSeparator()

static bool isValidBlockSeparator ( const QChar ch)
static

◆ noBlockInString()

static bool noBlockInString ( const QString str)
static

Definition at line 137 of file qtextdocument_p.cpp.

Referenced by QTextDocumentPrivate::insert(), QTextDocumentPrivate::insert_string(), QTextDocumentPrivate::move(), and QTextDocumentPrivate::remove_string().

138 {
141  && !str.contains(QTextEndOfFrame);
142 }
QBool contains(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.h:904
#define QTextBeginningOfFrame
#define QTextEndOfFrame