Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquicktextedit.cpp File Reference
#include "qquicktextedit_p.h"
#include "qquicktextedit_p_p.h"
#include "qquicktextcontrol_p.h"
#include "qquicktextdocument_p.h"
#include "qquickevents_p_p.h"
#include "qquickwindow.h"
#include "qquicktextnode_p.h"
#include "qquicktextnodeengine_p.h"
#include <QtCore/qmath.h>
#include <QtGui/qguiapplication.h>
#include <QtGui/qevent.h>
#include <QtGui/qpainter.h>
#include <QtGui/qtextobject.h>
#include <QtGui/qtexttable.h>
#include <QtQml/qqmlinfo.h>
#include <QtQuick/qsgsimplerectnode.h>
#include <private/qqmlglobal_p.h>
#include <private/qqmlproperty_p.h>
#include <private/qtextengine_p.h>
#include <private/qsgadaptationlayer_p.h>
#include "qquicktextdocument.h"
#include <algorithm>
#include "moc_qquicktextedit_p.cpp"
+ Include dependency graph for qquicktextedit.cpp:

Go to the source code of this file.

Macros

#define QQUICKTEXT_LARGETEXT_THRESHOLD   10000
 

Typedefs

typedef QQuickTextEditPrivate::Node TextNode
 
using TextNodeIterator = QQuickTextEditPrivate::TextNodeIterator
 

Functions

static bool operator< (const TextNode &n1, const TextNode &n2)
 
static void updateNodeTransform (QQuickTextNode *node, const QPointF &topLeft)
 
void resetEngine (QQuickTextNodeEngine *engine, const QColor &textColor, const QColor &selectedTextColor, const QColor &selectionColor)
 
QDebug operator<< (QDebug debug, const QQuickTextEditPrivate::Node &n)
 

Variables

static QT_BEGIN_NAMESPACE const int nodeBreakingSize = 300
 \qmlsignal QtQuick::TextEdit::linkActivated(string link)
 

Macro Definition Documentation

◆ QQUICKTEXT_LARGETEXT_THRESHOLD

#define QQUICKTEXT_LARGETEXT_THRESHOLD   10000

Definition at line 98 of file qquicktextedit.cpp.

Typedef Documentation

◆ TextNode

Definition at line 2059 of file qquicktextedit.cpp.

◆ TextNodeIterator

Function Documentation

◆ operator<()

static bool operator< ( const TextNode n1,
const TextNode n2 
)
inlinestatic

Definition at line 2062 of file qquicktextedit.cpp.

References QQuickTextEditPrivate::Node::startPos().

+ Here is the call graph for this function:

◆ operator<<()

QDebug operator<< ( QDebug  debug,
const QQuickTextEditPrivate::Node n 
)

Definition at line 3381 of file qquicktextedit.cpp.

◆ resetEngine()

void resetEngine ( QQuickTextNodeEngine engine,
const QColor textColor,
const QColor selectedTextColor,
const QColor selectionColor 
)
inline

Definition at line 2093 of file qquicktextedit.cpp.

References engine.

Referenced by QQuickTextEdit::updatePaintNode().

+ Here is the caller graph for this function:

◆ updateNodeTransform()

static void updateNodeTransform ( QQuickTextNode node,
const QPointF topLeft 
)
inlinestatic

Definition at line 2067 of file qquicktextedit.cpp.

References QSGTransformNode::setMatrix(), QMatrix4x4::translate(), QPointF::x(), and QPointF::y().

Referenced by QQuickTextEdit::updatePaintNode().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ nodeBreakingSize

QT_BEGIN_NAMESPACE const int nodeBreakingSize = 300
static

\qmlsignal QtQuick::TextEdit::linkActivated(string link)

\qmltype TextEdit
\instantiates QQuickTextEdit
\inqmlmodule QtQuick
\ingroup qtquick-visual
\ingroup qtquick-input
\inherits Item
\brief Displays multiple lines of editable formatted text.

The TextEdit item displays a block of editable, formatted text.

It can display both plain and rich text. For example:

\qml

TextEdit { width: 240 text: "<b>Hello</b> <i>World!</i>" font.family: "Helvetica" font.pointSize: 20 color: "blue" focus: true } \endqml

Setting \l {Item::focus}{focus} to true enables the TextEdit item to receive keyboard focus.

Note that the TextEdit does not implement scrolling, following the cursor, or other behaviors specific to a look and feel. For example, to add flickable scrolling that follows the cursor:

Flickable {
id: flick
width: 300; height: 200;
contentWidth: edit.contentWidth
contentHeight: edit.contentHeight
clip: true
function ensureVisible(r)
{
if (contentX >= r.x)
contentX = r.x;
else if (contentX+width <= r.x+r.width)
contentX = r.x+r.width-width;
if (contentY >= r.y)
contentY = r.y;
else if (contentY+height <= r.y+r.height)
contentY = r.y+r.height-height;
}
TextEdit {
id: edit
width: flick.width
focus: true
wrapMode: TextEdit.Wrap
onCursorRectangleChanged: flick.ensureVisible(cursorRectangle)
}
}

A particular look and feel might use smooth scrolling (eg. using SmoothedAnimation), might have a visible scrollbar, or a scrollbar that fades in to show location, etc.

Clipboard support is provided by the cut(), copy(), and paste() functions. Text can be selected by mouse in the usual way, unless \l selectByMouse is set to false; and by keyboard with the {Shift+arrow} key combinations, unless \l selectByKeyboard is set to false. To select text programmatically, you can set the \l selectionStart and \l selectionEnd properties, or use \l selectAll() or \l selectWord().

You can translate between cursor positions (characters from the start of the document) and pixel points using positionAt() and positionToRectangle().

See also
Text, TextInput

This signal is emitted when the user clicks on a link embedded in the text. The link must be in rich text or HTML format and the link string provides access to the particular link.

Definition at line 95 of file qquicktextedit.cpp.

Referenced by QQuickTextEdit::updatePaintNode().