⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 qtextedit.cpp

📁 奇趣公司比较新的qt/emd版本
💻 CPP
📖 第 1 页 / 共 5 页
字号:
    Q_D(QTextEdit);    d->control->setOverwriteMode(overwrite);}/*!    \property QTextEdit::tabStopWidth    \brief the tab stop width in pixels    \since 4.1*/int QTextEdit::tabStopWidth() const{    Q_D(const QTextEdit);    return qRound(d->control->document()->defaultTextOption().tabStop());}void QTextEdit::setTabStopWidth(int width){    Q_D(QTextEdit);    QTextOption opt = d->control->document()->defaultTextOption();    if (opt.tabStop() == width || width < 0)        return;    opt.setTabStop(width);    d->control->document()->setDefaultTextOption(opt);}/*!    \since 4.2    \property QTextEdit::cursorWidth    This property specifies the width of the cursor in pixels. The default value is 1.*/int QTextEdit::cursorWidth() const{    Q_D(const QTextEdit);    return d->control->cursorWidth();}void QTextEdit::setCursorWidth(int width){    Q_D(QTextEdit);    d->control->setCursorWidth(width);}/*!    \property QTextEdit::acceptRichText    \brief whether the text edit accepts rich text insertions by the user    \since 4.1    When this propery is set to false text edit will accept only    plain text input from the user. For example through clipboard or drag and drop.    This property's default is true.*/bool QTextEdit::acceptRichText() const{    Q_D(const QTextEdit);    return d->control->acceptRichText();}void QTextEdit::setAcceptRichText(bool accept){    Q_D(QTextEdit);    d->control->setAcceptRichText(accept);}/*!    \class QTextEdit::ExtraSelection    \since 4.2    \brief The QTextEdit::ExtraSelection structure provides a way of specifying a           character format for a given selection in a document*//*!    \variable QTextEdit::ExtraSelection::cursor    A cursor that contains a selection in a QTextDocument*//*!    \variable QTextEdit::ExtraSelection::format    A format that is used to specify a foreground or background brush/color    for the selection.*//*!    \since 4.2    This function allows temporarily marking certain regions in the document    with a given color, specified as \a selections. This can be useful for    example in a programming editor to mark a whole line of text with a given    background color to indicate the existence of a breakpoint.    \sa QTextEdit::ExtraSelection, extraSelections()*/void QTextEdit::setExtraSelections(const QList<ExtraSelection> &selections){    Q_D(QTextEdit);    d->control->setExtraSelections(selections);}/*!    \since 4.2    Returns previously set extra selections.    \sa setExtraSelections()*/QList<QTextEdit::ExtraSelection> QTextEdit::extraSelections() const{    Q_D(const QTextEdit);    return d->control->extraSelections();}/*!    This function returns a new MIME data object to represent the contents    of the text edit's current selection. It is called when the selection needs    to be encapsulated into a new QMimeData object; for example, when a drag    and drop operation is started, or when data is copyied to the clipboard.    If you reimplement this function, note that the ownership of the returned    QMimeData object is passed to the caller. The selection can be retrieved    by using the textCursor() function.*/QMimeData *QTextEdit::createMimeDataFromSelection() const{    Q_D(const QTextEdit);    return d->control->QTextControl::createMimeDataFromSelection();}/*!    This function returns true if the contents of the MIME data object, specified    by \a source, can be decoded and inserted into the document. It is called    for example when during a drag operation the mouse enters this widget and it    is necessary to determine whether it is possible to accept the drag and drop    operation.    Reimplement this function to enable drag and drop support for additional MIME types. */bool QTextEdit::canInsertFromMimeData(const QMimeData *source) const{    Q_D(const QTextEdit);    return d->control->QTextControl::canInsertFromMimeData(source);}/*!    This function inserts the contents of the MIME data object, specified    by \a source, into the text edit at the current cursor position. It is    called whenever text is inserted as the result of a clipboard paste    operation, or when the text edit accepts data from a drag and drop    operation.    Reimplement this function to enable drag and drop support for additional MIME types.    */void QTextEdit::insertFromMimeData(const QMimeData *source){    Q_D(QTextEdit);    d->control->QTextControl::insertFromMimeData(source);}/*!    \property QTextEdit::readOnly    \brief whether the text edit is read-only    In a read-only text edit the user can only navigate through the    text and select text; modifying the text is not possible.    This property's default is false.*/bool QTextEdit::isReadOnly() const{    Q_D(const QTextEdit);    return !(d->control->textInteractionFlags() & Qt::TextEditable);}void QTextEdit::setReadOnly(bool ro){    Q_D(QTextEdit);    Qt::TextInteractionFlags flags = Qt::NoTextInteraction;    if (ro) {        flags = Qt::TextSelectableByMouse;#ifndef QT_NO_TEXTBROWSER        if (qobject_cast<QTextBrowser *>(this))            flags |= Qt::TextBrowserInteraction;#endif    } else {        flags = Qt::TextEditorInteraction;    }    d->control->setTextInteractionFlags(flags);}/*!    \property QTextEdit::textInteractionFlags    \since 4.2    Specifies how the label should interact with user input if it displays text.    If the flags contain either Qt::LinksAccessibleByKeyboard or Qt::TextSelectableByKeyboard    then the focus policy is also automatically set to Qt::ClickFocus.    The default value depends on whether the QTextEdit is read-only    or editable, and whether it is a QTextBrowser or not.*/void QTextEdit::setTextInteractionFlags(Qt::TextInteractionFlags flags){    Q_D(QTextEdit);    d->control->setTextInteractionFlags(flags);}Qt::TextInteractionFlags QTextEdit::textInteractionFlags() const{    Q_D(const QTextEdit);    return d->control->textInteractionFlags();}/*!    Merges the properties specified in \a modifier into the current character    format by calling QTextCursor::mergeCharFormat on the editor's cursor.    If the editor has a selection then the properties of \a modifier are    directly applied to the selection.    \sa QTextCursor::mergeCharFormat() */void QTextEdit::mergeCurrentCharFormat(const QTextCharFormat &modifier){    Q_D(QTextEdit);    d->control->mergeCurrentCharFormat(modifier);}/*!    Sets the char format that is be used when inserting new text to \a    format by calling QTextCursor::setCharFormat() on the editor's    cursor.  If the editor has a selection then the char format is    directly applied to the selection. */void QTextEdit::setCurrentCharFormat(const QTextCharFormat &format){    Q_D(QTextEdit);    d->control->setCurrentCharFormat(format);}/*!    Returns the char format that is used when inserting new text. */QTextCharFormat QTextEdit::currentCharFormat() const{    Q_D(const QTextEdit);    return d->control->currentCharFormat();}/*!    \property QTextEdit::autoFormatting    \brief the enabled set of auto formatting features    The value can be any combination of the values in the    AutoFormattingFlag enum.  The default is AutoNone. Choose    AutoAll to enable all automatic formatting.    Currently, the only automatic formatting feature provided is    AutoBulletList; future versions of Qt may offer more.*/QTextEdit::AutoFormatting QTextEdit::autoFormatting() const{    Q_D(const QTextEdit);    return d->autoFormatting;}void QTextEdit::setAutoFormatting(AutoFormatting features){    Q_D(QTextEdit);    d->autoFormatting = features;}/*!    Convenience slot that inserts \a text at the current    cursor position.    It is equivalent to    \code    edit->textCursor().insertText(text);    \endcode */void QTextEdit::insertPlainText(const QString &text){    Q_D(QTextEdit);    d->control->insertPlainText(text);}/*!    Convenience slot that inserts \a text which is assumed to be of    html formatting at the current cursor position.    It is equivalent to:    \code    edit->textCursor().insertHtml(fragment);    \endcode    \note When using this function with a style sheet, the style sheet will    only apply to the current block in the document. In order to apply a style    sheet throughout a document, use QTextDocument::setDefaultStyleSheet()    instead. */void QTextEdit::insertHtml(const QString &text){    Q_D(QTextEdit);    d->control->insertHtml(text);}/*!    Scrolls the text edit so that the anchor with the given \a name is    visible; does nothing if the \a name is empty, or is already    visible, or isn't found.*/void QTextEdit::scrollToAnchor(const QString &name){    Q_D(QTextEdit);    if (name.isEmpty())        return;    if (!isVisible()) {        d->anchorToScrollToWhenVisible = name;        return;    }    QPointF p = d->control->anchorPosition(name);    const int newPosition = qRound(p.y());    if ( d->vbar->maximum() < newPosition )        d->_q_adjustScrollbars();    d->vbar->setValue(newPosition);}/*!    \fn QTextEdit::zoomIn(int range)    Zooms in on the text by making the base font size \a range    points larger and recalculating all font sizes to be the new size.    This does not change the size of any images.    \sa zoomOut()*/void QTextEdit::zoomIn(int range){    QFont f = font();    const int newSize = f.pointSize() + range;    if (newSize <= 0)        return;    f.setPointSize(newSize);    setFont(f);}/*!    \fn QTextEdit::zoomOut(int range)    \overload    Zooms out on the text by making the base font size \a range points    smaller and recalculating all font sizes to be the new size. This    does not change the size of any images.    \sa zoomIn()*/void QTextEdit::zoomOut(int range){    zoomIn(-range);}/*!    \since 4.2    Moves the cursor by performing the given \a operation.    If \a mode is QTextCursor::KeepAnchor, the cursor selects the text it moves over.    This is the same effect that the user achieves when they hold down the Shift key    and move the cursor with the cursor keys.    \sa QTextCursor::movePosition()*/void QTextEdit::moveCursor(QTextCursor::MoveOperation operation, QTextCursor::MoveMode mode){    Q_D(QTextEdit);    d->control->moveCursor(operation, mode);}/*!    \since 4.2    Returns whether text can be pasted from the clipboard into the textedit.*/bool QTextEdit::canPaste() const{    Q_D(const QTextEdit);    return d->control->canPaste();}#ifndef QT_NO_PRINTER/*!    \since 4.3    Convenience function to print the text edit's document to the given \a printer. This    is equivalent to calling the print method on the document directly except that this    function also supports QPrinter::Selection as print range.    \sa QTextDocument::print()*/void QTextEdit::print(QPrinter *printer) const{    Q_D(const QTextEdit);    d->control->print(printer);}#endif // QT _NO_PRINTER/*! \property QTextEdit::tabChangesFocus  \brief whether \gui Tab changes focus or is accepted as input  In some occasions text edits should not allow the user to input  tabulators or change indentation using the \gui Tab key, as this breaks  the focus chain. The default is false.*/bool QTextEdit::tabChangesFocus() const{    Q_D(const QTextEdit);    return d->tabChangesFocus;}void QTextEdit::setTabChangesFocus(bool b){    Q_D(QTextEdit);    d->tabChangesFocus = b;}/*!    \property QTextEdit::documentTitle    \brief the title of the document parsed from the text.*//*!    \property QTextEdit::lineWrapMode    \brief the line wrap mode    The default mode is WidgetWidth which causes words to be    wrapped at the right edge of the text edit. Wrapping occurs

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -