diff options
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qsyntaxhighlighter.cpp | 10 | ||||
-rw-r--r-- | src/gui/text/qtextdocument.cpp | 4 | ||||
-rw-r--r-- | src/gui/text/qtextdocument.h | 2 | ||||
-rw-r--r-- | src/gui/text/qtextdocumentfragment.cpp | 1 | ||||
-rw-r--r-- | src/gui/text/qtextdocumentwriter.cpp | 16 | ||||
-rw-r--r-- | src/gui/text/qtextdocumentwriter.h | 2 | ||||
-rw-r--r-- | src/gui/text/qtexthtmlparser.cpp | 1 | ||||
-rw-r--r-- | src/gui/text/qtextodfwriter.cpp | 2 |
8 files changed, 20 insertions, 18 deletions
diff --git a/src/gui/text/qsyntaxhighlighter.cpp b/src/gui/text/qsyntaxhighlighter.cpp index fcda17605f..b09f8b565a 100644 --- a/src/gui/text/qsyntaxhighlighter.cpp +++ b/src/gui/text/qsyntaxhighlighter.cpp @@ -157,14 +157,12 @@ void QSyntaxHighlighterPrivate::applyFormatChanges() void QSyntaxHighlighterPrivate::_q_reformatBlocks(int from, int charsRemoved, int charsAdded) { - if (!inReformatBlocks) + if (!inReformatBlocks && !rehighlightPending) reformatBlocks(from, charsRemoved, charsAdded); } void QSyntaxHighlighterPrivate::reformatBlocks(int from, int charsRemoved, int charsAdded) { - rehighlightPending = false; - QTextBlock block = doc->findBlock(from); if (!block.isValid()) return; @@ -346,8 +344,10 @@ void QSyntaxHighlighter::setDocument(QTextDocument *doc) if (d->doc) { connect(d->doc, SIGNAL(contentsChange(int,int,int)), this, SLOT(_q_reformatBlocks(int,int,int))); - d->rehighlightPending = true; - QTimer::singleShot(0, this, SLOT(_q_delayedRehighlight())); + if (!d->doc->isEmpty()) { + d->rehighlightPending = true; + QTimer::singleShot(0, this, SLOT(_q_delayedRehighlight())); + } } } diff --git a/src/gui/text/qtextdocument.cpp b/src/gui/text/qtextdocument.cpp index 5d88530e65..6ca4bc8209 100644 --- a/src/gui/text/qtextdocument.cpp +++ b/src/gui/text/qtextdocument.cpp @@ -51,7 +51,9 @@ #include <qregularexpression.h> #endif #include <qvarlengtharray.h> +#if QT_CONFIG(textcodec) #include <qtextcodec.h> +#endif #include <qthread.h> #include <qcoreapplication.h> #include <qmetaobject.h> @@ -209,7 +211,7 @@ QString Qt::convertFromPlainText(const QString &plain, Qt::WhiteSpaceMode mode) This function is defined in the \c <QTextDocument> header file. */ -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) QTextCodec *Qt::codecForHtml(const QByteArray &ba) { return QTextCodec::codecForHtml(ba); diff --git a/src/gui/text/qtextdocument.h b/src/gui/text/qtextdocument.h index 33c0b48683..c9b22e053b 100644 --- a/src/gui/text/qtextdocument.h +++ b/src/gui/text/qtextdocument.h @@ -75,7 +75,7 @@ namespace Qt Q_GUI_EXPORT bool mightBeRichText(const QString&); Q_GUI_EXPORT QString convertFromPlainText(const QString &plain, WhiteSpaceMode mode = WhiteSpacePre); -#if !defined(QT_NO_TEXTCODEC) || defined(Q_CLANG_QDOC) +#if QT_CONFIG(textcodec) || defined(Q_CLANG_QDOC) Q_GUI_EXPORT QTextCodec *codecForHtml(const QByteArray &ba); #endif } diff --git a/src/gui/text/qtextdocumentfragment.cpp b/src/gui/text/qtextdocumentfragment.cpp index f0eff2d4f3..e7eaa54a45 100644 --- a/src/gui/text/qtextdocumentfragment.cpp +++ b/src/gui/text/qtextdocumentfragment.cpp @@ -43,7 +43,6 @@ #include "qtextlist.h" #include <qdebug.h> -#include <qtextcodec.h> #include <qbytearray.h> #include <qdatastream.h> #include <qdatetime.h> diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp index 731aaf1fcf..5ea04fe9e9 100644 --- a/src/gui/text/qtextdocumentwriter.cpp +++ b/src/gui/text/qtextdocumentwriter.cpp @@ -41,7 +41,9 @@ #include <QtCore/qfile.h> #include <QtCore/qbytearray.h> #include <QtCore/qfileinfo.h> +#if QT_CONFIG(textcodec) #include <QtCore/qtextcodec.h> +#endif #include <QtCore/qtextstream.h> #include <QtCore/qdebug.h> #include "qtextdocument.h" @@ -63,7 +65,7 @@ public: QByteArray format; QIODevice *device; bool deleteDevice; -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) QTextCodec *codec; #endif @@ -104,7 +106,7 @@ public: QTextDocumentWriterPrivate::QTextDocumentWriterPrivate(QTextDocumentWriter *qq) : device(0), deleteDevice(false), -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) codec(QTextCodec::codecForName("utf-8")), #endif q(qq) @@ -258,7 +260,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document) #ifndef QT_NO_TEXTODFWRITER if (format == "odf" || format == "opendocumentformat" || format == "odt") { QTextOdfWriter writer(*document, d->device); -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) writer.setCodec(d->codec); #endif return writer.writeAll(); @@ -272,7 +274,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document) return false; } QTextStream ts(d->device); -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) ts.setCodec(d->codec); ts << document->toHtml(d->codec->name()); #endif @@ -286,7 +288,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document) return false; } QTextStream ts(d->device); -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) ts.setCodec(d->codec); #endif ts << document->toPlainText(); @@ -317,7 +319,7 @@ bool QTextDocumentWriter::write(const QTextDocumentFragment &fragment) uses UTF-8. */ -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) void QTextDocumentWriter::setCodec(QTextCodec *codec) { if (codec == 0) @@ -330,7 +332,7 @@ void QTextDocumentWriter::setCodec(QTextCodec *codec) /*! Returns the codec that is currently assigned to the writer. */ -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) QTextCodec *QTextDocumentWriter::codec() const { return d->codec; diff --git a/src/gui/text/qtextdocumentwriter.h b/src/gui/text/qtextdocumentwriter.h index 0502bf1a96..4a57b181b4 100644 --- a/src/gui/text/qtextdocumentwriter.h +++ b/src/gui/text/qtextdocumentwriter.h @@ -70,7 +70,7 @@ public: bool write(const QTextDocument *document); bool write(const QTextDocumentFragment &fragment); -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) void setCodec(QTextCodec *codec); QTextCodec *codec() const; #endif diff --git a/src/gui/text/qtexthtmlparser.cpp b/src/gui/text/qtexthtmlparser.cpp index 9d2a5d553a..04300a4d22 100644 --- a/src/gui/text/qtexthtmlparser.cpp +++ b/src/gui/text/qtexthtmlparser.cpp @@ -40,7 +40,6 @@ #include "qtexthtmlparser_p.h" #include <qbytearray.h> -#include <qtextcodec.h> #include <qstack.h> #include <qdebug.h> #include <qthread.h> diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 5f6a24cc5d..f5d73affab 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -961,7 +961,7 @@ bool QTextOdfWriter::writeAll() return false; } QXmlStreamWriter writer(m_strategy->contentStream); -#ifndef QT_NO_TEXTCODEC +#if QT_CONFIG(textcodec) if (m_codec) writer.setCodec(m_codec); #endif |