diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-22 07:24:57 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2016-03-22 07:28:42 +0100 |
commit | a02863234d76abb6c9f289026ae4ea3145924f30 (patch) | |
tree | aef6381d0000a78ba69ac80eb03739b1c8ca5fc3 /src/gui/text | |
parent | e77b13621f0057374d83a2b884f03dd2e5b7b88c (diff) | |
parent | e4d79e1fdeb6b26ba0b12b578daacf7cd672b960 (diff) |
Merge remote-tracking branch 'origin/5.7' into dev
Conflicts:
configure
mkspecs/common/wince/qplatformdefs.h
src/plugins/platforms/directfb/qdirectfbbackingstore.cpp
src/plugins/platforms/xcb/qxcbbackingstore.cpp
Change-Id: Ied4d31264a9afca9514b51a7eb1494c28712793c
Diffstat (limited to 'src/gui/text')
24 files changed, 108 insertions, 82 deletions
diff --git a/src/gui/text/qabstracttextdocumentlayout.h b/src/gui/text/qabstracttextdocumentlayout.h index d363188742..e2fad12ad3 100644 --- a/src/gui/text/qabstracttextdocumentlayout.h +++ b/src/gui/text/qabstracttextdocumentlayout.h @@ -131,6 +131,8 @@ private: Q_PRIVATE_SLOT(d_func(), int _q_dynamicPageCountSlot()) Q_PRIVATE_SLOT(d_func(), QSizeF _q_dynamicDocumentSizeSlot()) }; +Q_DECLARE_TYPEINFO(QAbstractTextDocumentLayout::Selection, Q_RELOCATABLE_TYPE); +Q_DECLARE_TYPEINFO(QAbstractTextDocumentLayout::PaintContext, Q_RELOCATABLE_TYPE); class Q_GUI_EXPORT QTextObjectInterface { diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 898b268070..7e18250087 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -137,7 +137,7 @@ extern bool qt_is_gui_used; Q_GUI_EXPORT int qt_defaultDpiX() { - if (qApp->testAttribute(Qt::AA_Use96Dpi)) + if (QCoreApplication::instance()->testAttribute(Qt::AA_Use96Dpi)) return 96; if (!qt_is_gui_used) @@ -152,7 +152,7 @@ Q_GUI_EXPORT int qt_defaultDpiX() Q_GUI_EXPORT int qt_defaultDpiY() { - if (qApp->testAttribute(Qt::AA_Use96Dpi)) + if (QCoreApplication::instance()->testAttribute(Qt::AA_Use96Dpi)) return 96; if (!qt_is_gui_used) diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 32cf1b0e83..629a098fb7 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -499,6 +499,7 @@ public: void invalidate(); }; +Q_DECLARE_TYPEINFO(QFontDatabasePrivate::ApplicationFont, Q_MOVABLE_TYPE); void QFontDatabasePrivate::invalidate() { diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 7c0492bb1a..96f7e06a47 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -246,8 +246,8 @@ Q_AUTOTEST_EXPORT QList<QFontEngine *> QFontEngine_stopCollectingEngines() QFontEngine::QFontEngine(Type type) : m_type(type), ref(0), - font_(0), font_destroy_func(0), - face_(0), face_destroy_func(0), + font_(), + face_(), m_minLeftBearing(kBearingNotInitialized), m_minRightBearing(kBearingNotInitialized) { @@ -269,17 +269,6 @@ QFontEngine::QFontEngine(Type type) QFontEngine::~QFontEngine() { - m_glyphCaches.clear(); - - if (font_ && font_destroy_func) { - font_destroy_func(font_); - font_ = 0; - } - if (face_ && face_destroy_func) { - face_destroy_func(face_); - face_ = 0; - } - #ifdef QT_BUILD_INTERNAL if (enginesCollector) enginesCollector->removeOne(this); @@ -334,10 +323,9 @@ void *QFontEngine::harfbuzzFont() const hbFont->x_scale = (((qint64)hbFont->x_ppem << 6) * 0x10000L + (emSquare >> 1)) / emSquare; hbFont->y_scale = (((qint64)hbFont->y_ppem << 6) * 0x10000L + (emSquare >> 1)) / emSquare; - font_ = (void *)hbFont; - font_destroy_func = free; + font_ = Holder(hbFont, free); } - return font_; + return font_.get(); } void *QFontEngine::harfbuzzFace() const @@ -357,10 +345,9 @@ void *QFontEngine::harfbuzzFace() const Q_CHECK_PTR(hbFace); hbFace->isSymbolFont = symbol; - face_ = (void *)hbFace; - face_destroy_func = hb_freeFace; + face_ = Holder(hbFace, hb_freeFace); } - return face_; + return face_.get(); } bool QFontEngine::supportsScript(QChar::Script script) const diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 779333351f..9d62a03f4c 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -246,9 +246,6 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, } newFreetype->face = face; - newFreetype->hbFace = 0; - newFreetype->hbFace_destroy_func = 0; - newFreetype->ref.store(1); newFreetype->xsize = 0; newFreetype->ysize = 0; @@ -300,10 +297,7 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, void QFreetypeFace::cleanup() { - if (hbFace && hbFace_destroy_func) { - hbFace_destroy_func(hbFace); - hbFace = 0; - } + hbFace.reset(); FT_Done_Face(face); face = 0; } @@ -686,6 +680,8 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format, return init(faceId, antialias, format, QFreetypeFace::getFace(faceId, fontData)); } +static void dont_delete(void*) {} + bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format, QFreetypeFace *freetypeFace) { @@ -776,13 +772,13 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format, if (!freetype->hbFace) { faceData.user_data = face; faceData.get_font_table = ft_getSfntTable; - freetype->hbFace = harfbuzzFace(); - freetype->hbFace_destroy_func = face_destroy_func; + (void)harfbuzzFace(); // populates face_ + freetype->hbFace = std::move(face_); } else { Q_ASSERT(!face_); - face_ = freetype->hbFace; } - face_destroy_func = 0; // we share the HB face in QFreeTypeFace, so do not let ~QFontEngine() destroy it + // we share the HB face in QFreeTypeFace, so do not let ~QFontEngine() destroy it + face_ = Holder(freetype->hbFace.get(), dont_delete); unlockFace(); @@ -1079,8 +1075,8 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, if (glyph_buffer_size < pitch * info.height) { glyph_buffer_size = pitch * info.height; glyph_buffer.reset(new uchar[glyph_buffer_size]); + memset(glyph_buffer.data(), 0, glyph_buffer_size); } - memset(glyph_buffer.data(), 0, glyph_buffer_size); if (slot->format == FT_GLYPH_FORMAT_OUTLINE) { FT_Bitmap bitmap; diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index 1886fc67ba..f9b37ff039 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -121,8 +121,7 @@ private: QMutex _lock; QByteArray fontData; - void *hbFace; - qt_destroy_func_t hbFace_destroy_func; + QFontEngine::Holder hbFace; }; // If this is exported this breaks compilation of the windows diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index f97f91da50..1ef3a360d4 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -275,10 +275,45 @@ public: QAtomicInt ref; QFontDef fontDef; - mutable void *font_; - mutable qt_destroy_func_t font_destroy_func; - mutable void *face_; - mutable qt_destroy_func_t face_destroy_func; + class Holder { // replace by std::unique_ptr once available + void *ptr; + qt_destroy_func_t destroy_func; + public: + Holder() : ptr(nullptr), destroy_func(nullptr) {} + explicit Holder(void *p, qt_destroy_func_t d) : ptr(p), destroy_func(d) {} + ~Holder() { if (ptr && destroy_func) destroy_func(ptr); } + Holder(Holder &&other) Q_DECL_NOTHROW + : ptr(other.ptr), + destroy_func(other.destroy_func) + { + other.ptr = nullptr; + other.destroy_func = nullptr; + } + Holder &operator=(Holder &&other) Q_DECL_NOTHROW + { swap(other); return *this; } + + void swap(Holder &other) Q_DECL_NOTHROW + { + qSwap(ptr, other.ptr); + qSwap(destroy_func, other.destroy_func); + } + + void *get() const Q_DECL_NOTHROW { return ptr; } + void *release() Q_DECL_NOTHROW { + void *result = ptr; + ptr = nullptr; + destroy_func = nullptr; + return result; + } + void reset() Q_DECL_NOTHROW { Holder().swap(*this); } + qt_destroy_func_t get_deleter() const Q_DECL_NOTHROW { return destroy_func; } + + bool operator!() const Q_DECL_NOTHROW { return !ptr; } + }; + + mutable Holder font_; // \ NOTE: Declared before m_glyphCaches, so font_, face_ + mutable Holder face_; // / are destroyed _after_ m_glyphCaches is destroyed. + struct FaceData { void *user_data; qt_get_font_table_func_t get_font_table; @@ -334,6 +369,7 @@ private: mutable qreal m_minRightBearing; }; +Q_DECLARE_TYPEINFO(QFontEngine::KernPair, Q_PRIMITIVE_TYPE); Q_DECLARE_OPERATORS_FOR_FLAGS(QFontEngine::ShaperFlags) diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp index 4b5d241e60..c3a911fc55 100644 --- a/src/gui/text/qfontengine_qpf2.cpp +++ b/src/gui/text/qfontengine_qpf2.cpp @@ -246,7 +246,7 @@ QFontEngineQPF2::QFontEngineQPF2(const QFontDef &def, const QByteArray &data) if (!verifyHeader(fontData, dataSize)) { #if defined(DEBUG_FONTENGINE) - qDebug() << "verifyHeader failed!"; + qDebug("verifyHeader failed!"); #endif return; } diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp index a9387e5aa0..f591b4333c 100644 --- a/src/gui/text/qfontsubset.cpp +++ b/src/gui/text/qfontsubset.cpp @@ -798,7 +798,7 @@ static void convertPath(const QPainterPath &path, QVector<TTF_POINT> *points, QV base -= 3; } else { // need to split -// qDebug() << " -> splitting"; +// qDebug(" -> splitting"); qint16 a, b, c, d; base[6].x = base[3].x; c = base[1].x; @@ -859,7 +859,7 @@ static void getBounds(const QVector<TTF_POINT> &points, qint16 *xmin, qint16 *xm static int convertToRelative(QVector<TTF_POINT> *points) { // convert points to relative and setup flags -// qDebug() << "relative points:"; +// qDebug("relative points:"); qint16 prev_x = 0; qint16 prev_y = 0; int point_array_size = 0; @@ -980,7 +980,7 @@ static QTtfGlyph generateGlyph(int index, const QPainterPath &path, qreal advanc // qDebug() << "number of contours=" << endPoints.size(); // for (int i = 0; i < points.size(); ++i) // qDebug() << " point[" << i << "] = " << QPoint(points.at(i).x, points.at(i).y) << " flags=" << points.at(i).flags; -// qDebug() << "endPoints:"; +// qDebug("endPoints:"); // for (int i = 0; i < endPoints.size(); ++i) // qDebug() << endPoints.at(i); diff --git a/src/gui/text/qharfbuzzng.cpp b/src/gui/text/qharfbuzzng.cpp index e33b461401..55ef9f0d15 100644 --- a/src/gui/text/qharfbuzzng.cpp +++ b/src/gui/text/qharfbuzzng.cpp @@ -678,14 +678,10 @@ hb_face_t *hb_qt_face_get_for_engine(QFontEngine *fe) { Q_ASSERT(fe && fe->type() != QFontEngine::Multi); - if (Q_UNLIKELY(!fe->face_)) { - fe->face_ = _hb_qt_face_create(fe); - if (Q_UNLIKELY(!fe->face_)) - return NULL; - fe->face_destroy_func = _hb_qt_face_release; - } + if (Q_UNLIKELY(!fe->face_)) + fe->face_ = QFontEngine::Holder(_hb_qt_face_create(fe), _hb_qt_face_release); - return static_cast<hb_face_t *>(fe->face_); + return static_cast<hb_face_t *>(fe->face_.get()); } @@ -728,14 +724,10 @@ hb_font_t *hb_qt_font_get_for_engine(QFontEngine *fe) { Q_ASSERT(fe && fe->type() != QFontEngine::Multi); - if (Q_UNLIKELY(!fe->font_)) { - fe->font_ = _hb_qt_font_create(fe); - if (Q_UNLIKELY(!fe->font_)) - return NULL; - fe->font_destroy_func = _hb_qt_font_release; - } + if (Q_UNLIKELY(!fe->font_)) + fe->font_ = QFontEngine::Holder(_hb_qt_font_create(fe), _hb_qt_font_release); - return static_cast<hb_font_t *>(fe->font_); + return static_cast<hb_font_t *>(fe->font_.get()); } QT_END_NAMESPACE diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index 017e2f254d..0d7cb204ff 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -100,7 +100,7 @@ void QPlatformFontDatabase::registerQPF2Font(const QByteArray &dataArray, void * registerFont(fontName,QString(),QString(),fontWeight,fontStyle,stretch,true,false,pixelSize,false,writingSystems,handle); } } else { - qDebug() << "header verification of QPF2 font failed. maybe it is corrupt?"; + qDebug("header verification of QPF2 font failed. maybe it is corrupt?"); } } diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index ca6093227d..6065e17d9b 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -614,8 +614,7 @@ QByteArray QRawFont::fontTable(const char *tagName) const if (!d->isValid()) return QByteArray(); - const quint32 *tagId = reinterpret_cast<const quint32 *>(tagName); - return d->fontEngine->getSfntTable(qToBigEndian(*tagId)); + return d->fontEngine->getSfntTable(MAKE_TAG(tagName[0], tagName[1], tagName[2], tagName[3])); } /*! diff --git a/src/gui/text/qstatictext_p.h b/src/gui/text/qstatictext_p.h index d27d5a8725..7fdf46c101 100644 --- a/src/gui/text/qstatictext_p.h +++ b/src/gui/text/qstatictext_p.h @@ -119,6 +119,7 @@ private: // private to avoid abuse // ================ // 43 bytes per item }; +Q_DECLARE_TYPEINFO(QStaticTextItem, Q_MOVABLE_TYPE); class QStaticText; class Q_AUTOTEST_EXPORT QStaticTextPrivate diff --git a/src/gui/text/qtextdocumentfragment_p.h b/src/gui/text/qtextdocumentfragment_p.h index 4cc4f0429f..56dff01149 100644 --- a/src/gui/text/qtextdocumentfragment_p.h +++ b/src/gui/text/qtextdocumentfragment_p.h @@ -148,6 +148,7 @@ private: int listNode; QPointer<QTextList> list; }; + friend class QTypeInfo<List>; QVector<List> lists; int indent; @@ -187,6 +188,7 @@ private: int row; int column; }; + friend class QTypeInfo<TableCellIterator>; friend struct Table; struct Table @@ -200,6 +202,7 @@ private: TableCellIterator currentCell; int lastIndent; }; + friend class QTypeInfo<Table>; QVector<Table> tables; struct RowColSpanInfo @@ -207,6 +210,7 @@ private: int row, col; int rowSpan, colSpan; }; + friend class QTypeInfo<RowColSpanInfo>; enum WhiteSpace { @@ -227,6 +231,10 @@ private: int currentNodeIdx; const QTextHtmlParserNode *currentNode; }; +Q_DECLARE_TYPEINFO(QTextHtmlImporter::List, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(QTextHtmlImporter::TableCellIterator, Q_PRIMITIVE_TYPE); +Q_DECLARE_TYPEINFO(QTextHtmlImporter::Table, Q_MOVABLE_TYPE); +Q_DECLARE_TYPEINFO(QTextHtmlImporter::RowColSpanInfo, Q_PRIMITIVE_TYPE); QT_END_NAMESPACE #endif // QT_NO_TEXTHTMLPARSER diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp index 4d5dc820d5..a8b57d6dfd 100644 --- a/src/gui/text/qtextdocumentlayout.cpp +++ b/src/gui/text/qtextdocumentlayout.cpp @@ -1598,7 +1598,7 @@ QTextLayoutStruct QTextDocumentLayoutPrivate::layoutCell(QTextTable *t, const QT // floats in other cells we must clear the list here. data(t)->floats.clear(); -// qDebug() << "layoutCell done"; +// qDebug("layoutCell done"); return layoutStruct; } @@ -2030,7 +2030,7 @@ void QTextDocumentLayoutPrivate::positionFloat(QTextFrame *frame, QTextLine *cur // qDebug() << "have line: right=" << right << "left=" << left << "textWidth=" << currentLine->width(); if (right - left < QFixed::fromReal(currentLine->naturalTextWidth()) + fd->size.width) { layoutStruct->pendingFloats.append(frame); -// qDebug() << " adding to pending list"; +// qDebug(" adding to pending list"); return; } } @@ -2543,7 +2543,7 @@ void QTextDocumentLayoutPrivate::layoutFlow(QTextFrame::Iterator it, QTextLayout contentHasAlignment = true; if (it.atEnd()) { - //qDebug() << "layout done!"; + //qDebug("layout done!"); currentLazyLayoutPosition = -1; QCheckPoint cp; cp.y = layoutStruct->y; diff --git a/src/gui/text/qtextdocumentwriter.cpp b/src/gui/text/qtextdocumentwriter.cpp index d672b1187a..a7c58ac2a6 100644 --- a/src/gui/text/qtextdocumentwriter.cpp +++ b/src/gui/text/qtextdocumentwriter.cpp @@ -271,7 +271,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document) #ifndef QT_NO_TEXTHTMLPARSER if (format == "html" || format == "htm") { if (!d->device->isWritable() && ! d->device->open(QIODevice::WriteOnly)) { - qWarning() << "QTextDocumentWriter::write: the device can not be opened for writing"; + qWarning("QTextDocumentWriter::write: the device can not be opened for writing"); return false; } QTextStream ts(d->device); @@ -285,7 +285,7 @@ bool QTextDocumentWriter::write(const QTextDocument *document) #endif if (format == "txt" || format == "plaintext") { if (!d->device->isWritable() && ! d->device->open(QIODevice::WriteOnly)) { - qWarning() << "QTextDocumentWriter::write: the device can not be opened for writing"; + qWarning("QTextDocumentWriter::write: the device can not be opened for writing"); return false; } QTextStream ts(d->device); diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 7708157697..8e03797080 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -816,7 +816,7 @@ void QTextEngine::bidiReorder(int numItems, const quint8 *levels, int *visualOrd } #if (BIDI_DEBUG >= 1) -// qDebug() << "visual order is:"; +// qDebug("visual order is:"); // for (i = 0; i < numItems; i++) // qDebug() << visualOrder[i]; #endif @@ -2753,8 +2753,7 @@ QString QTextEngine::elidedText(Qt::TextElideMode mode, const QFixed &width, int QFixed ellipsisWidth; QString ellipsisText; { - QFontEngine *fe = fnt.d->engineForScript(QChar::Script_Common); - QFontEngine *engine = fe->type() == QFontEngine::Multi ? static_cast<QFontEngineMulti *>(fe)->engine(0) : fe; + QFontEngine *engine = fnt.d->engineForScript(QChar::Script_Common); QChar ellipsisChar(0x2026); diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index 58049399ef..49ec9ca768 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -263,6 +263,7 @@ private: friend QDataStream &operator<<(QDataStream &, const QTextFormat &); friend QDataStream &operator>>(QDataStream &, QTextFormat &); }; +Q_DECLARE_TYPEINFO(QTextFormatPrivate::Property, Q_MOVABLE_TYPE); static inline uint hash(const QColor &color) { diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index 9dd83ab678..bc627521ff 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -116,6 +116,7 @@ private: friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QTextLength &); friend Q_GUI_EXPORT QDataStream &operator>>(QDataStream &, QTextLength &); }; +Q_DECLARE_TYPEINFO(QTextLength, QT_VERSION >= QT_VERSION_CHECK(6,0,0) ? Q_PRIMITIVE_TYPE : Q_RELOCATABLE_TYPE); inline QTextLength::QTextLength(Type atype, qreal avalue) : lengthType(atype), fixedValueOrPercentage(avalue) {} diff --git a/src/gui/text/qtexthtmlparser_p.h b/src/gui/text/qtexthtmlparser_p.h index a8a849ca7f..8e5a90be0b 100644 --- a/src/gui/text/qtexthtmlparser_p.h +++ b/src/gui/text/qtexthtmlparser_p.h @@ -328,12 +328,14 @@ protected: QString url; QCss::StyleSheet sheet; }; + friend class QTypeInfo<ExternalStyleSheet>; QVector<ExternalStyleSheet> externalStyleSheets; QVector<QCss::StyleSheet> inlineStyleSheets; #endif const QTextDocument *resourceProvider; }; +Q_DECLARE_TYPEINFO(QTextHtmlParser::ExternalStyleSheet, Q_MOVABLE_TYPE); QT_END_NAMESPACE diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index e2939785b2..83f2a9bc25 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -2980,7 +2980,7 @@ int QTextLine::xToCursor(qreal _x, CursorPosition cpos) const } } // right of last item -// qDebug() << "right of last"; +// qDebug("right of last"); int item = visualOrder[nItems-1]+firstItem; QScriptItem &si = eng->layoutData->items[item]; if (!si.num_glyphs) diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h index d9afb1ed4b..1cbb5ac8d8 100644 --- a/src/gui/text/qtextlayout.h +++ b/src/gui/text/qtextlayout.h @@ -203,6 +203,7 @@ private: QPainter *painter); QTextEngine *d; }; +Q_DECLARE_TYPEINFO(QTextLayout::FormatRange, Q_RELOCATABLE_TYPE); class Q_GUI_EXPORT QTextLine diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 4baa94edd5..bd2a9d5183 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -769,7 +769,7 @@ bool QTextOdfWriter::writeAll() m_strategy = new QXmlStreamStrategy(m_device); if (!m_device->isWritable() && ! m_device->open(QIODevice::WriteOnly)) { - qWarning() << "QTextOdfWriter::writeAll: the device can not be opened for writing"; + qWarning("QTextOdfWriter::writeAll: the device can not be opened for writing"); return false; } QXmlStreamWriter writer(m_strategy->contentStream); diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp index 4f43f73d41..5178f5a9a8 100644 --- a/src/gui/text/qzip.cpp +++ b/src/gui/text/qzip.cpp @@ -574,7 +574,7 @@ void QZipReaderPrivate::scanFiles() uchar tmp[4]; device->read((char *)tmp, 4); if (readUInt(tmp) != 0x04034b50) { - qWarning() << "QZip: not a zip file!"; + qWarning("QZip: not a zip file!"); return; } @@ -586,7 +586,7 @@ void QZipReaderPrivate::scanFiles() while (start_of_directory == -1) { const int pos = device->size() - int(sizeof(EndOfDirectory)) - i; if (pos < 0 || i > 65535) { - qWarning() << "QZip: EndOfDirectory not found"; + qWarning("QZip: EndOfDirectory not found"); return; } @@ -603,7 +603,7 @@ void QZipReaderPrivate::scanFiles() ZDEBUG("start_of_directory at %d, num_dir_entries=%d", start_of_directory, num_dir_entries); int comment_length = readUShort(eod.comment_length); if (comment_length != i) - qWarning() << "QZip: failed to parse zip file."; + qWarning("QZip: failed to parse zip file."); comment = device->read(qMin(comment_length, i)); @@ -612,30 +612,30 @@ void QZipReaderPrivate::scanFiles() FileHeader header; int read = device->read((char *) &header.h, sizeof(CentralFileHeader)); if (read < (int)sizeof(CentralFileHeader)) { - qWarning() << "QZip: Failed to read complete header, index may be incomplete"; + qWarning("QZip: Failed to read complete header, index may be incomplete"); break; } if (readUInt(header.h.signature) != 0x02014b50) { - qWarning() << "QZip: invalid header signature, index may be incomplete"; + qWarning("QZip: invalid header signature, index may be incomplete"); break; } int l = readUShort(header.h.file_name_length); header.file_name = device->read(l); if (header.file_name.length() != l) { - qWarning() << "QZip: Failed to read filename from zip index, index may be incomplete"; + qWarning("QZip: Failed to read filename from zip index, index may be incomplete"); break; } l = readUShort(header.h.extra_field_length); header.extra_field = device->read(l); if (header.extra_field.length() != l) { - qWarning() << "QZip: Failed to read extra field in zip file, skipping file, index may be incomplete"; + qWarning("QZip: Failed to read extra field in zip file, skipping file, index may be incomplete"); break; } l = readUShort(header.h.file_comment_length); header.file_comment = device->read(l); if (header.file_comment.length() != l) { - qWarning() << "QZip: Failed to read read file comment, index may be incomplete"; + qWarning("QZip: Failed to read read file comment, index may be incomplete"); break; } @@ -824,14 +824,15 @@ QZipReader::QZipReader(const QString &archive, QIODevice::OpenMode mode) QScopedPointer<QFile> f(new QFile(archive)); f->open(mode); QZipReader::Status status; - if (f->error() == QFile::NoError) + const QFileDevice::FileError error = f->error(); + if (error == QFile::NoError) status = NoError; else { - if (f->error() == QFile::ReadError) + if (error == QFile::ReadError) status = FileReadError; - else if (f->error() == QFile::OpenError) + else if (error == QFile::OpenError) status = FileOpenError; - else if (f->error() == QFile::PermissionsError) + else if (error == QFile::PermissionsError) status = FilePermissionsError; else status = FileError; |