7#include <QtWidgets/qtwidgetsglobal.h>
8#include <QtWidgets/qabstractscrollarea.h>
9#include <QtGui/qtextdocument.h>
10#include <QtGui/qtextoption.h>
11#include <QtGui/qtextcursor.h>
12#include <QtGui/qtextformat.h>
26class Q_WIDGETS_EXPORT
QTextEdit :
public QAbstractScrollArea
30 Q_PROPERTY(AutoFormatting autoFormatting READ autoFormatting WRITE setAutoFormatting)
31 Q_PROPERTY(
bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus)
33 Q_PROPERTY(
bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled)
36 Q_PROPERTY(
int lineWrapColumnOrWidth READ lineWrapColumnOrWidth WRITE setLineWrapColumnOrWidth)
37 Q_PROPERTY(
bool readOnly READ isReadOnly WRITE setReadOnly)
38#if QT_CONFIG(textmarkdownreader) && QT_CONFIG(textmarkdownwriter)
41#ifndef QT_NO_TEXTHTMLPARSER
45 Q_PROPERTY(
bool overwriteMode READ overwriteMode WRITE setOverwriteMode)
46 Q_PROPERTY(
qreal tabStopDistance READ tabStopDistance WRITE setTabStopDistance)
47 Q_PROPERTY(
bool acceptRichText READ acceptRichText WRITE setAcceptRichText)
48 Q_PROPERTY(
int cursorWidth READ cursorWidth WRITE setCursorWidth)
49 Q_PROPERTY(Qt::TextInteractionFlags textInteractionFlags READ textInteractionFlags
50 WRITE setTextInteractionFlags)
64 AutoBulletList = 0x00000001,
78 void setPlaceholderText(
const QString &placeholderText);
79 QString placeholderText()
const;
84 bool isReadOnly()
const;
85 void setReadOnly(
bool ro);
87 void setTextInteractionFlags(Qt::TextInteractionFlags
flags);
88 Qt::TextInteractionFlags textInteractionFlags()
const;
90 qreal fontPointSize()
const;
92 int fontWeight()
const;
93 bool fontUnderline()
const;
94 bool fontItalic()
const;
96 QColor textBackgroundColor()
const;
97 QFont currentFont()
const;
105 AutoFormatting autoFormatting()
const;
106 void setAutoFormatting(AutoFormatting features);
108 bool tabChangesFocus()
const;
109 void setTabChangesFocus(
bool b);
117 {
return document()->isUndoRedoEnabled(); }
119 { document()->setUndoRedoEnabled(
enable); }
121 LineWrapMode lineWrapMode()
const;
122 void setLineWrapMode(LineWrapMode
mode);
124 int lineWrapColumnOrWidth()
const;
125 void setLineWrapColumnOrWidth(
int w);
130 bool find(
const QString &exp, QTextDocument::FindFlags options = QTextDocument::FindFlags());
131#if QT_CONFIG(regularexpression)
132 bool find(
const QRegularExpression &exp, QTextDocument::FindFlags options = QTextDocument::FindFlags());
136#ifndef QT_NO_TEXTHTMLPARSER
139#if QT_CONFIG(textmarkdownwriter)
140 QString toMarkdown(QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub)
const;
143 void ensureCursorVisible();
146#ifndef QT_NO_CONTEXTMENU
147 QMenu *createStandardContextMenu();
153 QRect cursorRect()
const;
157 bool overwriteMode()
const;
158 void setOverwriteMode(
bool overwrite);
160 qreal tabStopDistance()
const;
163 int cursorWidth()
const;
164 void setCursorWidth(
int width);
166 bool acceptRichText()
const;
167 void setAcceptRichText(
bool accept);
179 bool canPaste()
const;
187 void setFontPointSize(
qreal s);
188 void setFontFamily(
const QString &fontFamily);
189 void setFontWeight(
int w);
190 void setFontUnderline(
bool b);
191 void setFontItalic(
bool b);
192 void setTextColor(
const QColor &
c);
193 void setTextBackgroundColor(
const QColor &
c);
194 void setCurrentFont(
const QFont &
f);
198#ifndef QT_NO_TEXTHTMLPARSER
201#if QT_CONFIG(textmarkdownreader)
202 void setMarkdown(
const QString &markdown);
206#ifndef QT_NO_CLIPBOARD
219#ifndef QT_NO_TEXTHTMLPARSER
227 void zoomIn(
int range = 1);
228 void zoomOut(
int range = 1);
242 virtual void keyPressEvent(
QKeyEvent *
e)
override;
243 virtual void keyReleaseEvent(
QKeyEvent *
e)
override;
248 virtual void mouseReleaseEvent(
QMouseEvent *
e)
override;
249 virtual void mouseDoubleClickEvent(
QMouseEvent *
e)
override;
250 virtual bool focusNextPrevChild(
bool next)
override;
251#ifndef QT_NO_CONTEXTMENU
254#if QT_CONFIG(draganddrop)
255 virtual void dragEnterEvent(QDragEnterEvent *
e)
override;
256 virtual void dragLeaveEvent(QDragLeaveEvent *
e)
override;
257 virtual void dragMoveEvent(QDragMoveEvent *
e)
override;
258 virtual void dropEvent(QDropEvent *
e)
override;
262 virtual void showEvent(
QShowEvent *)
override;
263 virtual void changeEvent(
QEvent *
e)
override;
264#if QT_CONFIG(wheelevent)
265 virtual void wheelEvent(QWheelEvent *
e)
override;
268 virtual QMimeData *createMimeDataFromSelection()
const;
276 virtual void scrollContentsBy(
int dx,
int dy)
override;
279 void zoomInF(
float range);
The QColor class provides colors based on RGB, HSV or CMYK values.
The QFocusEvent class contains event parameters for widget focus events.
The QKeyEvent class describes a key event.
The QPaintEvent class contains event parameters for paint events.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
\inmodule QtCore \reentrant
The QResizeEvent class contains event parameters for resize events.
The QShowEvent class provides an event that is sent when a widget is shown.
\macro QT_RESTRICTED_CAST_FROM_ASCII
\reentrant \inmodule QtGui
MoveMode
\value MoveAnchor Moves the anchor to the same position as the cursor itself.
MoveOperation
\value NoMove Keep the cursor where it is
\reentrant \inmodule QtGui
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
void cursorPositionChanged()
This signal is emitted whenever the position of the cursor changed.
bool isUndoRedoEnabled() const
void redoAvailable(bool b)
This signal is emitted whenever redo operations become available (available is true) or unavailable (...
LineWrapMode
\value NoWrap \value WidgetWidth \value FixedPixelWidth \value FixedColumnWidth
void setDocumentTitle(const QString &title)
void currentCharFormatChanged(const QTextCharFormat &format)
This signal is emitted if the current character format has changed, for example caused by a change of...
void undoAvailable(bool b)
This signal is emitted whenever undo operations become available (available is true) or unavailable (...
void setUndoRedoEnabled(bool enable)
void copyAvailable(bool b)
This signal is emitted when text is selected or de-selected in the text edit.
void textChanged()
This signal is emitted whenever the document's content changes; for example, when text is inserted or...
AutoFormattingFlag
\value AutoNone Don't do any automatic formatting.
QString documentTitle() const
void selectionChanged()
This signal is emitted whenever the selection changes.
WrapMode
This enum describes how text is wrapped in a document.
void textChanged(const QString &newText)
list append(new Employee("Blackpool", "Stephen"))
Combined button and popup list for selecting options.
static jboolean cut(JNIEnv *, jobject)
static jboolean copy(JNIEnv *, jobject)
static jboolean paste(JNIEnv *, jobject)
static jboolean selectAll(JNIEnv *, jobject)
static QString toPlainText(const QString &text)
#define Q_DECLARE_FLAGS(Flags, Enum)
#define Q_DECLARE_OPERATORS_FOR_FLAGS(Flags)
GLboolean GLboolean GLboolean b
GLfloat GLfloat GLfloat w
[0]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLsizei GLsizei GLfloat distance
GLint GLsizei GLsizei GLenum format
GLsizei GLsizei GLchar * source
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
#define QT_REQUIRE_CONFIG(feature)
label setAlignment(Qt::AlignLeft|Qt::AlignTop)
[0]
insertRed setText("insert red text")
edit textCursor().insertText(text)
[0]
const QByteArray plainText
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent