Qt 4.8
Classes | Macros | Functions | Variables
qtextcontrol.cpp File Reference
#include "qtextcontrol_p.h"
#include "qtextcontrol_p_p.h"
#include <qfont.h>
#include <qpainter.h>
#include <qevent.h>
#include <qdebug.h>
#include <qmime.h>
#include <qdrag.h>
#include <qconfig.h>
#include <qclipboard.h>
#include <qmenu.h>
#include <qstyle.h>
#include <qtimer.h>
#include "private/qtextdocumentlayout_p.h"
#include "private/qabstracttextdocumentlayout_p.h"
#include "private/qtextedit_p.h"
#include "qtextdocument.h"
#include "private/qtextdocument_p.h"
#include "qtextlist.h"
#include "private/qtextcontrol_p.h"
#include "qgraphicssceneevent.h"
#include "qprinter.h"
#include "qtextdocumentwriter.h"
#include "private/qtextcursor_p.h"
#include <qtextformat.h>
#include <qdatetime.h>
#include <qbuffer.h>
#include <qapplication.h>
#include <limits.h>
#include <qtexttable.h>
#include <qvariant.h>
#include <qurl.h>
#include <qdesktopservices.h>
#include <qinputcontext.h>
#include <qtooltip.h>
#include <qstyleoption.h>
#include <QtGui/qlineedit.h>
#include <QtGui/qaccessible.h>
#include "private/qapplication_p.h"
#include "private/qshortcutmap_p.h"
#include <qkeysequence.h>
#include "moc_qtextcontrol_p.cpp"

Go to the source code of this file.

Classes

struct  QUnicodeControlCharacter
 

Macros

#define ACCEL_KEY(k)   (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? QLatin1Char('\t') + QString(QKeySequence(k)) : QString())
 
#define NUM_CONTROL_CHARACTERS   10
 

Functions

static QRectF boundingRectOfFloatsInSelection (const QTextCursor &cursor)
 
static QTextLine currentTextLine (const QTextCursor &cursor)
 
static bool cursorPosLessThanLastFramePos (int position, QTextFrame *frame)
 
static bool firstFramePosLessThanCursorPos (QTextFrame *frame, int position)
 

Variables

const struct QUnicodeControlCharacter qt_controlCharacters [NUM_CONTROL_CHARACTERS]
 
bool qt_use_rtl_extensions
 

Macro Definition Documentation

◆ ACCEL_KEY

#define ACCEL_KEY (   k)    (!qApp->d_func()->shortcutMap.hasShortcutForKeySequence(k) ? QLatin1Char('\t') + QString(QKeySequence(k)) : QString())

Definition at line 89 of file qtextcontrol.cpp.

Referenced by QTextControl::createStandardContextMenu().

◆ NUM_CONTROL_CHARACTERS

#define NUM_CONTROL_CHARACTERS   10

Function Documentation

◆ boundingRectOfFloatsInSelection()

static QRectF boundingRectOfFloatsInSelection ( const QTextCursor cursor)
static

Definition at line 1406 of file qtextcontrol.cpp.

Referenced by QTextControl::selectionRect().

