diff options
36 files changed, 547 insertions, 323 deletions
diff --git a/examples/xml/doc/images/saxbookmarks-example.png b/examples/xml/saxbookmarks/doc/images/saxbookmarks-example.png Binary files differindex 54d793be56..54d793be56 100644 --- a/examples/xml/doc/images/saxbookmarks-example.png +++ b/examples/xml/saxbookmarks/doc/images/saxbookmarks-example.png diff --git a/examples/xml/doc/src/saxbookmarks.qdoc b/examples/xml/saxbookmarks/doc/src/saxbookmarks.qdoc index 4612a1c302..4612a1c302 100644 --- a/examples/xml/doc/src/saxbookmarks.qdoc +++ b/examples/xml/saxbookmarks/doc/src/saxbookmarks.qdoc diff --git a/examples/xml/doc/images/xmlstreamexample-filemenu.png b/examples/xml/streambookmarks/doc/images/xmlstreamexample-filemenu.png Binary files differindex e074fb7c41..e074fb7c41 100644 --- a/examples/xml/doc/images/xmlstreamexample-filemenu.png +++ b/examples/xml/streambookmarks/doc/images/xmlstreamexample-filemenu.png diff --git a/examples/xml/doc/images/xmlstreamexample-helpmenu.png b/examples/xml/streambookmarks/doc/images/xmlstreamexample-helpmenu.png Binary files differindex 0dc4392b94..0dc4392b94 100644 --- a/examples/xml/doc/images/xmlstreamexample-helpmenu.png +++ b/examples/xml/streambookmarks/doc/images/xmlstreamexample-helpmenu.png diff --git a/examples/xml/doc/images/xmlstreamexample-screenshot.png b/examples/xml/streambookmarks/doc/images/xmlstreamexample-screenshot.png Binary files differindex bbaa423061..bbaa423061 100644 --- a/examples/xml/doc/images/xmlstreamexample-screenshot.png +++ b/examples/xml/streambookmarks/doc/images/xmlstreamexample-screenshot.png diff --git a/examples/xml/doc/src/qxmlstreambookmarks.qdoc b/examples/xml/streambookmarks/doc/src/qxmlstreambookmarks.qdoc index 123058b02d..123058b02d 100644 --- a/examples/xml/doc/src/qxmlstreambookmarks.qdoc +++ b/examples/xml/streambookmarks/doc/src/qxmlstreambookmarks.qdoc diff --git a/mkspecs/features/android/android.prf b/mkspecs/features/android/android.prf index 9e86110da6..f428f7db87 100644 --- a/mkspecs/features/android/android.prf +++ b/mkspecs/features/android/android.prf @@ -1,7 +1,7 @@ contains(TEMPLATE, ".*app") { !android_app { !contains(TARGET, ".so"): TARGET = lib$${TARGET}.so - QMAKE_LFLAGS += -Wl,-soname,$$TARGET + QMAKE_LFLAGS += -Wl,-soname,$$shell_quote($$TARGET) android_install: { target.path=/libs/$$ANDROID_TARGET_ARCH/ diff --git a/src/corelib/doc/snippets/code/src_corelib_tools_qcommandlineparser_main.cpp b/src/corelib/doc/snippets/code/src_corelib_tools_qcommandlineparser_main.cpp index 46b4274301..257a138d0d 100644 --- a/src/corelib/doc/snippets/code/src_corelib_tools_qcommandlineparser_main.cpp +++ b/src/corelib/doc/snippets/code/src_corelib_tools_qcommandlineparser_main.cpp @@ -59,7 +59,8 @@ int main(int argc, char *argv[]) parser.addOption(showProgressOption); // A boolean option with multiple names (-f, --force) - QCommandLineOption forceOption(QStringList() << "f" << "force", "Overwrite existing files."); + QCommandLineOption forceOption(QStringList() << "f" << "force", + QCoreApplication::translate("main", "Overwrite existing files.")); parser.addOption(forceOption); // An option with a value diff --git a/src/corelib/global/qflags.h b/src/corelib/global/qflags.h index d7b673bc1f..097f2760b4 100644 --- a/src/corelib/global/qflags.h +++ b/src/corelib/global/qflags.h @@ -57,16 +57,22 @@ class QFlag { int i; public: -#if !defined(__LP64__) && !defined(Q_QDOC) + Q_DECL_CONSTEXPR inline QFlag(int ai) : i(ai) {} + Q_DECL_CONSTEXPR inline operator int() const { return i; } + +#if !defined(Q_CC_MSVC) + // Microsoft Visual Studio has buggy behavior when it comes to + // unsigned enums: even if the enum is unsigned, the enum tags are + // always signed +# if !defined(__LP64__) && !defined(Q_QDOC) Q_DECL_CONSTEXPR inline QFlag(long ai) : i(int(ai)) {} Q_DECL_CONSTEXPR inline QFlag(ulong ai) : i(int(long(ai))) {} -#endif - Q_DECL_CONSTEXPR inline QFlag(int ai) : i(ai) {} +# endif Q_DECL_CONSTEXPR inline QFlag(uint ai) : i(int(ai)) {} Q_DECL_CONSTEXPR inline QFlag(short ai) : i(int(ai)) {} Q_DECL_CONSTEXPR inline QFlag(ushort ai) : i(int(uint(ai))) {} - Q_DECL_CONSTEXPR inline operator int() const { return i; } Q_DECL_CONSTEXPR inline operator uint() const { return uint(i); } +#endif }; Q_DECLARE_TYPEINFO(QFlag, Q_PRIMITIVE_TYPE); @@ -93,7 +99,11 @@ class QFlags struct Private; typedef int (Private::*Zero); public: -#ifndef Q_QDOC +#if defined(Q_CC_MSVC) || defined(Q_QDOC) + // see above for MSVC + // the definition below is too complex for qdoc + typedef int Int; +#else typedef typename QtPrivate::if_< QtPrivate::is_unsigned<Enum>::value, unsigned int, @@ -103,7 +113,6 @@ public: typedef Enum enum_type; // compiler-generated copy/move ctor/assignment operators are fine! #ifdef Q_QDOC - typedef int Int; // the real typedef above is too complex for qdoc inline QFlags(const QFlags &other); inline QFlags &operator=(const QFlags &other); #endif diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp index 437205bf92..aa9b196e62 100644 --- a/src/corelib/kernel/qjni.cpp +++ b/src/corelib/kernel/qjni.cpp @@ -67,6 +67,19 @@ static QString qt_convertJString(jstring string) return res; } +static inline bool exceptionCheckAndClear(JNIEnv *env) +{ + if (Q_UNLIKELY(env->ExceptionCheck())) { +#ifdef QT_DEBUG + env->ExceptionDescribe(); +#endif // QT_DEBUG + env->ExceptionClear(); + return true; + } + + return false; +} + typedef QHash<QString, jclass> JClassHash; Q_GLOBAL_STATIC(JClassHash, cachedClasses) @@ -85,14 +98,8 @@ static jclass getCachedClass(JNIEnv *env, const char *className) QJNIObjectPrivate classObject = classLoader.callObjectMethod("loadClass", "(Ljava/lang/String;)Ljava/lang/Class;", stringName.object()); - if (env->ExceptionCheck()) { -#ifdef QT_DEBUG - env->ExceptionDescribe(); -#endif // QT_DEBUG - env->ExceptionClear(); - } - if (classObject.isValid()) + if (!exceptionCheckAndClear(env) && classObject.isValid()) clazz = static_cast<jclass>(env->NewGlobalRef(classObject.object())); cachedClasses->insert(key, clazz); @@ -121,13 +128,8 @@ static jmethodID getCachedMethodID(JNIEnv *env, else id = env->GetMethodID(clazz, name, sig); - if (env->ExceptionCheck()) { + if (exceptionCheckAndClear(env)) id = 0; -#ifdef QT_DEBUG - env->ExceptionDescribe(); -#endif // QT_DEBUG - env->ExceptionClear(); - } cachedMethodID->insert(key, id); } else { @@ -154,13 +156,8 @@ static jfieldID getCachedFieldID(JNIEnv *env, else id = env->GetFieldID(clazz, name, sig); - if (env->ExceptionCheck()) { + if (exceptionCheckAndClear(env)) id = 0; -#ifdef QT_DEBUG - env->ExceptionDescribe(); -#endif // QT_DEBUG - env->ExceptionClear(); - } cachedFieldID->insert(key, id); } else { diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index 8172ecbb48..681e7e3f79 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1026,7 +1026,8 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State d->engine->addFile(fileName, size, mode, state); // Check if a "@2x" file exists and add it. - if (qApp->devicePixelRatio() > 1.0) { + static bool disable2xImageLoading = !qgetenv("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING").isEmpty(); + if (!disable2xImageLoading && qApp->devicePixelRatio() > 1.0) { int dotIndex = fileName.lastIndexOf(QLatin1Char('.')); if (dotIndex != -1) { QString at2xfileName = fileName; diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp index a291df29b6..d3edf40acc 100644 --- a/src/gui/image/qimagereader.cpp +++ b/src/gui/image/qimagereader.cpp @@ -1246,8 +1246,9 @@ bool QImageReader::read(QImage *image) } // successful read; check for "@2x" file name suffix and set device pixel ratio. - if (QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))) { - image->setDevicePixelRatio(2.0); + static bool disable2xImageLoading = !qgetenv("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING").isEmpty(); + if (!disable2xImageLoading && QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))) { + image->setDevicePixelRatio(2.0); } return true; diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index f76166af18..feb3243a5a 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -3561,7 +3561,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e) { case QEvent::TouchEnd: n = n ? n : "TouchEnd"; formatTouchEvent(dbg.nospace(), n, *static_cast<const QTouchEvent*>(e)); - return dbg.nospace(); + return dbg.space(); case QEvent::ChildAdded: n = n ? n : "ChildAdded"; case QEvent::ChildPolished: n = n ? n : "ChildPolished"; case QEvent::ChildRemoved: n = n ? n : "ChildRemoved"; diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp index 010ddaf228..3335a88cbb 100644 --- a/src/gui/opengl/qopenglversionfunctions.cpp +++ b/src/gui/opengl/qopenglversionfunctions.cpp @@ -160,7 +160,7 @@ void QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(QOpenGLContext *con A pointer to an object of the class corresponding to the version and profile of OpenGL in use can be obtained from - QOpenGLFunctions::versionFunctions(). If obtained in this way, note that + QOpenGLContext::versionFunctions(). If obtained in this way, note that the QOpenGLContext retains ownership of the object. This is so that only one instance need be created. diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index bda5df3d13..0c888d645d 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -2362,7 +2362,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n data.resize(bytesPerLine * h); char *rawdata = data.data(); for (int y = 0; y < h; ++y) { - memcpy(rawdata, image.scanLine(y), bytesPerLine); + memcpy(rawdata, image.constScanLine(y), bytesPerLine); rawdata += bytesPerLine; } object = writeImage(data, w, h, d, 0, 0); @@ -2384,7 +2384,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n softMaskData.resize(w * h); uchar *sdata = (uchar *)softMaskData.data(); for (int y = 0; y < h; ++y) { - const QRgb *rgb = (const QRgb *)image.scanLine(y); + const QRgb *rgb = (const QRgb *)image.constScanLine(y); for (int x = 0; x < w; ++x) { uchar alpha = qAlpha(*rgb); *sdata++ = alpha; @@ -2400,7 +2400,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n softMaskData.resize(w * h); uchar *sdata = (uchar *)softMaskData.data(); for (int y = 0; y < h; ++y) { - const QRgb *rgb = (const QRgb *)image.scanLine(y); + const QRgb *rgb = (const QRgb *)image.constScanLine(y); if (grayscale) { for (int x = 0; x < w; ++x) { *(data++) = qGray(*rgb); diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index ef0ae4a146..3b6a988e97 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1292,8 +1292,12 @@ int QTextEngine::shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *stri attrs.justification = hbAttrs.justification; } - for (quint32 i = 0; i < shaper_item.item.length; ++i) + for (quint32 i = 0; i < shaper_item.item.length; ++i) { + // Workaround wrong log_clusters for surrogates (i.e. QTBUG-39875) + if (shaper_item.log_clusters[i] >= shaper_item.num_glyphs) + shaper_item.log_clusters[i] = shaper_item.num_glyphs - 1; shaper_item.log_clusters[i] += glyph_pos; + } if (kerningEnabled && !shaper_item.kerning_applied) actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0)); diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index a48fef7e8b..435ef2637d 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1843,8 +1843,17 @@ void QTextLine::layout_helper(int maxGlyphs) addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount, current, lbh.logClusters, lbh.glyphs); + // This is a hack to fix a regression caused by the introduction of the + // whitespace flag to non-breakable spaces and will cause the non-breakable + // spaces to behave as in previous Qt versions in the line breaking algorithm. + // The line breaks do not currently follow the Unicode specs, but fixing this would + // require refactoring the code and would cause behavioral regressions. + bool isBreakableSpace = lbh.currentPosition < eng->layoutData->string.length() + && attributes[lbh.currentPosition].whiteSpace + && eng->layoutData->string.at(lbh.currentPosition).decompositionTag() != QChar::NoBreak; + if (lbh.currentPosition >= eng->layoutData->string.length() - || attributes[lbh.currentPosition].whiteSpace + || isBreakableSpace || attributes[lbh.currentPosition].lineBreak) { sb_or_ws = true; break; diff --git a/src/network/ssl/qsslcertificate.cpp b/src/network/ssl/qsslcertificate.cpp index 11ea711f30..4b71f34b3a 100644 --- a/src/network/ssl/qsslcertificate.cpp +++ b/src/network/ssl/qsslcertificate.cpp @@ -1255,6 +1255,9 @@ static const char *certificate_blacklist[] = { "08:64", "e-islem.kktcmerkezbankasi.org", // Turktrust mis-issued intermediate certificate "03:1d:a7", "AC DG Tr\xC3\xA9sor SSL", // intermediate certificate linking back to ANSSI French National Security Agency + "27:83", "NIC Certifying Authority", // intermediate certificate from NIC India (2007) + "27:92", "NIC CA 2011", // intermediate certificate from NIC India (2011) + "27:b1", "NIC CA 2014", // intermediate certificate from NIC India (2014) 0 }; diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index 0b3a0a6834..f9d2f21b0c 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -2069,7 +2069,10 @@ bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const connection.send(message.createReply(true)); } else if (function == QLatin1String("SetTextContents")) { QString newContents = message.arguments().at(0).toString(); - interface->editableTextInterface()->replaceText(0, interface->textInterface()->characterCount(), newContents); + if (QAccessibleEditableTextInterface *editableTextIface = interface->editableTextInterface()) + editableTextIface->replaceText(0, interface->textInterface()->characterCount(), newContents); + else + replaceTextFallback(interface, 0, -1, newContents); connection.send(message.createReply(true)); } else if (function == QLatin1String("")) { connection.send(message.createReply()); @@ -2083,23 +2086,27 @@ bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const // Value interface bool AtSpiAdaptor::valueInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection) { + QAccessibleValueInterface *valueIface = interface->valueInterface(); + if (!valueIface) + return false; + if (function == QLatin1String("SetCurrentValue")) { QDBusVariant v = message.arguments().at(2).value<QDBusVariant>(); double value = v.variant().toDouble(); //Temporary fix //See https://bugzilla.gnome.org/show_bug.cgi?id=652596 - interface->valueInterface()->setCurrentValue(value); + valueIface->setCurrentValue(value); connection.send(message.createReply()); // FIXME is the reply needed? } else { QVariant value; if (function == QLatin1String("GetCurrentValue")) - value = interface->valueInterface()->currentValue(); + value = valueIface->currentValue(); else if (function == QLatin1String("GetMaximumValue")) - value = interface->valueInterface()->maximumValue(); + value = valueIface->maximumValue(); else if (function == QLatin1String("GetMinimumIncrement")) - value = interface->valueInterface()->minimumStepSize(); + value = valueIface->minimumStepSize(); else if (function == QLatin1String("GetMinimumValue")) - value = interface->valueInterface()->minimumValue(); + value = valueIface->minimumValue(); else { qAtspiDebug() << "WARNING: AtSpiAdaptor::valueInterface does not implement " << function << message.path(); return false; diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index 09c56f398c..d82487ae9b 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -562,13 +562,13 @@ static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/, if (!m_androidPlatformIntegration) { QAndroidPlatformIntegration::setDefaultDisplayMetrics(desktopWidthPixels, desktopHeightPixels, - qRound(double(desktopWidthPixels) / xdpi * 25.4), - qRound(double(desktopHeightPixels) / ydpi * 25.4), + qRound(double(widthPixels) / xdpi * 25.4), + qRound(double(heightPixels) / ydpi * 25.4), widthPixels, heightPixels); } else { - m_androidPlatformIntegration->setDisplayMetrics(qRound(double(desktopWidthPixels) / xdpi * 25.4), - qRound(double(desktopHeightPixels) / ydpi * 25.4)); + m_androidPlatformIntegration->setDisplayMetrics(qRound(double(widthPixels) / xdpi * 25.4), + qRound(double(heightPixels) / ydpi * 25.4)); m_androidPlatformIntegration->setDesktopSize(desktopWidthPixels, desktopHeightPixels); m_androidPlatformIntegration->setScreenSize(widthPixels, heightPixels); } diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp index cc9d3b227a..703e547f6b 100644 --- a/src/testlib/qtestcase.cpp +++ b/src/testlib/qtestcase.cpp @@ -2710,6 +2710,13 @@ QString QTest::qFindTestData(const QString& base, const char *file, int line, co } } + // 4. Try resources + if (found.isEmpty()) { + QString candidate = QString::fromLatin1(":/%1").arg(base); + if (QFileInfo(candidate).exists()) + found = candidate; + } + if (found.isEmpty()) { QTest::qWarn(qPrintable( QString::fromLatin1("testdata %1 could not be located!").arg(base)), diff --git a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc index 20cd94c90c..fee5085821 100644 --- a/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc +++ b/src/tools/qdoc/doc/qdoc-manual-qdocconf.qdoc @@ -1072,7 +1072,7 @@ \code qhp.Qt.file = qt.qhp - qhp.Qt.namespace = com.trolltech.qt.440 + qhp.Qt.namespace = org.qt-project.qtcore.$QT_VERSION_TAG qhp.Qt.virtualFolder = qdoc qhp.Qt.indexTitle = Qt Reference Documentation qhp.Qt.indexRoot = diff --git a/src/widgets/doc/src/graphicsview.qdoc b/src/widgets/doc/src/graphicsview.qdoc index 148b4ea47d..d1d8630935 100644 --- a/src/widgets/doc/src/graphicsview.qdoc +++ b/src/widgets/doc/src/graphicsview.qdoc @@ -301,7 +301,7 @@ pass a QPainterPath to mapToScene(), and then pass the mapped path to QGraphicsScene::items(). - You can map coordinates and shapes to and from and item's scene by + You can map coordinates and shapes to and from an item's scene by calling QGraphicsItem::mapToScene() and QGraphicsItem::mapFromScene(). You can also map to an item's parent item by calling QGraphicsItem::mapToParent() and diff --git a/src/widgets/itemviews/qlistwidget.cpp b/src/widgets/itemviews/qlistwidget.cpp index 1f954d67dd..f376583f55 100644 --- a/src/widgets/itemviews/qlistwidget.cpp +++ b/src/widgets/itemviews/qlistwidget.cpp @@ -1325,6 +1325,11 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft, \fn void QListWidget::removeItemWidget(QListWidgetItem *item) Removes the widget set on the given \a item. + + To remove an item (row) from the list entirely, either delete the item or + use takeItem(). + + \sa itemWidget(), setItemWidget() */ /*! @@ -1620,6 +1625,8 @@ void QListWidget::closePersistentEditor(QListWidgetItem *item) \since 4.1 Returns the widget displayed in the given \a item. + + \sa setItemWidget(), removeItemWidget() */ QWidget *QListWidget::itemWidget(QListWidgetItem *item) const { @@ -1638,7 +1645,7 @@ QWidget *QListWidget::itemWidget(QListWidgetItem *item) const implement a custom editor widget, use QListView and subclass QItemDelegate instead. - \sa {Delegate Classes} + \sa itemWidget(), removeItemWidget(), {Delegate Classes} */ void QListWidget::setItemWidget(QListWidgetItem *item, QWidget *widget) { diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index 94fcee4553..6329c52caa 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -4004,6 +4004,9 @@ void QApplication::alert(QWidget *widget, int duration) We recommend that widgets do not cache this value as it may change at any time if the user changes the global desktop settings. + + \note This property may hold a negative value, for instance if cursor + blinking is disabled. */ void QApplication::setCursorFlashTime(int msecs) { diff --git a/src/widgets/widgets/qwidgetlinecontrol.cpp b/src/widgets/widgets/qwidgetlinecontrol.cpp index 1f70dd719b..b927004773 100644 --- a/src/widgets/widgets/qwidgetlinecontrol.cpp +++ b/src/widgets/widgets/qwidgetlinecontrol.cpp @@ -1474,7 +1474,7 @@ void QWidgetLineControl::setCursorBlinkPeriod(int msec) if (m_blinkTimer) { killTimer(m_blinkTimer); } - if (msec && !m_readOnly) { + if (msec > 0 && !m_readOnly) { m_blinkTimer = startTimer(msec / 2); m_blinkStatus = 1; } else { diff --git a/src/xml/doc/qtxml.qdocconf b/src/xml/doc/qtxml.qdocconf index f36848b566..ab10818522 100644 --- a/src/xml/doc/qtxml.qdocconf +++ b/src/xml/doc/qtxml.qdocconf @@ -30,11 +30,9 @@ depends += qtcore qtnetwork qtdoc headerdirs += .. -sourcedirs += .. \ - ../../../examples/xml/doc/src +sourcedirs += .. exampledirs += ../../../examples/xml \ - ../ \ snippets imagedirs += images \ diff --git a/src/xml/dom/qdom.cpp b/src/xml/dom/qdom.cpp index 2383bda1c9..5907a72bd6 100644 --- a/src/xml/dom/qdom.cpp +++ b/src/xml/dom/qdom.cpp @@ -54,6 +54,7 @@ #include <qtextcodec.h> #include <qtextstream.h> #include <qxml.h> +#include "private/qxml_p.h" #include <qvariant.h> #include <qmap.h> #include <qshareddata.h> @@ -502,7 +503,7 @@ public: ~QDomDocumentPrivate(); bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn); - bool setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg, int *errorLine, int *errorColumn); + bool setContent(QXmlInputSource *source, QXmlReader *reader, QXmlSimpleReader *simpleReader, QString *errorMsg, int *errorLine, int *errorColumn); // Attributes QDomDocumentTypePrivate* doctype() { return type.data(); } @@ -573,7 +574,7 @@ public: class QDomHandler : public QXmlDefaultHandler { public: - QDomHandler(QDomDocumentPrivate* d, bool namespaceProcessing); + QDomHandler(QDomDocumentPrivate* d, QXmlSimpleReader *reader, bool namespaceProcessing); ~QDomHandler(); // content handler @@ -615,6 +616,7 @@ private: bool cdata; bool nsProcessing; QXmlLocator *locator; + QXmlSimpleReader *reader; }; /************************************************************** @@ -6208,10 +6210,10 @@ bool QDomDocumentPrivate::setContent(QXmlInputSource *source, bool namespaceProc { QXmlSimpleReader reader; initializeReader(reader, namespaceProcessing); - return setContent(source, &reader, errorMsg, errorLine, errorColumn); + return setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn); } -bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader, QString *errorMsg, int *errorLine, int *errorColumn) +bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader, QXmlSimpleReader *simpleReader, QString *errorMsg, int *errorLine, int *errorColumn) { clear(); impl = new QDomImplementationPrivate; @@ -6221,7 +6223,7 @@ bool QDomDocumentPrivate::setContent(QXmlInputSource *source, QXmlReader *reader bool namespaceProcessing = reader->feature(QLatin1String("http://xml.org/sax/features/namespaces")) && !reader->feature(QLatin1String("http://xml.org/sax/features/namespace-prefixes")); - QDomHandler hnd(this, namespaceProcessing); + QDomHandler hnd(this, simpleReader, namespaceProcessing); reader->setContentHandler(&hnd); reader->setErrorHandler(&hnd); reader->setLexicalHandler(&hnd); @@ -6758,7 +6760,7 @@ bool QDomDocument::setContent(QXmlInputSource *source, bool namespaceProcessing, impl = new QDomDocumentPrivate(); QXmlSimpleReader reader; initializeReader(reader, namespaceProcessing); - return IMPL->setContent(source, &reader, errorMsg, errorLine, errorColumn); + return IMPL->setContent(source, &reader, &reader, errorMsg, errorLine, errorColumn); } /*! @@ -6820,7 +6822,7 @@ bool QDomDocument::setContent(QXmlInputSource *source, QXmlReader *reader, QStri { if (!impl) impl = new QDomDocumentPrivate(); - return IMPL->setContent(source, reader, errorMsg, errorLine, errorColumn); + return IMPL->setContent(source, reader, 0, errorMsg, errorLine, errorColumn); } /*! @@ -7360,9 +7362,9 @@ QDomComment QDomNode::toComment() const * **************************************************************/ -QDomHandler::QDomHandler(QDomDocumentPrivate* adoc, bool namespaceProcessing) +QDomHandler::QDomHandler(QDomDocumentPrivate* adoc, QXmlSimpleReader* areader, bool namespaceProcessing) : errorLine(0), errorColumn(0), doc(adoc), node(adoc), cdata(false), - nsProcessing(namespaceProcessing), locator(0) + nsProcessing(namespaceProcessing), locator(0), reader(areader) { } @@ -7466,11 +7468,10 @@ bool QDomHandler::processingInstruction(const QString& target, const QString& da return false; } -extern bool qt_xml_skipped_entity_in_content; bool QDomHandler::skippedEntity(const QString& name) { // we can only handle inserting entity references into content - if (!qt_xml_skipped_entity_in_content) + if (reader && !reader->d_ptr->skipped_entity_in_content) return true; QDomNodePrivate *n = doc->createEntityReference(name); diff --git a/src/xml/sax/qxml.cpp b/src/xml/sax/qxml.cpp index 9d91ce42a5..50900c17f0 100644 --- a/src/xml/sax/qxml.cpp +++ b/src/xml/sax/qxml.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qxml.h" +#include "qxml_p.h" #include "qtextcodec.h" #include "qbuffer.h" #include "qregexp.h" @@ -99,10 +100,6 @@ static const signed char cltDq = 12; // " static const signed char cltSq = 13; // ' static const signed char cltUnknown = 14; -// Hack for letting QDom know where the skipped entity occurred -// ### the use of this variable means the code isn't reentrant. -bool qt_xml_skipped_entity_in_content; - // character lookup table static const signed char charLookupTable[256]={ cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x00 - 0x07 @@ -271,247 +268,6 @@ class QXmlDefaultHandlerPrivate { }; -class QXmlSimpleReaderPrivate -{ -public: - ~QXmlSimpleReaderPrivate(); -private: - // functions - QXmlSimpleReaderPrivate(QXmlSimpleReader *reader); - void initIncrementalParsing(); - - // used to determine if elements are correctly nested - QStack<QString> tags; - - // used by parseReference() and parsePEReference() - enum EntityRecognitionContext { InContent, InAttributeValue, InEntityValue, InDTD }; - - // used for entity declarations - struct ExternParameterEntity - { - ExternParameterEntity() {} - ExternParameterEntity(const QString &p, const QString &s) - : publicId(p), systemId(s) {} - QString publicId; - QString systemId; - - Q_DUMMY_COMPARISON_OPERATOR(ExternParameterEntity) - }; - struct ExternEntity - { - ExternEntity() {} - ExternEntity(const QString &p, const QString &s, const QString &n) - : publicId(p), systemId(s), notation(n) {} - QString publicId; - QString systemId; - QString notation; - Q_DUMMY_COMPARISON_OPERATOR(ExternEntity) - }; - QMap<QString,ExternParameterEntity> externParameterEntities; - QMap<QString,QString> parameterEntities; - QMap<QString,ExternEntity> externEntities; - QMap<QString,QString> entities; - - // used for parsing of entity references - struct XmlRef { - XmlRef() - : index(0) {} - XmlRef(const QString &_name, const QString &_value) - : name(_name), value(_value), index(0) {} - bool isEmpty() const { return index == value.length(); } - QChar next() { return value.at(index++); } - QString name; - QString value; - int index; - }; - QStack<XmlRef> xmlRefStack; - - // used for standalone declaration - enum Standalone { Yes, No, Unknown }; - - QString doctype; // only used for the doctype - QString xmlVersion; // only used to store the version information - QString encoding; // only used to store the encoding - Standalone standalone; // used to store the value of the standalone declaration - - QString publicId; // used by parseExternalID() to store the public ID - QString systemId; // used by parseExternalID() to store the system ID - - // Since publicId/systemId is used as temporary variables by parseExternalID(), it - // might overwrite the PUBLIC/SYSTEM for the document we're parsing. In effect, we would - // possibly send off an QXmlParseException that has the PUBLIC/SYSTEM of a entity declaration - // instead of those of the current document. - // Hence we have these two variables for storing the document's data. - QString thisPublicId; - QString thisSystemId; - - QString attDeclEName; // use by parseAttlistDecl() - QString attDeclAName; // use by parseAttlistDecl() - - // flags for some features support - bool useNamespaces; - bool useNamespacePrefixes; - bool reportWhitespaceCharData; - bool reportEntities; - - // used to build the attribute list - QXmlAttributes attList; - - // used in QXmlSimpleReader::parseContent() to decide whether character - // data was read - bool contentCharDataRead; - - // helper classes - QScopedPointer<QXmlLocator> locator; - QXmlNamespaceSupport namespaceSupport; - - // error string - QString error; - - // arguments for parse functions (this is needed to allow incremental - // parsing) - bool parsePI_xmldecl; - bool parseName_useRef; - bool parseReference_charDataRead; - EntityRecognitionContext parseReference_context; - bool parseExternalID_allowPublicID; - EntityRecognitionContext parsePEReference_context; - QString parseString_s; - - // for incremental parsing - struct ParseState { - typedef bool (QXmlSimpleReaderPrivate::*ParseFunction)(); - ParseFunction function; - int state; - }; - QStack<ParseState> *parseStack; - - // used in parseProlog() - bool xmldecl_possible; - bool doctype_read; - - // used in parseDoctype() - bool startDTDwasReported; - - // used in parseString() - signed char Done; - - - // variables - QXmlContentHandler *contentHnd; - QXmlErrorHandler *errorHnd; - QXmlDTDHandler *dtdHnd; - QXmlEntityResolver *entityRes; - QXmlLexicalHandler *lexicalHnd; - QXmlDeclHandler *declHnd; - - QXmlInputSource *inputSource; - - QChar c; // the character at reading position - int lineNr; // number of line - int columnNr; // position in line - - QChar nameArray[256]; // only used for names - QString nameValue; // only used for names - int nameArrayPos; - int nameValueLen; - QChar refArray[256]; // only used for references - QString refValue; // only used for references - int refArrayPos; - int refValueLen; - QChar stringArray[256]; // used for any other strings that are parsed - QString stringValue; // used for any other strings that are parsed - int stringArrayPos; - int stringValueLen; - QString emptyStr; - - QHash<QString, int> literalEntitySizes; - // The entity at (QMap<QString,) referenced the entities at (QMap<QString,) (int>) times. - QHash<QString, QHash<QString, int> > referencesToOtherEntities; - QHash<QString, int> expandedSizes; - // The limit to the amount of times the DTD parsing functions can be called - // for the DTD currently being parsed. - static const int dtdRecursionLimit = 2; - // The maximum amount of characters an entity value may contain, after expansion. - static const int entityCharacterLimit = 1024; - - const QString &string(); - void stringClear(); - void stringAddC(QChar); - inline void stringAddC() { stringAddC(c); } - const QString &name(); - void nameClear(); - void nameAddC(QChar); - inline void nameAddC() { nameAddC(c); } - const QString &ref(); - void refClear(); - void refAddC(QChar); - inline void refAddC() { refAddC(c); } - - // private functions - bool eat_ws(); - bool next_eat_ws(); - - void QT_FASTCALL next(); - bool atEnd(); - - void init(const QXmlInputSource* i); - void initData(); - - bool entityExist(const QString&) const; - - bool parseBeginOrContinue(int state, bool incremental); - - bool parseProlog(); - bool parseElement(); - bool processElementEmptyTag(); - bool processElementETagBegin2(); - bool processElementAttribute(); - bool parseMisc(); - bool parseContent(); - - bool parsePI(); - bool parseDoctype(); - bool parseComment(); - - bool parseName(); - bool parseNmtoken(); - bool parseAttribute(); - bool parseReference(); - bool processReference(); - - bool parseExternalID(); - bool parsePEReference(); - bool parseMarkupdecl(); - bool parseAttlistDecl(); - bool parseAttType(); - bool parseAttValue(); - bool parseElementDecl(); - bool parseNotationDecl(); - bool parseChoiceSeq(); - bool parseEntityDecl(); - bool parseEntityValue(); - - bool parseString(); - - bool insertXmlRef(const QString&, const QString&, bool); - - bool reportEndEntities(); - void reportParseError(const QString& error); - - typedef bool (QXmlSimpleReaderPrivate::*ParseFunction) (); - void unexpectedEof(ParseFunction where, int state); - void parseFailed(ParseFunction where, int state); - void pushParseState(ParseFunction function, int state); - - bool isExpandedEntityValueTooLarge(QString *errorMessage); - - Q_DECLARE_PUBLIC(QXmlSimpleReader) - QXmlSimpleReader *q_ptr; - - friend class QXmlSimpleReaderLocator; -}; - /*! \class QXmlParseException \reentrant @@ -3470,7 +3226,7 @@ bool QXmlSimpleReader::parse(const QXmlInputSource *input, bool incremental) return false; } } - qt_xml_skipped_entity_in_content = false; + d->skipped_entity_in_content = false; return d->parseBeginOrContinue(0, incremental); } @@ -7834,13 +7590,13 @@ bool QXmlSimpleReaderPrivate::processReference() } if (contentHnd) { - qt_xml_skipped_entity_in_content = parseReference_context == InContent; + skipped_entity_in_content = parseReference_context == InContent; if (!contentHnd->skippedEntity(reference)) { - qt_xml_skipped_entity_in_content = false; + skipped_entity_in_content = false; reportParseError(contentHnd->errorString()); return false; // error } - qt_xml_skipped_entity_in_content = false; + skipped_entity_in_content = false; } } } else if ((*itExtern).notation.isNull()) { @@ -7870,13 +7626,13 @@ bool QXmlSimpleReaderPrivate::processReference() } } if (skipIt && contentHnd) { - qt_xml_skipped_entity_in_content = true; + skipped_entity_in_content = true; if (!contentHnd->skippedEntity(reference)) { - qt_xml_skipped_entity_in_content = false; + skipped_entity_in_content = false; reportParseError(contentHnd->errorString()); return false; // error } - qt_xml_skipped_entity_in_content = false; + skipped_entity_in_content = false; } parseReference_charDataRead = false; } break; diff --git a/src/xml/sax/qxml.h b/src/xml/sax/qxml.h index 743f8702af..2f276f75c6 100644 --- a/src/xml/sax/qxml.h +++ b/src/xml/sax/qxml.h @@ -269,6 +269,7 @@ private: QScopedPointer<QXmlSimpleReaderPrivate> d_ptr; friend class QXmlSimpleReaderLocator; + friend class QDomHandler; }; // diff --git a/src/xml/sax/qxml_p.h b/src/xml/sax/qxml_p.h new file mode 100644 index 0000000000..1cb919a554 --- /dev/null +++ b/src/xml/sax/qxml_p.h @@ -0,0 +1,308 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtXml module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXML_P_H +#define QXML_P_H + +#include <qstack.h> +#include <qmap.h> +#include <qxml.h> + +QT_BEGIN_NAMESPACE + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists for the convenience of +// qxml.cpp and qdom.cpp. This header file may change from version to version without +// notice, or even be removed. +// +// We mean it. +// + +class QXmlSimpleReaderPrivate +{ +public: + ~QXmlSimpleReaderPrivate(); +private: + // functions + QXmlSimpleReaderPrivate(QXmlSimpleReader *reader); + void initIncrementalParsing(); + + // used to determine if elements are correctly nested + QStack<QString> tags; + + // used by parseReference() and parsePEReference() + enum EntityRecognitionContext { InContent, InAttributeValue, InEntityValue, InDTD }; + + // used for entity declarations + struct ExternParameterEntity + { + ExternParameterEntity() {} + ExternParameterEntity(const QString &p, const QString &s) + : publicId(p), systemId(s) {} + QString publicId; + QString systemId; + + Q_DUMMY_COMPARISON_OPERATOR(ExternParameterEntity) + }; + struct ExternEntity + { + ExternEntity() {} + ExternEntity(const QString &p, const QString &s, const QString &n) + : publicId(p), systemId(s), notation(n) {} + QString publicId; + QString systemId; + QString notation; + Q_DUMMY_COMPARISON_OPERATOR(ExternEntity) + }; + QMap<QString,ExternParameterEntity> externParameterEntities; + QMap<QString,QString> parameterEntities; + QMap<QString,ExternEntity> externEntities; + QMap<QString,QString> entities; + + // used for parsing of entity references + struct XmlRef { + XmlRef() + : index(0) {} + XmlRef(const QString &_name, const QString &_value) + : name(_name), value(_value), index(0) {} + bool isEmpty() const { return index == value.length(); } + QChar next() { return value.at(index++); } + QString name; + QString value; + int index; + }; + QStack<XmlRef> xmlRefStack; + + // used for standalone declaration + enum Standalone { Yes, No, Unknown }; + + QString doctype; // only used for the doctype + QString xmlVersion; // only used to store the version information + QString encoding; // only used to store the encoding + Standalone standalone; // used to store the value of the standalone declaration + + QString publicId; // used by parseExternalID() to store the public ID + QString systemId; // used by parseExternalID() to store the system ID + + // Since publicId/systemId is used as temporary variables by parseExternalID(), it + // might overwrite the PUBLIC/SYSTEM for the document we're parsing. In effect, we would + // possibly send off an QXmlParseException that has the PUBLIC/SYSTEM of a entity declaration + // instead of those of the current document. + // Hence we have these two variables for storing the document's data. + QString thisPublicId; + QString thisSystemId; + + QString attDeclEName; // use by parseAttlistDecl() + QString attDeclAName; // use by parseAttlistDecl() + + // flags for some features support + bool useNamespaces; + bool useNamespacePrefixes; + bool reportWhitespaceCharData; + bool reportEntities; + + // used to build the attribute list + QXmlAttributes attList; + + // used in QXmlSimpleReader::parseContent() to decide whether character + // data was read + bool contentCharDataRead; + // Hack for letting QDom know where the skipped entity occurred + bool skipped_entity_in_content; + + // helper classes + QScopedPointer<QXmlLocator> locator; + QXmlNamespaceSupport namespaceSupport; + + // error string + QString error; + + // arguments for parse functions (this is needed to allow incremental + // parsing) + bool parsePI_xmldecl; + bool parseName_useRef; + bool parseReference_charDataRead; + EntityRecognitionContext parseReference_context; + bool parseExternalID_allowPublicID; + EntityRecognitionContext parsePEReference_context; + QString parseString_s; + + // for incremental parsing + struct ParseState { + typedef bool (QXmlSimpleReaderPrivate::*ParseFunction)(); + ParseFunction function; + int state; + }; + QStack<ParseState> *parseStack; + + // used in parseProlog() + bool xmldecl_possible; + bool doctype_read; + + // used in parseDoctype() + bool startDTDwasReported; + + // used in parseString() + signed char Done; + + + // variables + QXmlContentHandler *contentHnd; + QXmlErrorHandler *errorHnd; + QXmlDTDHandler *dtdHnd; + QXmlEntityResolver *entityRes; + QXmlLexicalHandler *lexicalHnd; + QXmlDeclHandler *declHnd; + + QXmlInputSource *inputSource; + + QChar c; // the character at reading position + int lineNr; // number of line + int columnNr; // position in line + + QChar nameArray[256]; // only used for names + QString nameValue; // only used for names + int nameArrayPos; + int nameValueLen; + QChar refArray[256]; // only used for references + QString refValue; // only used for references + int refArrayPos; + int refValueLen; + QChar stringArray[256]; // used for any other strings that are parsed + QString stringValue; // used for any other strings that are parsed + int stringArrayPos; + int stringValueLen; + QString emptyStr; + + QHash<QString, int> literalEntitySizes; + // The entity at (QMap<QString,) referenced the entities at (QMap<QString,) (int>) times. + QHash<QString, QHash<QString, int> > referencesToOtherEntities; + QHash<QString, int> expandedSizes; + // The limit to the amount of times the DTD parsing functions can be called + // for the DTD currently being parsed. + static const int dtdRecursionLimit = 2; + // The maximum amount of characters an entity value may contain, after expansion. + static const int entityCharacterLimit = 1024; + + const QString &string(); + void stringClear(); + void stringAddC(QChar); + inline void stringAddC() { stringAddC(c); } + const QString &name(); + void nameClear(); + void nameAddC(QChar); + inline void nameAddC() { nameAddC(c); } + const QString &ref(); + void refClear(); + void refAddC(QChar); + inline void refAddC() { refAddC(c); } + + // private functions + bool eat_ws(); + bool next_eat_ws(); + + void QT_FASTCALL next(); + bool atEnd(); + + void init(const QXmlInputSource* i); + void initData(); + + bool entityExist(const QString&) const; + + bool parseBeginOrContinue(int state, bool incremental); + + bool parseProlog(); + bool parseElement(); + bool processElementEmptyTag(); + bool processElementETagBegin2(); + bool processElementAttribute(); + bool parseMisc(); + bool parseContent(); + + bool parsePI(); + bool parseDoctype(); + bool parseComment(); + + bool parseName(); + bool parseNmtoken(); + bool parseAttribute(); + bool parseReference(); + bool processReference(); + + bool parseExternalID(); + bool parsePEReference(); + bool parseMarkupdecl(); + bool parseAttlistDecl(); + bool parseAttType(); + bool parseAttValue(); + bool parseElementDecl(); + bool parseNotationDecl(); + bool parseChoiceSeq(); + bool parseEntityDecl(); + bool parseEntityValue(); + + bool parseString(); + + bool insertXmlRef(const QString&, const QString&, bool); + + bool reportEndEntities(); + void reportParseError(const QString& error); + + typedef bool (QXmlSimpleReaderPrivate::*ParseFunction) (); + void unexpectedEof(ParseFunction where, int state); + void parseFailed(ParseFunction where, int state); + void pushParseState(ParseFunction function, int state); + + bool isExpandedEntityValueTooLarge(QString *errorMessage); + + Q_DECLARE_PUBLIC(QXmlSimpleReader) + QXmlSimpleReader *q_ptr; + + friend class QXmlSimpleReaderLocator; + friend class QDomHandler; +}; + +QT_END_NAMESPACE + +#endif // QXML_P_H diff --git a/tests/auto/corelib/io/qdir/tst_qdir.cpp b/tests/auto/corelib/io/qdir/tst_qdir.cpp index 2bac6f5834..cf7cdc874c 100644 --- a/tests/auto/corelib/io/qdir/tst_qdir.cpp +++ b/tests/auto/corelib/io/qdir/tst_qdir.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. @@ -72,8 +72,12 @@ class tst_QDir : public QObject { Q_OBJECT +public: + tst_QDir(); + private slots: void init(); + void initTestCase(); void cleanupTestCase(); void getSetCheck(); @@ -198,19 +202,25 @@ private slots: void cdBelowRoot(); private: - QString m_dataPath; + const QString m_dataPath; }; -void tst_QDir::init() +tst_QDir::tst_QDir() + : m_dataPath(QFileInfo(QFINDTESTDATA("testData")).absolutePath()) { - // Directory under which testdata can be found. - m_dataPath = QFileInfo(QFINDTESTDATA("testData")).absolutePath(); - QVERIFY2(!m_dataPath.isEmpty(), "test data not found"); +} +void tst_QDir::init() +{ // Some tests want to use "." as relative path to data. QVERIFY2(QDir::setCurrent(m_dataPath), qPrintable("Could not chdir to " + m_dataPath)); } +void tst_QDir::initTestCase() +{ + QVERIFY2(!m_dataPath.isEmpty(), "test data not found"); +} + void tst_QDir::cleanupTestCase() { QDir(QDir::currentPath() + "/tmpdir").removeRecursively(); diff --git a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp index 26eaec0470..ec698e5db4 100644 --- a/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp +++ b/tests/auto/gui/text/qtextlayout/tst_qtextlayout.cpp @@ -139,6 +139,7 @@ private slots: void cursorInLigatureWithMultipleLines(); void xToCursorForLigatures(); void cursorInNonStopChars(); + void nbsp(); private: QFont testFont; @@ -2011,5 +2012,28 @@ void tst_QTextLayout::justifyTrailingSpaces() QVERIFY(qFuzzyIsNull(layout.lineAt(0).cursorToX(0))); } +void tst_QTextLayout::nbsp() +{ + QString s = QString() + QChar(' ') + QChar('a') + QString(10, QChar::Nbsp) + QChar('a') + QChar(' ') + QChar('A'); + QString text = s + s + s + s + s + s + s + s + s + s + s + s + s + s; + QTextLayout layout(text); + layout.setCacheEnabled(true); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + + int naturalWidth = qCeil(layout.lineAt(0).naturalTextWidth()); + int lineWidth = naturalWidth; + + layout.beginLayout(); + QTextLine line = layout.createLine(); + while (lineWidth-- > naturalWidth / 2) { + line.setLineWidth(lineWidth); + QVERIFY(text.at(line.textLength()-1).unicode() != QChar::Nbsp); + } + + layout.endLayout(); +} + QTEST_MAIN(tst_QTextLayout) #include "tst_qtextlayout.moc" diff --git a/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-nic-india-2007.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-nic-india-2007.pem new file mode 100644 index 0000000000..2106f66332 --- /dev/null +++ b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-nic-india-2007.pem @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIENjCCAx6gAwIBAgICJ4MwDQYJKoZIhvcNAQEFBQAwOjELMAkGA1UEBhMCSU4x +EjAQBgNVBAoTCUluZGlhIFBLSTEXMBUGA1UEAxMOQ0NBIEluZGlhIDIwMDcwHhcN +MDcwNzAyMDY0MTU5WhcNMTUwNzA0MDYzMDAwWjCBsDELMAkGA1UEBhMCSU4xJDAi +BgNVBAoTG05hdGlvbmFsIEluZm9ybWF0aWNzIENlbnRyZTEOMAwGA1UECxMFTklD +Q0ExITAfBgNVBAMTGE5JQyBDZXJ0aWZ5aW5nIEF1dGhvcml0eTESMBAGA1UEBxMJ +TmV3IERlbGhpMSQwIgYJKoZIhvcNAQkBFhVzdXBwb3J0QGNhbWFpbC5uaWMuaW4x +DjAMBgNVBAgTBURlbGhpMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA +wLRKDEWWC1iWcxpVgA7GJEjQVjGIMx9XPLoaMKXiEQdajHgmjKdOhlFkSWiHgiCS +Uo39U0/UoC4rAYzBCcfHWdAGjXNs7dt/cz+muK2aMoPoAgXWLF2A48CJMrTcyNFE +HryIYJeCiK8DTlEhBxL8II9VBx8qKSquizh4MQTmpqvfjHNqd6qCHF6q8W439io5 +kVIFnGNd/p0V5HFv0OpWeF/IpKJA1m1lb729FwfsVpqipf7DLVQUKtSjK/32RDtB +hnAmkDlW6IZRPs2F896A5COPSDjJlAeUX8JqDnBOr64bPRgUy0VDnW/soRB3knkn +5w5ueXj3DrgONtjGcBSwVwIDAQABo4HOMIHLMA8GA1UdEwEB/wQFMAMBAf8wEQYD +VR0OBAoECEwne24Nsv9UMBMGA1UdIwQMMAqACE8ewFgn2LjkMAsGA1UdDwQEAwIB +BjCBggYDVR0fBHsweTB3oHWgc4ZxbGRhcDovL25yZGMuY2NhLmdvdi5pbjozODkv +Y249Q0NBIEluZGlhIDIwMDcsb3U9Q0NBIEluZGlhIDIwMDcsbz1JbmRpYSBQS0ks +Yz1JTj9jZXJ0aWZpY2F0ZXJldm9jYXRpb25saXN0O2JpbmFyeT8wDQYJKoZIhvcN +AQEFBQADggEBAKx6RkVgMGQADgl4jTy3qBDq8nvkegDaDnviTUsGzsR6RpooT0xd +wuKiRU0I7p2gAo6uBTMEZtS+XWJz+7xlfo4fao5XIU4e1fxkQuxddM23/J7M4+Uz +3pL7ziK5RcVizhQqz3IjSH440/OoFhUBT5d5WWN0hliEcr7+6nLPAOcAX/qR509a +Djd/aonfyQFCMyfiPpYLx5ElTuqUZeHApJ58+Iprwbu3EIux+C+mfS8QCMY+WYje +aocCIwIutrmoxIXxGy9yV5OKIe2+4wsCT8aNin+6AV7qNTmFVhp+MF50v69ONTO7 +w2Sa+ire2N5FgklMW2WTCi8d8rwLzaWuse4= +-----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-nic-india-2011.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-nic-india-2011.pem new file mode 100644 index 0000000000..d3a8c10502 --- /dev/null +++ b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-nic-india-2011.pem @@ -0,0 +1,26 @@ +-----BEGIN CERTIFICATE----- +MIIEWzCCA0OgAwIBAgICJ5IwDQYJKoZIhvcNAQELBQAwOjELMAkGA1UEBhMCSU4x +EjAQBgNVBAoTCUluZGlhIFBLSTEXMBUGA1UEAxMOQ0NBIEluZGlhIDIwMTEwHhcN +MTEwMzExMDgxNTExWhcNMTYwMzExMDYzMDAwWjCByDELMAkGA1UEBhMCSU4xJDAi +BgNVBAoTG05hdGlvbmFsIEluZm9ybWF0aWNzIENlbnRyZTEdMBsGA1UECxMUQ2Vy +dGlmeWluZyBBdXRob3JpdHkxDzANBgNVBBETBjExMDAwMzEOMAwGA1UECBMFRGVs +aGkxHjAcBgNVBAkTFUxvZGhpIFJvYWQsIE5ldyBEZWxoaTEdMBsGA1UEMwwUQS1C +bG9jaywgQ0dPIENvbXBsZXgxFDASBgNVBAMTC05JQyBDQSAyMDExMIIBIjANBgkq +hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7J/N88MoXcCHTz4A5DKF59+8kvSnriGr +TEowLSa5NCvH+o89+Mf7V260kKZJ/hQox5RG/F8/gY7u9ziLeypbedeG8EIl88HC +4x9hT0SNLsrj9qo90waDuGYB4/KQ8q5E6ivVxxV0epzQfFA5A5biKltPBbku/M4D +iZ+TqBbHxo6nRUEZoukJi0+JLykGI4VpJlQBzow04omxQUZHzvCffo6QvN6FdzZ0 +MopwqaggyfHDFu9o4elCR9Kd/obYlgXAHLYwJlN0pybbe2WpKj81/pxDhKgxrVN+ +OZaI5OMBBkjDRQG+ZyEnQb8XYMNPJbOgQGYgsRdPPjIn7poTzxe7SQIDAQABo4Hb +MIHYMBIGA1UdEwEB/wQIMAYBAf8CAQEwEQYDVR0OBAoECE5VT66z36FmMBIGA1Ud +IAQLMAkwBwYFYIJkZAIwEwYDVR0jBAwwCoAITQeoY/LbHN8wLgYIKwYBBQUHAQEE +IjAgMB4GCCsGAQUFBzABhhJodHRwOi8vb2N2cy5nb3YuaW4wDgYDVR0PAQH/BAQD +AgEGMEYGA1UdHwQ/MD0wO6A5oDeGNWh0dHA6Ly9jY2EuZ292LmluL3J3L3Jlc291 +cmNlcy9DQ0FJbmRpYTIwMTFMYXRlc3QuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQB5 +LCqtHbxfO72KRWJbW9dAHNh2xh8n7wstNgSPHLbjL5B0l7RZlCFauy4fjc2faMiB +xnOq5oEXeIZBrT2NkuEymQ8f0Pzm3pcXrMkFrj78SiA07/cPQShBKKpw39t6puJV +8ykiVZMZvSCjCzzZZlVO12b2ChADkf6wtseftx5O/zBsqP3Y2+3+KvEeDVtuseKu +FV2OxSsqSfffJq7IYTwpRPOVzHGJnjV3Igtj3zAzZm8CWxRM/yhnkGyVc+xz/T7o +WY0870eciR+bmLjZ9j0opudZR6e+lCsMHH2Lxc8C/0XRcCzcganxfWCb/fb0gx44 +iY0a+wWCVebjuyKU/BXk +-----END CERTIFICATE----- diff --git a/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-nic-india-2014.pem b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-nic-india-2014.pem new file mode 100644 index 0000000000..54670866d5 --- /dev/null +++ b/tests/auto/network/ssl/qsslcertificate/more-certificates/blacklisted-nic-india-2014.pem @@ -0,0 +1,26 @@ +-----BEGIN CERTIFICATE----- +MIIEWzCCA0OgAwIBAgICJ7EwDQYJKoZIhvcNAQELBQAwOjELMAkGA1UEBhMCSU4x +EjAQBgNVBAoTCUluZGlhIFBLSTEXMBUGA1UEAxMOQ0NBIEluZGlhIDIwMTQwHhcN +MTQwMzA1MTExNTI0WhcNMjQwMzA1MDYzMDAwWjCByDELMAkGA1UEBhMCSU4xJDAi +BgNVBAoTG05hdGlvbmFsIEluZm9ybWF0aWNzIENlbnRyZTEdMBsGA1UECxMUQ2Vy +dGlmeWluZyBBdXRob3JpdHkxDzANBgNVBBETBjExMDAwMzEOMAwGA1UECBMFRGVs +aGkxHjAcBgNVBAkTFUxvZGhpIFJvYWQsIE5ldyBEZWxoaTEdMBsGA1UEMxMUQS1C +bG9jaywgQ0dPIENvbXBsZXgxFDASBgNVBAMTC05JQyBDQSAyMDE0MIIBIjANBgkq +hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA/OQ56Ge9MhJiBwtOlCJP4p5gjcCuqkQ2 +6BCSQgfAsxyNxAwtL1f0h3d5KNFIInIG2Y9PwBgUrgavOWy2cZICxgXIGaOzK5bI +TyGhxYMPUzkazGppfj0ScW7Ed/kjeDnic3WlYkPwtNaV1qwTElr8zqPUtT27ZDqd +6upor9MICngXAC1tHjhPuGrGtu4i6FMPrmkofwdh8dkuRzU/OPjf9lA+E9Qu0Nvq +soI9grJA0etgRfn9juR4X3KTG21qHnza50PpMYC4+vh8jAnIT7Kcz8Ggr4eghkvP ++iz2yEtIcV9M1xeo98XU/jxuYS7LeWtO79jkiqCIqgI8T3x7LHuCaQIDAQABo4Hb +MIHYMBIGA1UdEwEB/wQIMAYBAf8CAQEwEQYDVR0OBAoECEZwyi8lTsNHMBIGA1Ud +IAQLMAkwBwYFYIJkZAIwEwYDVR0jBAwwCoAIQrjFz22zV+EwLgYIKwYBBQUHAQEE +IjAgMB4GCCsGAQUFBzABhhJodHRwOi8vb2N2cy5nb3YuaW4wDgYDVR0PAQH/BAQD +AgEGMEYGA1UdHwQ/MD0wO6A5oDeGNWh0dHA6Ly9jY2EuZ292LmluL3J3L3Jlc291 +cmNlcy9DQ0FJbmRpYTIwMTRMYXRlc3QuY3JsMA0GCSqGSIb3DQEBCwUAA4IBAQCB +i3iJeUlkfjY96HgfBIUEsLi+knO3VUrxDmwps1YyhgRSt22NQLZ4jksSWLI2EQbn +9k5tH8rwSbsOWf+TZH7jpaKAVSYi1GhEbGR/C2ZeFiWATwtPWKoVGwx/ksUO9YPM +zf0wh6fDIuyBJIs/nuN93+L2ib+TS5viNky+HrR3XyqE0z43W5bbzMbido3lbwgr +drMWD6hCNSZs888L0Se4rn2ei0aPmHmxjDjbExF3NF6m2uYC/wAR4cVIzMvvptFY +n+SAdG/pwkKHaMVncB/cxxEWiKzOxVpjBsM4N19lpxp2RU/n+x7xRK3WTQvNAZdU +7pcAYmZIXPu/ES9qpK4f +-----END CERTIFICATE----- |