46 #ifndef QT_NO_TEXTEDIT 57 #include "private/qtextdocumentlayout_p.h" 59 #include "private/qtextdocument_p.h" 61 #include "private/qtextcontrol_p.h" 76 #ifndef QT_NO_TEXTEDIT 110 autoFormatting(
QTextEdit::AutoNone), tabChangesFocus(false),
111 lineWrap(
QTextEdit::WidgetWidth), lineWrapColumnOrWidth(0),
112 wordWrap(
QTextOption::WrapAtWordBoundaryOrAnywhere), clickCausedFocus(0),
180 q->setAcceptDrops(
true);
220 distance +=
qAbs(y - lastY);
223 }
while (moved && distance < viewport->height());
237 #ifndef QT_NO_SCROLLBAR 246 docSize = tlayout->dynamicDocumentSize().toSize();
247 int percentageDone = tlayout->layoutStatus();
249 if (percentageDone > 0)
273 for (
int i = 0; i < 4; ++i) {
286 if (q_func()->isRightToLeft())
291 const QSize oldViewportSize = viewportSize;
292 const QSize oldDocSize = docSize;
296 if (viewportSize.
width() != oldViewportSize.
width())
300 if (viewportSize == oldViewportSize && docSize == oldDocSize)
316 const bool rtl = q_func()->isRightToLeft();
666 return d->control->textCursor().charFormat().fontPointSize();
677 return d->control->textCursor().charFormat().fontFamily();
688 return d->control->textCursor().charFormat().fontWeight();
700 return d->control->textCursor().charFormat().fontUnderline();
712 return d->control->textCursor().charFormat().fontItalic();
723 return d->control->textCursor().charFormat().foreground().color();
739 return d->control->textCursor().charFormat().background().color();
750 return d->control->textCursor().charFormat().font();
766 d->control->setTextCursor(cursor);
777 return d->control->textCursor().blockFormat().alignment();
794 d->control->setDocument(document);
795 d->updateDefaultTextOption();
796 d->relayoutDocument();
807 return d->control->document();
816 d->control->setTextCursor(cursor);
827 return d->control->textCursor();
994 #ifndef QT_NO_CLIPBOARD 1039 d->control->paste();
1054 d->control->clear();
1066 d->control->selectAll();
1074 #ifndef QT_NO_CONTEXTMENU 1087 d->sendControlEvent(e);
1089 #endif // QT_NO_CONTEXTMENU 1090 #ifdef QT_KEYPAD_NAVIGATION 1091 if (e->
type() == QEvent::EnterEditFocus || e->
type() == QEvent::LeaveEditFocus) {
1092 if (QApplication::keypadNavigationEnabled())
1093 d->sendControlEvent(e);
1105 if (e->
timerId() ==
d->autoScrollTimer.timerId()) {
1109 pos =
d->autoScrollDragPos;
1114 pos =
d->viewport->mapFromGlobal(globalPos);
1120 int delta =
qMax(deltaX, deltaY);
1124 int timeout = 4900 / (delta * delta);
1125 d->autoScrollTimer.start(timeout,
this);
1128 d->vbar->triggerAction(pos.
y() < visible.
center().
y() ?
1132 d->hbar->triggerAction(pos.
x() < visible.
center().
x() ?
1137 #ifdef QT_KEYPAD_NAVIGATION 1138 else if (e->
timerId() ==
d->deleteAllTimer.timerId()) {
1139 d->deleteAllTimer.stop();
1159 d->control->setPlainText(text);
1160 d->preferRichText =
false;
1199 #ifndef QT_NO_TEXTHTMLPARSER 1203 d->control->setHtml(text);
1204 d->preferRichText =
true;
1214 #ifdef QT_KEYPAD_NAVIGATION 1217 if (QApplication::keypadNavigationEnabled()) {
1220 setEditFocus(!hasEditFocus());
1222 if (!hasEditFocus())
1238 if (!QApplication::keypadNavigationEnabled()
1239 || (QApplication::keypadNavigationEnabled() && !hasEditFocus())) {
1245 if (QApplication::keypadNavigationEnabled()) {
1247 if (e->
text()[0].isPrint())
1258 #ifndef QT_NO_SHORTCUT 1260 Qt::TextInteractionFlags tif =
d->control->textInteractionFlags();
1295 d->sendControlEvent(e);
1311 #endif // QT_NO_SHORTCUT 1322 d->createAutoBulletList();
1328 d->sendControlEvent(e);
1329 #ifdef QT_KEYPAD_NAVIGATION 1334 if (QApplication::keypadNavigationEnabled()) {
1343 if (QApplication::keypadNavigationEnabled()) {
1345 setEditFocus(
false);
1347 }
else if (!
d->deleteAllTimer.isActive()) {
1349 d->deleteAllTimer.start(750,
this);
1367 #ifdef QT_KEYPAD_NAVIGATION 1369 if (QApplication::keypadNavigationEnabled()) {
1371 &&
d->deleteAllTimer.isActive()) {
1372 d->deleteAllTimer.stop();
1420 && !alignmentProperty.
toBool()) {
1422 d->_q_adjustScrollbars();
1429 d->relayoutDocument();
1431 d->_q_adjustScrollbars();
1443 tlayout->setFixedColumnWidth(-1);
1456 const bool oldIgnoreScrollbarAdjustment = ignoreAutomaticScrollbarAdjustment;
1457 ignoreAutomaticScrollbarAdjustment =
true;
1474 ignoreAutomaticScrollbarAdjustment = oldIgnoreScrollbarAdjustment;
1498 if (lastUsedSize.isValid()
1499 && !vbar->isHidden()
1501 && usedSize.
height() < lastUsedSize.height()
1505 _q_adjustScrollbars();
1510 const int xOffset = horizontalOffset();
1511 const int yOffset = verticalOffset();
1525 control->drawContents(p, r, q_func());
1549 emit q->currentCharFormatChanged(fmt);
1552 emit q->currentFontChanged(fmt.
font());
1578 #ifdef QT_KEYPAD_NAVIGATION 1579 if (QApplication::keypadNavigationEnabled() && !hasEditFocus())
1582 d->sendControlEvent(e);
1592 d->sendControlEvent(e);
1597 d->autoScrollTimer.stop();
1598 else if (!
d->autoScrollTimer.isActive())
1599 d->autoScrollTimer.start(100,
this);
1607 d->sendControlEvent(e);
1608 if (
d->autoScrollTimer.isActive()) {
1609 d->autoScrollTimer.stop();
1613 d->handleSoftwareInputPanel(e->
button(),
d->clickCausedFocus);
1614 d->clickCausedFocus = 0;
1622 d->sendControlEvent(e);
1635 #ifndef QT_NO_CONTEXTMENU 1654 d->sendControlEvent(e);
1656 #endif // QT_NO_CONTEXTMENU 1658 #ifndef QT_NO_DRAGANDDROP 1665 d->sendControlEvent(e);
1674 d->autoScrollTimer.stop();
1675 d->sendControlEvent(e);
1683 d->autoScrollDragPos = e->
pos();
1684 if (!
d->autoScrollTimer.isActive())
1685 d->autoScrollTimer.start(100,
this);
1686 d->sendControlEvent(e);
1695 d->autoScrollTimer.stop();
1696 d->sendControlEvent(e);
1699 #endif // QT_NO_DRAGANDDROP 1706 #ifdef QT_KEYPAD_NAVIGATION 1708 && QApplication::keypadNavigationEnabled()
1712 d->sendControlEvent(e);
1723 d->viewport->scroll(dx, dy);
1731 QVariant v =
d->control->inputMethodQuery(property);
1732 const QPoint offset(-
d->horizontalOffset(), -
d->verticalOffset());
1750 d->clickCausedFocus = 1;
1753 d->sendControlEvent(e);
1762 d->sendControlEvent(e);
1770 if (!
d->anchorToScrollToWhenVisible.isEmpty()) {
1772 d->anchorToScrollToWhenVisible.clear();
1773 d->showCursorOnInitialShow =
false;
1774 }
else if (
d->showCursorOnInitialShow) {
1775 d->showCursorOnInitialShow =
false;
1788 d->control->document()->setDefaultFont(
font());
1791 d->autoScrollTimer.stop();
1795 d->sendControlEvent(e);
1799 d->sendControlEvent(e);
1805 #ifndef QT_NO_WHEELEVENT 1811 const int delta = e->
delta();
1824 #ifndef QT_NO_CONTEXTMENU 1837 return d->control->createStandardContextMenu(
QPointF(),
this);
1856 return d->control->createStandardContextMenu(position,
this);
1858 #endif // QT_NO_CONTEXTMENU 1866 return d->control->cursorForPosition(
d->mapToContents(pos));
1879 QRect r =
d->control->cursorRect(cursor).toRect();
1880 r.
translate(-
d->horizontalOffset(),-
d->verticalOffset());
1891 QRect r =
d->control->cursorRect().toRect();
1892 r.
translate(-
d->horizontalOffset(),-
d->verticalOffset());
1904 return d->control->anchorAt(
d->mapToContents(pos));
1928 return d->control->overwriteMode();
1934 d->control->setOverwriteMode(overwrite);
1951 return qRound(
d->control->document()->defaultTextOption().tabStop());
1957 QTextOption opt =
d->control->document()->defaultTextOption();
1958 if (opt.
tabStop() == width || width < 0)
1961 d->control->document()->setDefaultTextOption(opt);
1976 return d->control->cursorWidth();
1982 d->control->setCursorWidth(width);
2002 return d->control->acceptRichText();
2008 d->control->setAcceptRichText(accept);
2050 d->control->setExtraSelections(selections);
2065 return d->control->extraSelections();
2081 return d->control->QTextControl::createMimeDataFromSelection();
2096 return d->control->QTextControl::canInsertFromMimeData(source);
2111 d->control->QTextControl::insertFromMimeData(source);
2139 #ifndef QT_NO_TEXTBROWSER 2140 if (qobject_cast<QTextBrowser *>(
this))
2146 d->control->setTextInteractionFlags(flags);
2166 d->control->setTextInteractionFlags(flags);
2172 return d->control->textInteractionFlags();
2186 d->control->mergeCurrentCharFormat(modifier);
2198 d->control->setCurrentCharFormat(format);
2207 return d->control->currentCharFormat();
2228 return d->autoFormatting;
2234 d->autoFormatting = features;
2248 d->control->insertPlainText(text);
2264 #ifndef QT_NO_TEXTHTMLPARSER 2268 d->control->insertHtml(text);
2270 #endif // QT_NO_TEXTHTMLPARSER 2284 d->anchorToScrollToWhenVisible =
name;
2288 QPointF p =
d->control->anchorPosition(name);
2289 const int newPosition =
qRound(p.
y());
2290 if (
d->vbar->maximum() < newPosition )
2291 d->_q_adjustScrollbars();
2292 d->vbar->setValue(newPosition);
2310 const int newSize = f.
pointSize() + range;
2352 d->control->moveCursor(operation, mode);
2365 return d->control->canPaste();
2368 #ifndef QT_NO_PRINTER 2383 d->control->print(printer);
2385 #endif // QT _NO_PRINTER 2402 return d->tabChangesFocus;
2408 d->tabChangesFocus = b;
2448 if (
d->lineWrap == wrap)
2451 d->updateDefaultTextOption();
2452 d->relayoutDocument();
2476 return d->lineWrapColumnOrWidth;
2482 d->lineWrapColumnOrWidth = w;
2483 d->relayoutDocument();
2507 if (mode ==
d->wordWrap)
2510 d->updateDefaultTextOption();
2521 return d->control->find(exp, options);
2597 #ifndef QT_NO_TEXTHTMLPARSER 2612 if (action == MovePageUp) {
2615 }
else if (action == MovePageDown) {
2636 d->control->setTextCursor(cursor);
2654 void QTextEdit::doKeyboardAction(KeyboardAction action)
2660 case ActionDelete: cursor.
deleteChar();
break;
2671 case ActionWordBackspace:
2675 case ActionWordDelete:
2680 d->control->setTextCursor(cursor);
2690 return d->control->toHtml();
2692 return d->control->toPlainText();
2715 return d->textFormat;
2718 #endif // QT3_SUPPORT 2732 const bool atBottom =
isReadOnly() ?
d->verticalOffset() >=
d->vbar->maximum() :
2733 d->control->textCursor().atEnd();
2734 d->control->append(text);
2736 d->vbar->setValue(
d->vbar->maximum());
2746 d->control->ensureCursorVisible();
2999 #endif // QT_NO_TEXTEDIT 3003 #include "moc_qtextedit.cpp" The QVariant class acts like a union for the most common Qt data types.
The QPainter class performs low-level painting on widgets and other paint devices.
The QColor class provides colors based on RGB, HSV or CMYK values.
QSizeF pageSize
the page size that should be used for laying out the document
void setPointSize(int)
Sets the point size to pointSize.
QRect toAlignedRect() const
Returns a QRect based on the values of this rectangle that is the smallest possible integer rectangle...
virtual bool event(QEvent *e)
virtual void changeEvent(QEvent *e)
Reimplemented Function
QTextCursor cursorForPosition(const QPoint &pos) const
returns a QTextCursor at position pos (in viewport coordinates).
QFont font() const
Returns the font for this character format.
void zoomIn(int range=1)
Zooms in on the text by making the base font size range points larger and recalculating all font size...
virtual void dragLeaveEvent(QDragLeaveEvent *e)
Reimplemented Function
AutoFormatting autoFormatting() const
QTextEditControl(QObject *parent)
void append(const QString &text)
Appends a new paragraph with text to the end of the text edit.
void print(QPrinter *printer) const
Convenience function to print the text edit's document to the given printer.
void endEditBlock()
Indicates the end of a block of editing operations on the document that should appear as a single ope...
virtual void showEvent(QShowEvent *)
Reimplemented Function
void setTabChangesFocus(bool b)
The QKeyEvent class describes a key event.
void pageUpDown(QTextCursor::MoveOperation op, QTextCursor::MoveMode moveMode)
bool isNull() const
Returns true if both the width and height are +0.
virtual void dropEvent(QDropEvent *e)
Reimplemented Function
void setTabStopWidth(int width)
void setFontItalic(bool italic)
If italic is true, sets the text format's font to be italic; otherwise the font will be non-italic...
The QTextCharFormat class provides formatting information for characters in a QTextDocument.
The QTextListFormat class provides formatting information for lists in a QTextDocument.
void setLineWrapColumnOrWidth(int w)
QTextCharFormat charFormat() const
Returns the format of the character immediately before the cursor position().
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
#define QT_END_NAMESPACE
This macro expands to.
const QColor & color() const
Returns the brush color.
void setFontPointSize(qreal s)
Sets the point size of the current format to s.
QPointF toPointF() const
Returns the variant as a QPointF if the variant has type() Point or PointF ; otherwise returns a null...
static QString fromAscii(const char *, int size=-1)
Returns a QString initialized with the first size characters from the string str. ...
bool isValid() const
Returns true if the rectangle is valid, otherwise returns false.
const QChar at(int i) const
Returns the character at the given index position in the string.
void setAutoFormatting(AutoFormatting features)
QRect cursorRect() const
returns a rectangle (in viewport coordinates) that includes the cursor of the text edit...
void setTextCursor(const QTextCursor &cursor)
Qt::Alignment alignment() const
Returns the alignment of the current paragraph.
void setWordWrapMode(QTextOption::WrapMode policy)
void setFontWeight(int w)
Sets the font weight of the current format to the given weight, where the value used is in the range ...
QSize toSize() const
Returns an integer based copy of this size.
bool isEmpty() const
Returns true if the document is empty; otherwise returns false.
void setTextBackgroundColor(const QColor &c)
Sets the text background color of the current format to c.
The QWheelEvent class contains parameters that describe a wheel event.
void setFontUnderline(bool b)
If underline is true, sets the current format to underline; otherwise sets the current format to non-...
int horizontalOffset() const
void setPalette(const QPalette &pal)
int length() const
Returns the number of characters in this string.
virtual bool canInsertFromMimeData(const QMimeData *source) const
void setAccepted(bool accepted)
virtual void wheelEvent(QWheelEvent *e)
Reimplemented Function
bool find(const QString &exp, QTextDocument::FindFlags options=0)
Finds the next occurrence of the string, exp, using the given options.
The QPointF class defines a point in the plane using floating point precision.
void paste()
Pastes the text from the clipboard into the text edit at the current cursor position.
void ensureCursorVisible()
Ensures that the cursor is visible by scrolling the text edit if necessary.
void setIndent(int indent)
Sets the list format's indentation.
QTextCharFormat currentCharFormat() const
Returns the char format that is used when inserting new text.
static qreal position(QGraphicsObject *item, QDeclarativeAnchorLine::AnchorLine anchorLine)
QTextList * createList(const QTextListFormat &format)
Creates and returns a new list with the given format, and makes the current paragraph the cursor is i...
WrapMode
This enum describes how text is wrapped in a document.
int select(int, fd_set *, fd_set *, fd_set *, struct timeval *)
Q_GUI_EXPORT bool mightBeRichText(const QString &)
Returns true if the string text is likely to be rich text; otherwise returns false.
void setFont(const QFont &font)
Sets the text format's font.
int lineWrapColumnOrWidth() const
void setTextInteractionFlags(Qt::TextInteractionFlags flags)
int left() const
Returns the x-coordinate of the rectangle's left edge.
void setTextColor(const QColor &c)
Sets the text color of the current format to c.
QTextBlockFormat blockFormat() const
Returns the block format of the block the cursor is in.
QRect translated(int dx, int dy) const
Returns a copy of the rectangle that is translated dx along the x axis and dy along the y axis...
int width() const
Returns the width of the rectangle.
void triggerAction(SliderAction action)
Triggers a slider action.
virtual bool focusNextPrevChild(bool next)
Reimplemented Function
bool toBool() const
Returns the variant as a bool if the variant has type() Bool.
void setPageSize(const QSizeF &size)
qreal fontPointSize() const
Returns the point size of the font of the current format.
static QSize documentSize(QTextControl *control)
long ASN1_INTEGER_get ASN1_INTEGER * a
bool atBlockStart() const
Returns true if the cursor is at the start of a block; otherwise returns false.
QString anchorHref() const
Returns the text format's hypertext link, or an empty string if none has been set.
virtual bool canInsertFromMimeData(const QMimeData *source) const
virtual void mousePressEvent(QMouseEvent *e)
Reimplemented Function
void setBackground(const QBrush &brush)
Sets the brush use to paint the document's background to the brush specified.
int height() const
Returns the height of the rectangle.
The QUrl class provides a convenient interface for working with URLs.
QRectF intersected(const QRectF &other) const
Returns the intersection of this rectangle and the given rectangle.
int bottom() const
Returns the y-coordinate of the rectangle's bottom edge.
The QString class provides a Unicode character string.
void setHeight(int h)
Sets the height to the given height.
T * qobject_cast(QObject *object)
QRectF toRectF() const
Returns the variant as a QRectF if the variant has type() Rect or RectF ; otherwise returns an invali...
The QDragMoveEvent class provides an event which is sent while a drag and drop action is in progress...
bool acceptRichText() const
Q_DECL_CONSTEXPR T qAbs(const T &t)
int indent() const
Returns the paragraph's indent.
The QObject class is the base class of all Qt objects.
void mergeBlockFormat(const QTextBlockFormat &modifier)
Modifies the block format of the current block (or all blocks that are contained in the selection) wi...
void setCursorWidth(int width)
virtual void dragEnterEvent(QDragEnterEvent *e)
Reimplemented Function
The QSizeF class defines the size of a two-dimensional object using floating point precision...
static bool shouldEnableInputMethod(QTextEdit *textedit)
void setCurrentCharFormat(const QTextCharFormat &format)
Sets the char format that is be used when inserting new text to format by calling QTextCursor::setCha...
virtual void insertFromMimeData(const QMimeData *source)
void setLineWrapMode(LineWrapMode mode)
qreal tabStop() const
Returns the distance in device units between tab stops.
QTextCursor textCursor() const
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
void setRange(int min, int max)
Sets the slider's minimum to min and its maximum to max.
void setDefaultTextOption(const QTextOption &option)
Sets the default text option.
const QPoint & pos() const
Returns the position of the mouse cursor, relative to the widget that received the event...
virtual void timerEvent(QTimerEvent *e)
void setObjectName(const QString &name)
void setTextCursor(const QTextCursor &cursor)
Sets the visible cursor.
void setFontWeight(int weight)
Sets the text format's font weight to weight.
int position() const
Returns the index of the block's first character within the document.
void setDocument(QTextDocument *document)
Makes document the new document of the text editor.
bool canPaste() const
Returns whether text can be pasted from the clipboard into the textedit.
Qt::KeyboardModifiers modifiers() const
Returns the keyboard modifier flags that existed immediately after the event occurred.
int key() const
Returns the code of the key that was pressed or released.
void _q_currentCharFormatChanged(const QTextCharFormat &format)
void _q_repaintContents(const QRectF &contentsRect)
uint ignoreAutomaticScrollbarAdjustment
int width() const
Returns the width.
virtual void scrollContentsBy(int dx, int dy)
em>Reimplemented Function
#define QT_BEGIN_NAMESPACE
This macro expands to.
MoveMode
If the anchor() is kept where it is and the position() is moved, the text in between will be selected...
QSizeF dynamicDocumentSize() const
The QRectF class defines a rectangle in the plane using floating point precision. ...
virtual void mouseMoveEvent(QMouseEvent *e)
Reimplemented Function
virtual void keyReleaseEvent(QKeyEvent *e)
Reimplemented Function
void changeEvent(QEvent *)
This event handler can be reimplemented to handle state changes.
bool hasSelection() const
Returns true if the cursor contains a selection; otherwise returns false.
QList< ExtraSelection > extraSelections() const
Returns previously set extra selections.
void setExtraSelections(const QList< ExtraSelection > &selections)
This function allows temporarily marking certain regions in the document with a given color...
static bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
Creates a connection of the given type from the signal in the sender object to the method in the rece...
virtual void mouseReleaseEvent(QMouseEvent *e)
Reimplemented Function
bool isEmpty() const
Returns true if the string has no characters; otherwise returns false.
void setBlockFormat(const QTextBlockFormat &format)
Sets the block format of the current block (or all blocks that are contained in the selection) to for...
The QTextCursor class offers an API to access and modify QTextDocuments.
virtual QSizeF documentSize() const =0
Returns the total size of the document's layout.
The QPrinter class is a paint device that paints on a printer.
void clear()
Deletes all the text in the text edit.
void adjust(int x1, int y1, int x2, int y2)
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
void setHtml(const QString &text)
The QResizeEvent class contains event parameters for resize events.
virtual void dragMoveEvent(QDragMoveEvent *e)
Reimplemented Function
bool fontUnderline() const
Returns true if the font of the current format is underlined; otherwise returns false.
int delta() const
Returns the distance that the wheel is rotated, in eighths of a degree.
virtual void inputMethodEvent(QInputMethodEvent *)
Reimplemented Function
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
void updateDefaultTextOption()
The QTextBlock class provides a container for text fragments in a QTextDocument.
virtual QMimeData * createMimeDataFromSelection() const
void setFontPointSize(qreal size)
Sets the text format's font size.
bool fontItalic() const
Returns true if the font of the current format is italic; otherwise returns false.
void mergeCurrentCharFormat(const QTextCharFormat &modifier)
Merges the properties specified in modifier into the current character format by calling QTextCursor:...
QTextEdit(QWidget *parent=0)
Constructs an empty QTextEdit with parent parent.
const QSize & oldSize() const
Returns the old size of the widget.
void _q_ensureVisible(const QRectF &rect)
The QDragLeaveEvent class provides an event that is sent to a widget when a drag and drop action leav...
virtual void mouseDoubleClickEvent(QMouseEvent *e)
Reimplemented Function
QString fontFamily() const
Returns the font family of the current format.
int position() const
Returns the absolute position of the cursor within the document.
int length() const
Returns the length of the block in characters.
The QShowEvent class provides an event that is sent when a widget is shown.
The QMimeData class provides a container for data that records information about its MIME type...
virtual void focusOutEvent(QFocusEvent *e)
Reimplemented Function
int fontWeight() const
Returns the font weight of the current format.
virtual QMimeData * createMimeDataFromSelection() const
This function returns a new MIME data object to represent the contents of the text edit's current sel...
Qt::MouseButton button() const
Returns the button that caused the event.
bool tabChangesFocus() const
QRect toRect() const
Returns a QRect based on the values of this rectangle.
QTextList * currentList() const
Returns the current list if the cursor position() is inside a block that is part of a list; otherwise...
bool contains(const QPoint &p, bool proper=false) const
Returns true if the given point is inside or on the edge of the rectangle, otherwise returns false...
QTextBlock block() const
Returns the block that contains the cursor.
QTextDocument * document() const
Qt::TextInteractionFlags textInteractionFlags() const
void undo()
Undoes the last operation.
The QMouseEvent class contains parameters that describe a mouse event.
QFont currentFont() const
Returns the font of the current format.
The QBrush class defines the fill pattern of shapes drawn by QPainter.
QPoint center() const
Returns the center point of the rectangle.
void insertBlock()
Inserts a new empty block at the cursor position() with the current blockFormat() and charFormat()...
void setFontItalic(bool b)
If italic is true, sets the current format to italic; otherwise sets the current format to non-italic...
void setDefaultFont(const QFont &font)
Sets the default font to use in the document layout.
void setPlainText(const QString &text)
Changes the text of the text edit to the string text.
void paint(QPainter *p, QPaintEvent *e)
QTextCursor textCursor() const
Returns a copy of the QTextCursor that represents the currently visible cursor.
int top() const
Returns the y-coordinate of the rectangle's top edge.
void setAlignment(Qt::Alignment alignment)
Sets the paragraph's alignment.
virtual void resizeEvent(QResizeEvent *e)
Reimplemented Function
void remove(const QTextBlock &)
Removes the given block from the list.
void beginEditBlock()
Indicates the start of a block of editing operations on the document that should appear as a single o...
The QDropEvent class provides an event which is sent when a drag and drop action is completed...
QColor textColor() const
Returns the text color of the current format.
Qt::MouseButtons buttons() const
Returns the button state when the event was generated.
int right() const
Returns the x-coordinate of the rectangle's right edge.
The QTimerEvent class contains parameters that describe a timer event.
virtual QVariant loadResource(int type, const QUrl &name)
Loads the resource specified by the given type and name.
QVariant inputMethodQuery(Qt::InputMethodQuery property) const
This method is only relevant for input widgets.
The QFont class specifies a font used for drawing text.
int y() const
Returns the y-coordinate of the rectangle's top edge.
QMenu * createStandardContextMenu()
This function creates the standard context menu which is shown when the user clicks on the text edit ...
QString text() const
Returns the Unicode text that this key generated.
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 ...
QRect toRect() const
Returns the variant as a QRect if the variant has type() Rect ; otherwise returns an invalid QRect...
const QSize & size() const
Returns the new size of the widget.
QPoint toPoint() const
Rounds the coordinates of this point to the nearest integer, and returns a QPoint object with the rou...
Type type() const
Returns the storage type of the value stored in the variant.
virtual void contextMenuEvent(QContextMenuEvent *e)
Shows the standard context menu created with createStandardContextMenu().
void setFontUnderline(bool underline)
If underline is true, sets the text format's font to be underlined; otherwise it is displayed non-und...
void copy()
Copies any selected text to the clipboard.
LineWrapMode lineWrapMode() const
int x() const
Returns the x-coordinate of the rectangle's left edge.
QObject * parent() const
Returns a pointer to the parent object.
void insertHtml(const QString &text)
Convenience slot that inserts text which is assumed to be of html formatting at the current cursor po...
void moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode=QTextCursor::MoveAnchor)
Moves the cursor by performing the given operation.
QTextDocument * document() const
Returns a pointer to the underlying document.
bool overwriteMode() const
The QDragEnterEvent class provides an event which is sent to a widget when a drag and drop action ent...
virtual QMimeData * createMimeDataFromSelection() const
The QPoint class defines a point in the plane using integer precision.
QAbstractTextDocumentLayout * documentLayout() const
Returns the document layout for this document.
void deletePreviousChar()
If there is no selected text, deletes the character before the current cursor position; otherwise del...
The QTextBlockFormat class provides formatting information for blocks of text in a QTextDocument...
bool isNull() const
Returns true if the cursor is null; otherwise returns false.
virtual void insertFromMimeData(const QMimeData *source)
This function inserts the contents of the MIME data object, specified by source, into the text edit a...
QBrush foreground() const
Returns the brush used to render foreground details, such as text, frame outlines, and table borders.
void setFontFamily(const QString &family)
Sets the text format's font family.
void setUndoRedoEnabled(bool enable)
int height() const
Returns the height.
The QRect class defines a rectangle in the plane using integer precision.
WrapMode wrapMode() const
Returns the text wrap mode defined by the option.
void setOverwriteMode(bool overwrite)
bool isAutoRepeat() const
Returns true if this event comes from an auto-repeating key; returns false if it comes from an initia...
void setIndent(int indent)
Sets the paragraph's indentation.
void _q_adjustScrollbars()
The QTextOption class provides a description of general rich text properties.
int verticalOffset() const
virtual ~QTextEdit()
Destructor.
void setCurrentFont(const QFont &f)
Sets the font of the current format to f.
void cut()
Copies the selected text to the clipboard and deletes it from the text edit.
void insertPlainText(const QString &text)
Convenience slot that inserts text at the current cursor position.
bool movePosition(MoveOperation op, MoveMode=MoveAnchor, int n=1)
Moves the cursor by performing the given operation n times, using the specified mode, and returns true if all operations were completed successfully; otherwise returns false.
int y() const
Returns the y coordinate of this point.
qreal y() const
Returns the y-coordinate of this point.
QVariant property(const char *name) const
Returns the value of the object's name property.
The QTextDocument class holds formatted text that can be viewed and edited using a QTextEdit...
qreal top() const
Returns the y-coordinate of the rectangle's top edge.
virtual void insertFromMimeData(const QMimeData *source)
uint showCursorOnInitialShow
void ensureLayouted(qreal)
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 setPaintDevice(QPaintDevice *device)
Sets the paint device used for rendering the document's layout to the given device.
virtual void paintEvent(QPaintEvent *e)
This event handler can be reimplemented in a subclass to receive paint events passed in event...
void setFontFamily(const QString &fontFamily)
Sets the font family of the current format to fontFamily.
The QTextList class provides a decorated list of items in a QTextDocument.
void setWrapMode(WrapMode wrap)
Sets the option's text wrap mode to the given mode.
void setForeground(const QBrush &brush)
Sets the foreground brush to the specified brush.
void ignore()
Clears the accept flag parameter of the event object, the equivalent of calling setAccepted(false).
void accept()
Sets the accept flag of the event object, the equivalent of calling setAccepted(true).
int pointSize() const
Returns the point size of the font.
The QSize class defines the size of a two-dimensional object using integer point precision.
void selectAll()
Selects all text.
QTextOption::WrapMode wordWrapMode() const
the mode QTextEdit will use when wrapping text by words
void zoomOut(int range=1)
Zooms out on the text by making the base font size range points smaller and recalculating all font si...
int x() const
Returns the x coordinate of this point.
void setAcceptRichText(bool accept)
virtual void focusInEvent(QFocusEvent *e)
Reimplemented Function
void setViewport(const QRectF &viewport)
const QRect & rect() const
Returns the rectangle that needs to be updated.
void deleteChar()
If there is no selected text, deletes the character at the current cursor position; otherwise deletes...
The QPaintEvent class contains event parameters for paint events.
void translate(int dx, int dy)
Moves the rectangle dx along the x axis and dy along the y axis, relative to the current position...
void setAlignment(Qt::Alignment a)
Sets the alignment of the current paragraph to a.
void setStyle(Style style)
Sets the list format's style.
QTextOption defaultTextOption() const
the default text option will be set on all QTextLayout in the document.
The QEvent class is the base class of all event classes.
Type type() const
Returns the event type.
void redo()
This is an overloaded member function, provided for convenience. It differs from the above function o...
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
void setReadOnly(bool ro)
void setText(const QString &text)
Sets the text edit's text.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
void createAutoBulletList()
void setHtml(const QString &text)
virtual void keyPressEvent(QKeyEvent *e)
Reimplemented Function
QRectF cursorRect(const QTextCursor &cursor) const
The QFocusEvent class contains event parameters for widget focus events.
QPoint toPoint() const
Returns the variant as a QPoint if the variant has type() Point or PointF ; otherwise returns a null ...
Q_DECL_CONSTEXPR int qRound(qreal d)
void setTabStop(qreal tabStop)
Sets the default distance in device units between tab stops to the value specified by tabStop...
QColor textBackgroundColor() const
Returns the text background color of the current format.
The QTextEdit class provides a widget that is used to edit and display both plain and rich text...
const QPoint & pos() const
Returns the position where the drop was made.
static QPoint pos()
Returns the position of the cursor (hot spot) in global screen coordinates.
The QList class is a template class that provides lists.
virtual bool canInsertFromMimeData(const QMimeData *source) const
This function returns true if the contents of the MIME data object, specified by source, can be decoded and inserted into the document.
The QAbstractTextDocumentLayout class is an abstract base class used to implement custom layouts for ...
void translate(const QPointF &offset)
Translates the coordinate system by the given offset; i.e.