8#if QT_CONFIG(textbrowser)
16#if QT_CONFIG(draganddrop)
25#if QT_CONFIG(accessibility)
28#include "private/qtextdocumentlayout_p.h"
30#include "private/qtextdocument_p.h"
32#include "private/qwidgettextcontrol_p.h"
37#include <private/qapplication_p.h>
46#if defined (Q_OS_ANDROID)
78 auto *ed = qobject_cast<QTextEdit *>(
parent());
82 QUrl resolvedName = ed->d_func()->resolveUrl(
name);
83 return ed->loadResource(
type, resolvedName);
90 lineWrap(
QTextEdit::WidgetWidth), lineWrapColumnOrWidth(0),
91 wordWrap(
QTextOption::WrapAtWordBoundaryOrAnywhere), clickCausedFocus(0),
92 textFormat(
Qt::AutoText)
112 cursor.setBlockFormat(blockFmt);
114 cursor.createList(listFmt);
158 hbar->setSingleStep(20);
159 vbar->setSingleStep(20);
162 q->setMouseTracking(
true);
163 q->setAcceptDrops(
true);
194 emit q->cursorPositionChanged();
195#if QT_CONFIG(accessibility)
196 QAccessibleTextCursorEvent
event(
q,
q->textCursor().position());
197 QAccessible::updateAccessibility(&
event);
206 if (block.
isValid() && !
q->isReadOnly()) {
229 moved =
cursor.movePosition(op, moveMode);
230 }
while (moved && distance < viewport->
height());
244#if QT_CONFIG(scrollbar)
253 docSize = tlayout->dynamicDocumentSize().toSize();
254 int percentageDone = tlayout->layoutStatus();
256 if (percentageDone > 0)
259 docSize =
layout->documentSize().toSize();
280 for (
int i = 0;
i < 4; ++
i) {
281 hbar->setRange(0, docSize.
width() - viewportSize.
width());
282 hbar->setPageStep(viewportSize.
width());
284 vbar->setRange(0, docSize.
height() - viewportSize.
height());
285 vbar->setPageStep(viewportSize.
height());
296 _q_showOrHideScrollBars();
298 const QSize oldViewportSize = viewportSize;
299 const QSize oldDocSize = docSize;
303 if (viewportSize.
width() != oldViewportSize.
width())
306 docSize = documentSize(
control);
307 if (viewportSize == oldViewportSize && docSize == oldDocSize)
318 if ((vbar->isVisible() && vbar->maximum() <
rect.bottom())
319 || (hbar->isVisible() && hbar->maximum() <
rect.right()))
321 const int visibleWidth =
viewport->width();
322 const int visibleHeight =
viewport->height();
323 const bool rtl = q_func()->isRightToLeft();
327 hbar->setValue(hbar->maximum() -
rect.x());
329 hbar->setValue(
rect.x());
332 hbar->setValue(hbar->maximum() - (
rect.x() +
rect.width() - visibleWidth));
334 hbar->setValue(
rect.x() +
rect.width() - visibleWidth);
338 vbar->setValue(
rect.y());
340 vbar->setValue(
rect.y() +
rect.height() - visibleHeight);
612 : QAbstractScrollArea(dd,
parent)
646 return d->control->textCursor().charFormat().fontPointSize();
657 return d->control->textCursor().charFormat().fontFamilies().toStringList().value(0,
QString());
668 return d->control->textCursor().charFormat().fontWeight();
680 return d->control->textCursor().charFormat().fontUnderline();
692 return d->control->textCursor().charFormat().fontItalic();
703 return d->control->textCursor().charFormat().foreground().color();
716 const QBrush &
brush =
d->control->textCursor().charFormat().background();
728 return d->control->textCursor().charFormat().font();
744 d->control->setTextCursor(
cursor);
745 d->relayoutDocument();
756 return d->control->textCursor().blockFormat().alignment();
772 d->updateDefaultTextOption();
773 d->relayoutDocument();
779 return d->control->document();
798 return d->placeholderText;
806 if (
d->control->document()->isEmpty())
807 d->viewport->update();
828 d->control->setTextCursor(
cursor);
839 return d->control->textCursor();
865 fmt.setFontPointSize(
s);
881 fmt.setFontWeight(
w);
894 fmt.setFontUnderline(underline);
907 fmt.setFontItalic(italic);
983#ifndef QT_NO_CLIPBOARD
1028 d->control->paste();
1048 d->control->clear();
1060 d->control->selectAll();
1068#ifndef QT_NO_CONTEXTMENU
1076 const bool result = QAbstractScrollArea::event(&ce);
1081 d->sendControlEvent(
e);
1086#ifdef QT_KEYPAD_NAVIGATION
1087 if (
e->type() == QEvent::EnterEditFocus ||
e->type() == QEvent::LeaveEditFocus) {
1088 if (QApplicationPrivate::keypadNavigationEnabled())
1089 d->sendControlEvent(
e);
1092 return QAbstractScrollArea::event(
e);
1101 if (
e->timerId() ==
d->autoScrollTimer.timerId()) {
1102 QRect visible =
d->viewport->rect();
1105 pos =
d->autoScrollDragPos;
1110 pos =
d->viewport->mapFromGlobal(globalPos);
1116 int delta =
qMax(deltaX, deltaY);
1120 int timeout = 4900 / (delta * delta);
1121 d->autoScrollTimer.start(
timeout,
this);
1124 d->vbar->triggerAction(
pos.y() < visible.
center().
y() ?
1128 d->hbar->triggerAction(
pos.x() < visible.
center().
x() ?
1133#ifdef QT_KEYPAD_NAVIGATION
1134 else if (
e->timerId() ==
d->deleteAllTimer.timerId()) {
1135 d->deleteAllTimer.stop();
1159 d->control->setPlainText(
text);
1160 d->preferRichText =
false;
1173 return d->control->toPlainText();
1198#ifndef QT_NO_TEXTHTMLPARSER
1202 d->control->setHtml(
text);
1203 d->preferRichText =
true;
1209 return d->control->toHtml();
1213#if QT_CONFIG(textmarkdownreader) && QT_CONFIG(textmarkdownwriter)
1249#if QT_CONFIG(textmarkdownreader)
1250void QTextEdit::setMarkdown(
const QString &markdown)
1253 d->control->setMarkdown(markdown);
1257#if QT_CONFIG(textmarkdownwriter)
1258QString QTextEdit::toMarkdown(QTextDocument::MarkdownFeatures features)
const
1261 return d->control->toMarkdown(features);
1271#ifdef QT_KEYPAD_NAVIGATION
1274 if (QApplicationPrivate::keypadNavigationEnabled()) {
1277 setEditFocus(!hasEditFocus());
1279 if (!hasEditFocus())
1295 if (!QApplicationPrivate::keypadNavigationEnabled()
1296 || (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus())) {
1302 if (QApplicationPrivate::keypadNavigationEnabled()) {
1304 if (
e->text()[0].isPrint())
1315#ifndef QT_NO_SHORTCUT
1317 Qt::TextInteractionFlags tif =
d->control->textInteractionFlags();
1352 d->sendControlEvent(
e);
1362 if (!
e->isAccepted()) {
1363 QAbstractScrollArea::keyPressEvent(
e);
1373 if (
cursor.atBlockStart()
1377 && (!
cursor.currentList())) {
1379 d->createAutoBulletList();
1385 d->sendControlEvent(
e);
1386#ifdef QT_KEYPAD_NAVIGATION
1387 if (!
e->isAccepted()) {
1391 if (QApplicationPrivate::keypadNavigationEnabled()) {
1399 if (!
e->isAutoRepeat()) {
1400 if (QApplicationPrivate::keypadNavigationEnabled()) {
1402 setEditFocus(
false);
1404 }
else if (!
d->deleteAllTimer.isActive()) {
1406 d->deleteAllTimer.start(750,
this);
1426 d->handleSoftwareInputPanel();
1427#ifdef QT_KEYPAD_NAVIGATION
1428 if (QApplicationPrivate::keypadNavigationEnabled()) {
1430 &&
d->deleteAllTimer.isActive()) {
1431 d->deleteAllTimer.stop();
1438 }
else if (
cursor.atBlockStart() && blockFmt.
indent() > 0) {
1440 cursor.setBlockFormat(blockFmt);
1442 cursor.deletePreviousChar();
1478 && alignmentProperty.
userType() == QMetaType::Bool
1479 && !alignmentProperty.
toBool()) {
1481 d->_q_adjustScrollbars();
1487 &&
e->oldSize().width() !=
e->size().width())
1488 d->relayoutDocument();
1490 d->_q_adjustScrollbars();
1502 tlayout->setFixedColumnWidth(-1);
1510 lastUsedSize =
layout->documentSize().toSize();
1523 if (alignmentProperty.
userType() == QMetaType::Bool && !alignmentProperty.
toBool()) {
1539 usedSize =
layout->documentSize().toSize();
1558 && !vbar->isHidden()
1573 p->translate(-xOffset, -yOffset);
1574 r.translate(xOffset, yOffset);
1617 emit q->currentCharFormatChanged(
fmt);
1632 if (
opt.wrapMode() != oldWrapMode)
1641#ifdef QT_KEYPAD_NAVIGATION
1642 if (QApplicationPrivate::keypadNavigationEnabled() && !hasEditFocus())
1645 d->sendControlEvent(
e);
1655 d->sendControlEvent(
e);
1659 const QRect visible =
d->viewport->rect();
1661 d->autoScrollTimer.stop();
1662 else if (!
d->autoScrollTimer.isActive())
1663 d->autoScrollTimer.start(100,
this);
1672 d->sendControlEvent(
e);
1674 d->autoScrollTimer.stop();
1678 d->handleSoftwareInputPanel(
e->button(),
d->clickCausedFocus);
1679 d->clickCausedFocus = 0;
1687 d->sendControlEvent(
e);
1697 return QAbstractScrollArea::focusNextPrevChild(
next);
1700#ifndef QT_NO_CONTEXTMENU
1719 d->sendControlEvent(
e);
1723#if QT_CONFIG(draganddrop)
1726void QTextEdit::dragEnterEvent(QDragEnterEvent *
e)
1730 d->sendControlEvent(
e);
1735void QTextEdit::dragLeaveEvent(QDragLeaveEvent *
e)
1739 d->autoScrollTimer.stop();
1740 d->sendControlEvent(
e);
1745void QTextEdit::dragMoveEvent(QDragMoveEvent *
e)
1748 d->autoScrollDragPos =
e->position().toPoint();
1749 if (!
d->autoScrollTimer.isActive())
1750 d->autoScrollTimer.start(100,
this);
1751 d->sendControlEvent(
e);
1756void QTextEdit::dropEvent(QDropEvent *
e)
1760 d->autoScrollTimer.stop();
1761 d->sendControlEvent(
e);
1771#ifdef QT_KEYPAD_NAVIGATION
1773 && QApplicationPrivate::keypadNavigationEnabled()
1777 d->sendControlEvent(
e);
1778 const bool emptyEvent =
e->preeditString().isEmpty() &&
e->commitString().isEmpty()
1779 &&
e->attributes().isEmpty();
1790 if (isRightToLeft())
1792 d->viewport->scroll(dx, dy);
1822 case QMetaType::QRectF:
1825 case QMetaType::QPointF:
1828 case QMetaType::QRect:
1831 case QMetaType::QPoint:
1839 switch (
v.userType()) {
1840 case QMetaType::QRectF:
1841 return v.toRectF().translated(
offset);
1842 case QMetaType::QPointF:
1844 case QMetaType::QRect:
1845 return v.toRect().translated(
offset.toPoint());
1846 case QMetaType::QPoint:
1847 return v.toPoint() +
offset.toPoint();
1860 d->clickCausedFocus = 1;
1862 QAbstractScrollArea::focusInEvent(
e);
1863 d->sendControlEvent(
e);
1871 QAbstractScrollArea::focusOutEvent(
e);
1872 d->sendControlEvent(
e);
1880 if (!
d->anchorToScrollToWhenVisible.isEmpty()) {
1882 d->anchorToScrollToWhenVisible.clear();
1883 d->showCursorOnInitialShow =
false;
1884 }
else if (
d->showCursorOnInitialShow) {
1885 d->showCursorOnInitialShow =
false;
1895 QAbstractScrollArea::changeEvent(
e);
1898 d->control->document()->setDefaultFont(
font());
1901 if (!isActiveWindow())
1902 d->autoScrollTimer.stop();
1904 e->setAccepted(isEnabled());
1906 d->sendControlEvent(
e);
1910 d->sendControlEvent(
e);
1916#if QT_CONFIG(wheelevent)
1917void QTextEdit::wheelEvent(QWheelEvent *
e)
1922 float delta =
e->angleDelta().y() / 120.f;
1927 QAbstractScrollArea::wheelEvent(
e);
1932#ifndef QT_NO_CONTEXTMENU
1945 return d->control->createStandardContextMenu(
QPointF(),
this);
1961 return d->control->createStandardContextMenu(
position,
this);
1971 return d->control->cursorForPosition(
d->mapToContents(
pos));
1985 r.translate(-
d->horizontalOffset(),-
d->verticalOffset());
1996 QRect r =
d->control->cursorRect().toRect();
1997 r.translate(-
d->horizontalOffset(),-
d->verticalOffset());
2009 return d->control->anchorAt(
d->mapToContents(
pos));
2030 return d->control->overwriteMode();
2036 d->control->setOverwriteMode(overwrite);
2056 return d->control->document()->defaultTextOption().tabStopDistance();
2066 d->control->document()->setDefaultTextOption(
opt);
2078 return d->control->cursorWidth();
2084 d->control->setCursorWidth(
width);
2101 return d->control->acceptRichText();
2107 d->control->setAcceptRichText(accept);
2142 d->control->setExtraSelections(selections);
2154 return d->control->extraSelections();
2170 return d->control->QWidgetTextControl::createMimeDataFromSelection();
2185 return d->control->QWidgetTextControl::canInsertFromMimeData(
source);
2200 d->control->QWidgetTextControl::insertFromMimeData(
source);
2225#if QT_CONFIG(textbrowser)
2226 if (qobject_cast<QTextBrowser *>(
this))
2232 d->control->setTextInteractionFlags(
flags);
2251 d->control->setTextInteractionFlags(
flags);
2257 return d->control->textInteractionFlags();
2271 d->control->mergeCurrentCharFormat(modifier);
2283 d->control->setCurrentCharFormat(
format);
2292 return d->control->currentCharFormat();
2310 return d->autoFormatting;
2316 d->autoFormatting = features;
2330 d->control->insertPlainText(
text);
2346#ifndef QT_NO_TEXTHTMLPARSER
2350 d->control->insertHtml(
text);
2366 d->anchorToScrollToWhenVisible =
name;
2371 const int newPosition =
qRound(
p.y());
2372 if (
d->vbar->maximum() < newPosition )
2373 d->_q_adjustScrollbars();
2374 d->vbar->setValue(newPosition);
2409 const float newSize =
f.pointSizeF() +
range;
2412 f.setPointSizeF(newSize);
2429 d->control->moveCursor(operation,
mode);
2439 return d->control->canPaste();
2450#ifndef QT_NO_PRINTER
2454 d->control->print(printer);
2470 return d->tabChangesFocus;
2476 d->tabChangesFocus =
b;
2510 if (
d->lineWrap ==
wrap)
2513 d->updateDefaultTextOption();
2514 d->relayoutDocument();
2535 return d->lineWrapColumnOrWidth;
2541 d->lineWrapColumnOrWidth =
w;
2542 d->relayoutDocument();
2563 if (
mode ==
d->wordWrap)
2566 d->updateDefaultTextOption();
2577 return d->control->find(exp, options);
2593#if QT_CONFIG(regularexpression)
2597 return d->control->find(exp, options);
2659#ifndef QT_NO_TEXTHTMLPARSER
2682 const bool atBottom =
isReadOnly() ?
d->verticalOffset() >=
d->vbar->maximum() :
2683 d->control->textCursor().atEnd();
2684 d->control->append(
text);
2686 d->vbar->setValue(
d->vbar->maximum());
2696 d->control->ensureCursorVisible();
2722#include "moc_qtextedit.cpp"
void setPaintDevice(QPaintDevice *device)
Sets the paint device used for rendering the document's layout to the given device.
const QColor & color() const
Returns the brush color.
The QColor class provides colors based on RGB, HSV or CMYK values.
static bool sendEvent(QObject *receiver, QEvent *event)
Sends event event directly to receiver receiver, using the notify() function.
static QPoint pos()
Returns the position of the cursor (hot spot) of the primary screen in global screen coordinates.
virtual void setAccepted(bool accepted)
The QFocusEvent class contains event parameters for widget focus events.
static QInputMethod * inputMethod()
returns the input method.
The QKeyEvent class describes a key event.
void remove(qsizetype i, qsizetype n=1)
QObject * parent() const
Returns a pointer to the parent object.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
QVariant property(const char *name) const
Returns the value of the object's name property.
The QPaintEvent class contains event parameters for paint events.
The QPainter class performs low-level painting on widgets and other paint devices.
const QBrush & placeholderText() const
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr int x() const noexcept
Returns the x coordinate of this point.
constexpr int y() const noexcept
Returns the y coordinate of this point.
\inmodule QtCore\reentrant
QRect toAlignedRect() const noexcept
constexpr QRect toRect() const noexcept
Returns a QRect based on the values of this rectangle.
constexpr qreal top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr bool isValid() const noexcept
Returns true if the rectangle is valid, otherwise returns false.
QRectF intersected(const QRectF &other) const noexcept
\inmodule QtCore\reentrant
constexpr void adjust(int x1, int y1, int x2, int y2) noexcept
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
bool contains(const QRect &r, bool proper=false) const noexcept
This is an overloaded member function, provided for convenience. It differs from the above function o...
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr void translate(int dx, int dy) noexcept
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr QPoint center() const noexcept
Returns the center point of the rectangle.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
\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.
bool isNull() const noexcept
Returns true if both the width and height are 0.0 (ignoring the sign); otherwise returns false.
constexpr QSize toSize() const noexcept
Returns an integer based copy of this size.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
constexpr void setHeight(int h) noexcept
Sets the height to the given height.
constexpr bool isValid() const noexcept
Returns true if both the width and height is equal to or greater than 0; otherwise returns false.
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype size() const
Returns the number of characters in this string.
const QChar at(qsizetype i) const
Returns the character at the given index position in the string.
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
MarkerType marker() const
void setIndent(int indent)
Sets the paragraph's indentation.
int indent() const
Returns the paragraph's indent.
QTextBlockFormat blockFormat() const
Returns the QTextBlockFormat that describes block-specific properties.
bool isValid() const
Returns true if this text block is valid; otherwise returns false.
QString anchorHref() const
Returns the text format's hypertext link, or an empty string if none has been set.
\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
void ensureLayouted(qreal)
QSizeF dynamicDocumentSize() const
\reentrant \inmodule QtGui
bool isEmpty() const
Returns true if the document is empty; otherwise returns false.
void setDefaultTextOption(const QTextOption &option)
QAbstractTextDocumentLayout * documentLayout() const
Returns the document layout for this document.
QSizeF pageSize
the page size that should be used for laying out the document
QTextOption defaultTextOption() const
the default text option will be set on all \l{QTextLayout}s in the document.
void setDefaultFont(const QFont &font)
Sets the default font to use in the document layout.
void setPageSize(const QSizeF &size)
void setUndoRedoEnabled(bool enable)
virtual void insertFromMimeData(const QMimeData *source) override
virtual QMimeData * createMimeDataFromSelection() const override
QVariant loadResource(int type, const QUrl &name) override
virtual bool canInsertFromMimeData(const QMimeData *source) const override
QTextEditControl(QObject *parent)
QWidgetTextControl * control
QTextEdit::LineWrapMode lineWrap
void _q_cursorPositionChanged()
void _q_adjustScrollbars()
void pageUpDown(QTextCursor::MoveOperation op, QTextCursor::MoveMode moveMode)
Qt::CursorShape cursorToRestoreAfterHover
void _q_repaintContents(const QRectF &contentsRect)
int horizontalOffset() const
int lineWrapColumnOrWidth
uint ignoreAutomaticScrollbarAdjustment
void _q_hoveredBlockWithMarkerChanged(const QTextBlock &block)
int verticalOffset() const
void _q_ensureVisible(const QRectF &rect)
void createAutoBulletList()
void _q_currentCharFormatChanged(const QTextCharFormat &format)
uint showCursorOnInitialShow
void paint(QPainter *p, QPaintEvent *e)
void init(const QString &html=QString())
void updateDefaultTextOption()
QTextOption::WrapMode wordWrap
The QTextEdit class provides a widget that is used to edit and display both plain and rich text.
virtual void scrollContentsBy(int dx, int dy) override
\reimp
void ensureCursorVisible()
Ensures that the cursor is visible by scrolling the text edit if necessary.
virtual void paintEvent(QPaintEvent *e) override
This event handler can be reimplemented in a subclass to receive paint events passed in event.
void setCursorWidth(int width)
virtual void resizeEvent(QResizeEvent *e) override
\reimp
void paste()
Pastes the text from the clipboard into the text edit at the current cursor position.
void setTextCursor(const QTextCursor &cursor)
Sets the visible cursor.
virtual void focusInEvent(QFocusEvent *e) override
\reimp
QString placeholderText
the editor placeholder text
void setTabChangesFocus(bool b)
qreal tabStopDistance
the tab stop distance in pixels
void zoomIn(int range=1)
Zooms in on the text by making the base font size range points larger and recalculating all font size...
int lineWrapColumnOrWidth
the position (in pixels or columns depending on the wrap mode) where text will be wrapped
QString fontFamily() const
Returns the font family of the current format.
virtual void showEvent(QShowEvent *) override
\reimp
virtual void mousePressEvent(QMouseEvent *e) override
\reimp
virtual bool focusNextPrevChild(bool next) override
\reimp
LineWrapMode
\value NoWrap \value WidgetWidth \value FixedPixelWidth \value FixedColumnWidth
virtual void mouseReleaseEvent(QMouseEvent *e) override
\reimp
bool find(const QString &exp, QTextDocument::FindFlags options=QTextDocument::FindFlags())
Finds the next occurrence of the string, exp, using the given options.
QVariant inputMethodQuery(Qt::InputMethodQuery property) const override
\reimp
QTextOption::WrapMode wordWrapMode() const
the mode QTextEdit will use when wrapping text by words
void setTextBackgroundColor(const QColor &c)
void setTextColor(const QColor &c)
Sets the text color of the current format to c.
void setLineWrapMode(LineWrapMode mode)
void setFontUnderline(bool b)
If underline is true, sets the current format to underline; otherwise sets the current format to non-...
virtual void contextMenuEvent(QContextMenuEvent *e) override
Shows the standard context menu created with createStandardContextMenu().
QMenu * createStandardContextMenu()
\reimp
void insertHtml(const QString &text)
Convenience slot that inserts text which is assumed to be of html formatting at the current cursor po...
void setReadOnly(bool ro)
void setAutoFormatting(AutoFormatting features)
virtual void inputMethodEvent(QInputMethodEvent *) override
\reimp
void selectAll()
Selects all text.
void append(const QString &text)
Appends a new paragraph with text to the end of the text edit.
void zoomOut(int range=1)
Zooms out on the text by making the base font size range points smaller and recalculating all font si...
QColor textColor() const
Returns the text color of the current format.
void setText(const QString &text)
void setCurrentCharFormat(const QTextCharFormat &format)
Sets the char format that is be used when inserting new text to format by calling QTextCursor::setCha...
Qt::TextInteractionFlags textInteractionFlags
QTextCursor cursorForPosition(const QPoint &pos) const
returns a QTextCursor at position pos (in viewport coordinates).
bool acceptRichText
whether the text edit accepts rich text insertions by the user
void mergeCurrentCharFormat(const QTextCharFormat &modifier)
Merges the properties specified in modifier into the current character format by calling QTextCursor:...
LineWrapMode lineWrapMode
the line wrap mode
void setLineWrapColumnOrWidth(int w)
QTextCharFormat currentCharFormat() const
Returns the char format that is used when inserting new text.
void moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode=QTextCursor::MoveAnchor)
QColor textBackgroundColor() const
bool overwriteMode
whether text entered by the user will overwrite existing text
virtual QMimeData * createMimeDataFromSelection() const
This function returns a new MIME data object to represent the contents of the text edit's current sel...
virtual void doSetTextCursor(const QTextCursor &cursor)
bool tabChangesFocus
whether \uicontrol Tab changes focus or is accepted as input
bool fontUnderline() const
Returns true if the font of the current format is underlined; otherwise returns false.
QTextEdit(QWidget *parent=nullptr)
Constructs an empty QTextEdit with parent parent.
void setExtraSelections(const QList< ExtraSelection > &selections)
\variable QTextEdit::ExtraSelection::cursor A cursor that contains a selection in a QTextDocument
void copy()
Copies any selected text to the clipboard.
AutoFormatting autoFormatting
the enabled set of auto formatting features
void setPlainText(const QString &text)
Changes the text of the text edit to the string text.
virtual void keyReleaseEvent(QKeyEvent *e) override
\reimp
QTextCursor textCursor() const
Returns a copy of the QTextCursor that represents the currently visible cursor.
QRect cursorRect() const
returns a rectangle (in viewport coordinates) that includes the cursor of the text edit.
QString anchorAt(const QPoint &pos) const
Returns the reference of the anchor at position pos, or an empty string if no anchor exists at that p...
void setTextInteractionFlags(Qt::TextInteractionFlags flags)
void clear()
Deletes all the text in the text edit.
bool fontItalic() const
Returns true if the font of the current format is italic; otherwise returns false.
qreal fontPointSize() const
Returns the point size of the font of the current format.
virtual void keyPressEvent(QKeyEvent *e) override
\reimp
void setWordWrapMode(QTextOption::WrapMode policy)
void setCurrentFont(const QFont &f)
Sets the font of the current format to f.
virtual bool canInsertFromMimeData(const QMimeData *source) const
This function returns true if the contents of the MIME data object, specified by source,...
void setAlignment(Qt::Alignment a)
Sets the alignment of the current paragraph to a.
void setPlaceholderText(const QString &placeholderText)
virtual Q_INVOKABLE QVariant loadResource(int type, const QUrl &name)
Loads the resource specified by the given type and name.
void setOverwriteMode(bool overwrite)
virtual void timerEvent(QTimerEvent *e) override
void setFontItalic(bool b)
If italic is true, sets the current format to italic; otherwise sets the current format to non-italic...
virtual ~QTextEdit()
Destructor.
virtual void mouseMoveEvent(QMouseEvent *e) override
\reimp
void setFontPointSize(qreal s)
Sets the point size of the current format to s.
void setFontFamily(const QString &fontFamily)
Sets the font family of the current format to fontFamily.
void setFontWeight(int w)
Sets the font weight of the current format to the given weight, where the value used is in the range ...
QString toPlainText() const
QString QTextEdit::toPlainText() const.
Qt::Alignment alignment() const
Returns the alignment of the current paragraph.
void setAcceptRichText(bool accept)
QFont currentFont() const
Returns the font of the current format.
virtual void insertFromMimeData(const QMimeData *source)
This function inserts the contents of the MIME data object, specified by source, into the text edit a...
void setHtml(const QString &text)
virtual void mouseDoubleClickEvent(QMouseEvent *e) override
\reimp
void insertPlainText(const QString &text)
Convenience slot that inserts text at the current cursor position.
void zoomInF(float range)
void print(QPagedPaintDevice *printer) const
void scrollToAnchor(const QString &name)
Scrolls the text edit so that the anchor with the given name is visible; does nothing if the name is ...
virtual void changeEvent(QEvent *e) override
\reimp
void setDocument(QTextDocument *document)
void setTabStopDistance(qreal distance)
int fontWeight() const
Returns the font weight of the current format.
virtual bool event(QEvent *e) override
QTextDocument * document
the underlying document of the text editor.
void cut()
Copies the selected text to the clipboard and deletes it from the text edit.
virtual void focusOutEvent(QFocusEvent *e) override
\reimp
QList< ExtraSelection > extraSelections() const
void setStyle(Style style)
Sets the list format's style.
void setIndent(int indent)
Sets the list format's indentation.
WrapMode
This enum describes how text is wrapped in a document.
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
QTextCursor textCursor() const
void setHtml(const QString &text)
virtual QMimeData * createMimeDataFromSelection() const
void setTextCursor(const QTextCursor &cursor, bool selectionClipboard=false)
virtual Q_INVOKABLE QVariant loadResource(int type, const QUrl &name)
QRectF cursorRect(const QTextCursor &cursor) const
void drawContents(QPainter *painter, const QRectF &rect=QRectF(), QWidget *widget=nullptr)
virtual void insertFromMimeData(const QMimeData *source)
virtual bool canInsertFromMimeData(const QMimeData *source) const
void setPalette(const QPalette &pal)
QTextDocument * document() const
void textChanged(const QString &newText)
Combined button and popup list for selecting options.
Q_CORE_EXPORT Q_DECL_PURE_FUNCTION bool isRightToLeft(QStringView string) noexcept
@ ImInputItemClipRectangle
@ LinksAccessibleByKeyboard
@ TextSelectableByKeyboard
@ MouseEventNotSynthesized
Q_GUI_EXPORT bool mightBeRichText(const QString &)
Returns true if the string text is likely to be rich text; otherwise returns false.
int qRound(qfloat16 d) noexcept
constexpr const T & qMin(const T &a, const T &b)
constexpr const T & qMax(const T &a, const T &b)
constexpr T qAbs(const T &t)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLboolean GLboolean GLboolean b
GLsizei const GLfloat * v
[13]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLboolean GLboolean GLboolean GLboolean a
[7]
GLbitfield GLuint64 timeout
[4]
GLsizei GLsizei GLfloat distance
GLenum GLuint GLintptr offset
GLint GLsizei GLsizei GLenum format
GLsizei GLsizei GLchar * source
GLdouble GLdouble GLdouble GLdouble q
static QT_BEGIN_NAMESPACE bool shouldEnableInputMethod(QPlainTextEdit *control)
static qreal position(const QQuickItem *item, QQuickAnchors::Anchor anchorLine)
static QT_BEGIN_NAMESPACE QAsn1Element wrap(quint8 type, const QAsn1Element &child)
static QT_BEGIN_NAMESPACE bool shouldEnableInputMethod(QTextEdit *textedit)
QVideoFrameFormat::PixelFormat fmt
view viewport() -> scroll(dx, dy, deviceRect)
app setAttribute(Qt::AA_DontShowIconsInMenus)
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent