File indexing completed on 2025-01-18 10:08:17
0001
0002
0003
0004 #ifndef QTEXTDOCUMENTFRAGMENT_H
0005 #define QTEXTDOCUMENTFRAGMENT_H
0006
0007 #include <QtGui/qtguiglobal.h>
0008 #include <QtGui/qtextdocument.h>
0009 #include <QtCore/qstring.h>
0010
0011 QT_BEGIN_NAMESPACE
0012
0013
0014 class QTextStream;
0015 class QTextDocumentFragmentPrivate;
0016 class QTextCursor;
0017
0018 class Q_GUI_EXPORT QTextDocumentFragment
0019 {
0020 public:
0021 QTextDocumentFragment();
0022 explicit QTextDocumentFragment(const QTextDocument *document);
0023 explicit QTextDocumentFragment(const QTextCursor &range);
0024 QTextDocumentFragment(const QTextDocumentFragment &rhs);
0025 QTextDocumentFragment &operator=(const QTextDocumentFragment &rhs);
0026 ~QTextDocumentFragment();
0027
0028 bool isEmpty() const;
0029
0030 QString toPlainText() const;
0031 QString toRawText() const;
0032 #ifndef QT_NO_TEXTHTMLPARSER
0033 QString toHtml() const;
0034 #endif
0035 #if QT_CONFIG(textmarkdownwriter)
0036 QString toMarkdown(QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub) const;
0037 #endif
0038
0039 static QTextDocumentFragment fromPlainText(const QString &plainText);
0040 #ifndef QT_NO_TEXTHTMLPARSER
0041 static QTextDocumentFragment fromHtml(const QString &html, const QTextDocument *resourceProvider = nullptr);
0042 #endif
0043 #if QT_CONFIG(textmarkdownreader)
0044 static QTextDocumentFragment fromMarkdown(const QString &markdown,
0045 QTextDocument::MarkdownFeatures features = QTextDocument::MarkdownDialectGitHub);
0046 #endif
0047
0048 private:
0049 QTextDocumentFragmentPrivate *d;
0050 friend class QTextCursor;
0051 friend class QTextDocumentWriter;
0052 };
0053
0054 QT_END_NAMESPACE
0055
0056 #endif