1407 {
1408  QRectF r;
1409  QTextFrame *frame = cursor.currentFrame();
1410  const QList<QTextFrame *> children = frame->childFrames();
1411 
1412  const QList<QTextFrame *>::ConstIterator firstFrame = qLowerBound(children.constBegin(), children.constEnd(),
1414  const QList<QTextFrame *>::ConstIterator lastFrame = qUpperBound(children.constBegin(), children.constEnd(),
1416  for (QList<QTextFrame *>::ConstIterator it = firstFrame; it != lastFrame; ++it) {
1417  if ((*it)->frameFormat().position() != QTextFrameFormat::InFlow)
1418  r |= frame->document()->documentLayout()->frameBoundingRect(*it);
1419  }
1420  return r;
1421 }
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qUpperBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
Definition: qalgorithms.h:262
#define it(className, varName)
The QTextFrame class represents a frame in a QTextDocument.
Definition: qtextobject.h:122
static bool cursorPosLessThanLastFramePos(int position, QTextFrame *frame)
int selectionEnd() const
Returns the end of the selection or position() if the cursor doesn&#39;t have a selection.
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the list.
Definition: qlist.h:269
The QList::const_iterator class provides an STL-style const iterator for QList and QQueue...
Definition: qlist.h:228
QTextDocument * document() const
Returns the document this object belongs to.
QTextFrame * currentFrame() const
Returns a pointer to the current frame.
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
static bool firstFramePosLessThanCursorPos(QTextFrame *frame, int position)
virtual QRectF frameBoundingRect(QTextFrame *frame) const =0
Returns the bounding rectangle of frame.
QList< QTextFrame * > childFrames() const
Returns a (possibly empty) list of the frame&#39;s child frames.
Q_OUTOFLINE_TEMPLATE RandomAccessIterator qLowerBound(RandomAccessIterator begin, RandomAccessIterator end, const T &value)
Definition: qalgorithms.h:227
QAbstractTextDocumentLayout * documentLayout() const
Returns the document layout for this document.
int selectionStart() const
Returns the start of the selection or position() if the cursor doesn&#39;t have a selection.
The QList class is a template class that provides lists.
Definition: qdatastream.h:62
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the list...
Definition: qlist.h:272

◆ currentTextLine()

static QTextLine currentTextLine ( const QTextCursor cursor)
static

Definition at line 103 of file qtextcontrol.cpp.

Referenced by QTextControlPrivate::cursorMoveKeyEvent(), QTextControlPrivate::extendWordwiseSelection(), and QTextControlPrivate::mouseDoubleClickEvent().

104 {
105  const QTextBlock block = cursor.block();
106  if (!block.isValid())
107  return QTextLine();
108 
109  const QTextLayout *layout = block.layout();
110  if (!layout)
111  return QTextLine();
112 
113  const int relativePos = cursor.position() - block.position();
114  return layout->lineForTextPosition(relativePos);
115 }
The QTextLine class represents a line of text inside a QTextLayout.
Definition: qtextlayout.h:197
QTextLine lineForTextPosition(int pos) const
Returns the line that contains the cursor position specified by pos.
int position() const
Returns the index of the block&#39;s first character within the document.
const char * layout
The QTextBlock class provides a container for text fragments in a QTextDocument.
Definition: qtextobject.h:199
int position() const
Returns the absolute position of the cursor within the document.
QTextBlock block() const
Returns the block that contains the cursor.
The QTextLayout class is used to lay out and render text.
Definition: qtextlayout.h:105
bool isValid() const
Returns true if this text block is valid; otherwise returns false.
Definition: qtextobject.h:208
QTextLayout * layout() const
Returns the QTextLayout that is used to lay out and display the block&#39;s contents. ...

◆ cursorPosLessThanLastFramePos()

static bool cursorPosLessThanLastFramePos ( int  position,
QTextFrame frame 
)
inlinestatic

Definition at line 1401 of file qtextcontrol.cpp.

Referenced by boundingRectOfFloatsInSelection().

1402 {
1403  return position < frame->lastPosition();
1404 }
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
int lastPosition() const
Returns the last document position inside the frame.

◆ firstFramePosLessThanCursorPos()

static bool firstFramePosLessThanCursorPos ( QTextFrame frame,
int  position 
)
inlinestatic

Definition at line 1396 of file qtextcontrol.cpp.

Referenced by boundingRectOfFloatsInSelection().

1397 {
1398  return frame->firstPosition() < position;
1399 }
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
int firstPosition() const
Returns the first document position inside the frame.

Variable Documentation

◆ qt_controlCharacters

const struct QUnicodeControlCharacter qt_controlCharacters[NUM_CONTROL_CHARACTERS]
Initial value:
= {
{ QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "LRM Left-to-right mark"), 0x200e },
{ QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "RLM Right-to-left mark"), 0x200f },
{ QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "ZWJ Zero width joiner"), 0x200d },
{ QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "ZWNJ Zero width non-joiner"), 0x200c },
{ QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "ZWSP Zero width space"), 0x200b },
{ QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "LRE Start of left-to-right embedding"), 0x202a },
{ QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "RLE Start of right-to-left embedding"), 0x202b },
{ QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "LRO Start of left-to-right override"), 0x202d },
{ QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "RLO Start of right-to-left override"), 0x202e },
{ QT_TRANSLATE_NOOP("QUnicodeControlCharacterMenu", "PDF Pop directional formatting"), 0x202c },
}
#define QT_TRANSLATE_NOOP(scope, x)
Marks the string literal sourceText for dynamic translation in the given context; i...
Definition: qglobal.h:2487

Referenced by QUnicodeControlCharacterMenu::menuActionTriggered(), and QUnicodeControlCharacterMenu::QUnicodeControlCharacterMenu().

◆ qt_use_rtl_extensions

bool qt_use_rtl_extensions

Definition at line 266 of file qapplication_win.cpp.

Referenced by QTextControl::createStandardContextMenu().