Merge remote-tracking branch 'origin/5.3' into dev
Change-Id: Ia12ffdb27ecdf25c2a2bdb0eed1945387502108a
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 22 KiB |
@ -1,7 +1,7 @@
|
|||||||
contains(TEMPLATE, ".*app") {
|
contains(TEMPLATE, ".*app") {
|
||||||
!android_app {
|
!android_app {
|
||||||
!contains(TARGET, ".so"): TARGET = lib$${TARGET}.so
|
!contains(TARGET, ".so"): TARGET = lib$${TARGET}.so
|
||||||
QMAKE_LFLAGS += -Wl,-soname,$$TARGET
|
QMAKE_LFLAGS += -Wl,-soname,$$shell_quote($$TARGET)
|
||||||
|
|
||||||
android_install: {
|
android_install: {
|
||||||
target.path=/libs/$$ANDROID_TARGET_ARCH/
|
target.path=/libs/$$ANDROID_TARGET_ARCH/
|
||||||
|
@ -59,7 +59,8 @@ int main(int argc, char *argv[])
|
|||||||
parser.addOption(showProgressOption);
|
parser.addOption(showProgressOption);
|
||||||
|
|
||||||
// A boolean option with multiple names (-f, --force)
|
// 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);
|
parser.addOption(forceOption);
|
||||||
|
|
||||||
// An option with a value
|
// An option with a value
|
||||||
|
@ -57,16 +57,22 @@ class QFlag
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
public:
|
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(long ai) : i(int(ai)) {}
|
||||||
Q_DECL_CONSTEXPR inline QFlag(ulong ai) : i(int(long(ai))) {}
|
Q_DECL_CONSTEXPR inline QFlag(ulong ai) : i(int(long(ai))) {}
|
||||||
#endif
|
# endif
|
||||||
Q_DECL_CONSTEXPR inline QFlag(int ai) : i(ai) {}
|
|
||||||
Q_DECL_CONSTEXPR inline QFlag(uint ai) : i(int(ai)) {}
|
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(short ai) : i(int(ai)) {}
|
||||||
Q_DECL_CONSTEXPR inline QFlag(ushort ai) : i(int(uint(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); }
|
Q_DECL_CONSTEXPR inline operator uint() const { return uint(i); }
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
Q_DECLARE_TYPEINFO(QFlag, Q_PRIMITIVE_TYPE);
|
Q_DECLARE_TYPEINFO(QFlag, Q_PRIMITIVE_TYPE);
|
||||||
|
|
||||||
@ -93,7 +99,11 @@ class QFlags
|
|||||||
struct Private;
|
struct Private;
|
||||||
typedef int (Private::*Zero);
|
typedef int (Private::*Zero);
|
||||||
public:
|
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_<
|
typedef typename QtPrivate::if_<
|
||||||
QtPrivate::is_unsigned<Enum>::value,
|
QtPrivate::is_unsigned<Enum>::value,
|
||||||
unsigned int,
|
unsigned int,
|
||||||
@ -103,7 +113,6 @@ public:
|
|||||||
typedef Enum enum_type;
|
typedef Enum enum_type;
|
||||||
// compiler-generated copy/move ctor/assignment operators are fine!
|
// compiler-generated copy/move ctor/assignment operators are fine!
|
||||||
#ifdef Q_QDOC
|
#ifdef Q_QDOC
|
||||||
typedef int Int; // the real typedef above is too complex for qdoc
|
|
||||||
inline QFlags(const QFlags &other);
|
inline QFlags(const QFlags &other);
|
||||||
inline QFlags &operator=(const QFlags &other);
|
inline QFlags &operator=(const QFlags &other);
|
||||||
#endif
|
#endif
|
||||||
|
@ -67,6 +67,19 @@ static QString qt_convertJString(jstring string)
|
|||||||
return res;
|
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;
|
typedef QHash<QString, jclass> JClassHash;
|
||||||
Q_GLOBAL_STATIC(JClassHash, cachedClasses)
|
Q_GLOBAL_STATIC(JClassHash, cachedClasses)
|
||||||
|
|
||||||
@ -85,14 +98,8 @@ static jclass getCachedClass(JNIEnv *env, const char *className)
|
|||||||
QJNIObjectPrivate classObject = classLoader.callObjectMethod("loadClass",
|
QJNIObjectPrivate classObject = classLoader.callObjectMethod("loadClass",
|
||||||
"(Ljava/lang/String;)Ljava/lang/Class;",
|
"(Ljava/lang/String;)Ljava/lang/Class;",
|
||||||
stringName.object());
|
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()));
|
clazz = static_cast<jclass>(env->NewGlobalRef(classObject.object()));
|
||||||
|
|
||||||
cachedClasses->insert(key, clazz);
|
cachedClasses->insert(key, clazz);
|
||||||
@ -121,13 +128,8 @@ static jmethodID getCachedMethodID(JNIEnv *env,
|
|||||||
else
|
else
|
||||||
id = env->GetMethodID(clazz, name, sig);
|
id = env->GetMethodID(clazz, name, sig);
|
||||||
|
|
||||||
if (env->ExceptionCheck()) {
|
if (exceptionCheckAndClear(env))
|
||||||
id = 0;
|
id = 0;
|
||||||
#ifdef QT_DEBUG
|
|
||||||
env->ExceptionDescribe();
|
|
||||||
#endif // QT_DEBUG
|
|
||||||
env->ExceptionClear();
|
|
||||||
}
|
|
||||||
|
|
||||||
cachedMethodID->insert(key, id);
|
cachedMethodID->insert(key, id);
|
||||||
} else {
|
} else {
|
||||||
@ -154,13 +156,8 @@ static jfieldID getCachedFieldID(JNIEnv *env,
|
|||||||
else
|
else
|
||||||
id = env->GetFieldID(clazz, name, sig);
|
id = env->GetFieldID(clazz, name, sig);
|
||||||
|
|
||||||
if (env->ExceptionCheck()) {
|
if (exceptionCheckAndClear(env))
|
||||||
id = 0;
|
id = 0;
|
||||||
#ifdef QT_DEBUG
|
|
||||||
env->ExceptionDescribe();
|
|
||||||
#endif // QT_DEBUG
|
|
||||||
env->ExceptionClear();
|
|
||||||
}
|
|
||||||
|
|
||||||
cachedFieldID->insert(key, id);
|
cachedFieldID->insert(key, id);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1026,7 +1026,8 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State
|
|||||||
d->engine->addFile(fileName, size, mode, state);
|
d->engine->addFile(fileName, size, mode, state);
|
||||||
|
|
||||||
// Check if a "@2x" file exists and add it.
|
// 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('.'));
|
int dotIndex = fileName.lastIndexOf(QLatin1Char('.'));
|
||||||
if (dotIndex != -1) {
|
if (dotIndex != -1) {
|
||||||
QString at2xfileName = fileName;
|
QString at2xfileName = fileName;
|
||||||
|
@ -1246,8 +1246,9 @@ bool QImageReader::read(QImage *image)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// successful read; check for "@2x" file name suffix and set device pixel ratio.
|
// successful read; check for "@2x" file name suffix and set device pixel ratio.
|
||||||
if (QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))) {
|
static bool disable2xImageLoading = !qgetenv("QT_HIGHDPI_DISABLE_2X_IMAGE_LOADING").isEmpty();
|
||||||
image->setDevicePixelRatio(2.0);
|
if (!disable2xImageLoading && QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))) {
|
||||||
|
image->setDevicePixelRatio(2.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -3561,7 +3561,7 @@ QDebug operator<<(QDebug dbg, const QEvent *e) {
|
|||||||
case QEvent::TouchEnd:
|
case QEvent::TouchEnd:
|
||||||
n = n ? n : "TouchEnd";
|
n = n ? n : "TouchEnd";
|
||||||
formatTouchEvent(dbg.nospace(), n, *static_cast<const QTouchEvent*>(e));
|
formatTouchEvent(dbg.nospace(), n, *static_cast<const QTouchEvent*>(e));
|
||||||
return dbg.nospace();
|
return dbg.space();
|
||||||
case QEvent::ChildAdded: n = n ? n : "ChildAdded";
|
case QEvent::ChildAdded: n = n ? n : "ChildAdded";
|
||||||
case QEvent::ChildPolished: n = n ? n : "ChildPolished";
|
case QEvent::ChildPolished: n = n ? n : "ChildPolished";
|
||||||
case QEvent::ChildRemoved: n = n ? n : "ChildRemoved";
|
case QEvent::ChildRemoved: n = n ? n : "ChildRemoved";
|
||||||
|
@ -160,7 +160,7 @@ void QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(QOpenGLContext *con
|
|||||||
|
|
||||||
A pointer to an object of the class corresponding to the version and
|
A pointer to an object of the class corresponding to the version and
|
||||||
profile of OpenGL in use can be obtained from
|
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
|
the QOpenGLContext retains ownership of the object. This is so that only
|
||||||
one instance need be created.
|
one instance need be created.
|
||||||
|
|
||||||
|
@ -2362,7 +2362,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
|
|||||||
data.resize(bytesPerLine * h);
|
data.resize(bytesPerLine * h);
|
||||||
char *rawdata = data.data();
|
char *rawdata = data.data();
|
||||||
for (int y = 0; y < h; ++y) {
|
for (int y = 0; y < h; ++y) {
|
||||||
memcpy(rawdata, image.scanLine(y), bytesPerLine);
|
memcpy(rawdata, image.constScanLine(y), bytesPerLine);
|
||||||
rawdata += bytesPerLine;
|
rawdata += bytesPerLine;
|
||||||
}
|
}
|
||||||
object = writeImage(data, w, h, d, 0, 0);
|
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);
|
softMaskData.resize(w * h);
|
||||||
uchar *sdata = (uchar *)softMaskData.data();
|
uchar *sdata = (uchar *)softMaskData.data();
|
||||||
for (int y = 0; y < h; ++y) {
|
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) {
|
for (int x = 0; x < w; ++x) {
|
||||||
uchar alpha = qAlpha(*rgb);
|
uchar alpha = qAlpha(*rgb);
|
||||||
*sdata++ = alpha;
|
*sdata++ = alpha;
|
||||||
@ -2400,7 +2400,7 @@ int QPdfEnginePrivate::addImage(const QImage &img, bool *bitmap, qint64 serial_n
|
|||||||
softMaskData.resize(w * h);
|
softMaskData.resize(w * h);
|
||||||
uchar *sdata = (uchar *)softMaskData.data();
|
uchar *sdata = (uchar *)softMaskData.data();
|
||||||
for (int y = 0; y < h; ++y) {
|
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) {
|
if (grayscale) {
|
||||||
for (int x = 0; x < w; ++x) {
|
for (int x = 0; x < w; ++x) {
|
||||||
*(data++) = qGray(*rgb);
|
*(data++) = qGray(*rgb);
|
||||||
|
@ -1292,8 +1292,12 @@ int QTextEngine::shapeTextWithHarfbuzz(const QScriptItem &si, const ushort *stri
|
|||||||
attrs.justification = hbAttrs.justification;
|
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;
|
shaper_item.log_clusters[i] += glyph_pos;
|
||||||
|
}
|
||||||
|
|
||||||
if (kerningEnabled && !shaper_item.kerning_applied)
|
if (kerningEnabled && !shaper_item.kerning_applied)
|
||||||
actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0));
|
actualFontEngine->doKerning(&g, option.useDesignMetrics() ? QFontEngine::DesignMetrics : QFontEngine::ShaperFlags(0));
|
||||||
|
@ -1843,8 +1843,17 @@ void QTextLine::layout_helper(int maxGlyphs)
|
|||||||
addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount,
|
addNextCluster(lbh.currentPosition, end, lbh.tmpData, lbh.glyphCount,
|
||||||
current, lbh.logClusters, lbh.glyphs);
|
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()
|
if (lbh.currentPosition >= eng->layoutData->string.length()
|
||||||
|| attributes[lbh.currentPosition].whiteSpace
|
|| isBreakableSpace
|
||||||
|| attributes[lbh.currentPosition].lineBreak) {
|
|| attributes[lbh.currentPosition].lineBreak) {
|
||||||
sb_or_ws = true;
|
sb_or_ws = true;
|
||||||
break;
|
break;
|
||||||
|
@ -1255,6 +1255,9 @@ static const char *certificate_blacklist[] = {
|
|||||||
"08:64", "e-islem.kktcmerkezbankasi.org", // Turktrust mis-issued intermediate certificate
|
"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
|
"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
|
0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -2069,7 +2069,10 @@ bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const
|
|||||||
connection.send(message.createReply(true));
|
connection.send(message.createReply(true));
|
||||||
} else if (function == QLatin1String("SetTextContents")) {
|
} else if (function == QLatin1String("SetTextContents")) {
|
||||||
QString newContents = message.arguments().at(0).toString();
|
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));
|
connection.send(message.createReply(true));
|
||||||
} else if (function == QLatin1String("")) {
|
} else if (function == QLatin1String("")) {
|
||||||
connection.send(message.createReply());
|
connection.send(message.createReply());
|
||||||
@ -2083,23 +2086,27 @@ bool AtSpiAdaptor::editableTextInterface(QAccessibleInterface *interface, const
|
|||||||
// Value interface
|
// Value interface
|
||||||
bool AtSpiAdaptor::valueInterface(QAccessibleInterface *interface, const QString &function, const QDBusMessage &message, const QDBusConnection &connection)
|
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")) {
|
if (function == QLatin1String("SetCurrentValue")) {
|
||||||
QDBusVariant v = message.arguments().at(2).value<QDBusVariant>();
|
QDBusVariant v = message.arguments().at(2).value<QDBusVariant>();
|
||||||
double value = v.variant().toDouble();
|
double value = v.variant().toDouble();
|
||||||
//Temporary fix
|
//Temporary fix
|
||||||
//See https://bugzilla.gnome.org/show_bug.cgi?id=652596
|
//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?
|
connection.send(message.createReply()); // FIXME is the reply needed?
|
||||||
} else {
|
} else {
|
||||||
QVariant value;
|
QVariant value;
|
||||||
if (function == QLatin1String("GetCurrentValue"))
|
if (function == QLatin1String("GetCurrentValue"))
|
||||||
value = interface->valueInterface()->currentValue();
|
value = valueIface->currentValue();
|
||||||
else if (function == QLatin1String("GetMaximumValue"))
|
else if (function == QLatin1String("GetMaximumValue"))
|
||||||
value = interface->valueInterface()->maximumValue();
|
value = valueIface->maximumValue();
|
||||||
else if (function == QLatin1String("GetMinimumIncrement"))
|
else if (function == QLatin1String("GetMinimumIncrement"))
|
||||||
value = interface->valueInterface()->minimumStepSize();
|
value = valueIface->minimumStepSize();
|
||||||
else if (function == QLatin1String("GetMinimumValue"))
|
else if (function == QLatin1String("GetMinimumValue"))
|
||||||
value = interface->valueInterface()->minimumValue();
|
value = valueIface->minimumValue();
|
||||||
else {
|
else {
|
||||||
qAtspiDebug() << "WARNING: AtSpiAdaptor::valueInterface does not implement " << function << message.path();
|
qAtspiDebug() << "WARNING: AtSpiAdaptor::valueInterface does not implement " << function << message.path();
|
||||||
return false;
|
return false;
|
||||||
|
@ -562,13 +562,13 @@ static void setDisplayMetrics(JNIEnv */*env*/, jclass /*clazz*/,
|
|||||||
if (!m_androidPlatformIntegration) {
|
if (!m_androidPlatformIntegration) {
|
||||||
QAndroidPlatformIntegration::setDefaultDisplayMetrics(desktopWidthPixels,
|
QAndroidPlatformIntegration::setDefaultDisplayMetrics(desktopWidthPixels,
|
||||||
desktopHeightPixels,
|
desktopHeightPixels,
|
||||||
qRound(double(desktopWidthPixels) / xdpi * 25.4),
|
qRound(double(widthPixels) / xdpi * 25.4),
|
||||||
qRound(double(desktopHeightPixels) / ydpi * 25.4),
|
qRound(double(heightPixels) / ydpi * 25.4),
|
||||||
widthPixels,
|
widthPixels,
|
||||||
heightPixels);
|
heightPixels);
|
||||||
} else {
|
} else {
|
||||||
m_androidPlatformIntegration->setDisplayMetrics(qRound(double(desktopWidthPixels) / xdpi * 25.4),
|
m_androidPlatformIntegration->setDisplayMetrics(qRound(double(widthPixels) / xdpi * 25.4),
|
||||||
qRound(double(desktopHeightPixels) / ydpi * 25.4));
|
qRound(double(heightPixels) / ydpi * 25.4));
|
||||||
m_androidPlatformIntegration->setDesktopSize(desktopWidthPixels, desktopHeightPixels);
|
m_androidPlatformIntegration->setDesktopSize(desktopWidthPixels, desktopHeightPixels);
|
||||||
m_androidPlatformIntegration->setScreenSize(widthPixels, heightPixels);
|
m_androidPlatformIntegration->setScreenSize(widthPixels, heightPixels);
|
||||||
}
|
}
|
||||||
|
@ -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()) {
|
if (found.isEmpty()) {
|
||||||
QTest::qWarn(qPrintable(
|
QTest::qWarn(qPrintable(
|
||||||
QString::fromLatin1("testdata %1 could not be located!").arg(base)),
|
QString::fromLatin1("testdata %1 could not be located!").arg(base)),
|
||||||
|
@ -1072,7 +1072,7 @@
|
|||||||
|
|
||||||
\code
|
\code
|
||||||
qhp.Qt.file = qt.qhp
|
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.virtualFolder = qdoc
|
||||||
qhp.Qt.indexTitle = Qt Reference Documentation
|
qhp.Qt.indexTitle = Qt Reference Documentation
|
||||||
qhp.Qt.indexRoot =
|
qhp.Qt.indexRoot =
|
||||||
|
@ -301,7 +301,7 @@
|
|||||||
pass a QPainterPath to mapToScene(), and then pass the mapped path
|
pass a QPainterPath to mapToScene(), and then pass the mapped path
|
||||||
to QGraphicsScene::items().
|
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
|
calling QGraphicsItem::mapToScene() and
|
||||||
QGraphicsItem::mapFromScene(). You can also map to an item's parent
|
QGraphicsItem::mapFromScene(). You can also map to an item's parent
|
||||||
item by calling QGraphicsItem::mapToParent() and
|
item by calling QGraphicsItem::mapToParent() and
|
||||||
|
@ -1325,6 +1325,11 @@ void QListWidgetPrivate::_q_dataChanged(const QModelIndex &topLeft,
|
|||||||
\fn void QListWidget::removeItemWidget(QListWidgetItem *item)
|
\fn void QListWidget::removeItemWidget(QListWidgetItem *item)
|
||||||
|
|
||||||
Removes the widget set on the given \a 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
|
\since 4.1
|
||||||
|
|
||||||
Returns the widget displayed in the given \a item.
|
Returns the widget displayed in the given \a item.
|
||||||
|
|
||||||
|
\sa setItemWidget(), removeItemWidget()
|
||||||
*/
|
*/
|
||||||
QWidget *QListWidget::itemWidget(QListWidgetItem *item) const
|
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
|
implement a custom editor widget, use QListView and subclass QItemDelegate
|
||||||
instead.
|
instead.
|
||||||
|
|
||||||
\sa {Delegate Classes}
|
\sa itemWidget(), removeItemWidget(), {Delegate Classes}
|
||||||
*/
|
*/
|
||||||
void QListWidget::setItemWidget(QListWidgetItem *item, QWidget *widget)
|
void QListWidget::setItemWidget(QListWidgetItem *item, QWidget *widget)
|
||||||
{
|
{
|
||||||
|
@ -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
|
We recommend that widgets do not cache this value as it may change at any
|
||||||
time if the user changes the global desktop settings.
|
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)
|
void QApplication::setCursorFlashTime(int msecs)
|
||||||
{
|
{
|
||||||
|
@ -1474,7 +1474,7 @@ void QWidgetLineControl::setCursorBlinkPeriod(int msec)
|
|||||||
if (m_blinkTimer) {
|
if (m_blinkTimer) {
|
||||||
killTimer(m_blinkTimer);
|
killTimer(m_blinkTimer);
|
||||||
}
|
}
|
||||||
if (msec && !m_readOnly) {
|
if (msec > 0 && !m_readOnly) {
|
||||||
m_blinkTimer = startTimer(msec / 2);
|
m_blinkTimer = startTimer(msec / 2);
|
||||||
m_blinkStatus = 1;
|
m_blinkStatus = 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -30,11 +30,9 @@ depends += qtcore qtnetwork qtdoc
|
|||||||
|
|
||||||
headerdirs += ..
|
headerdirs += ..
|
||||||
|
|
||||||
sourcedirs += .. \
|
sourcedirs += ..
|
||||||
../../../examples/xml/doc/src
|
|
||||||
|
|
||||||
exampledirs += ../../../examples/xml \
|
exampledirs += ../../../examples/xml \
|
||||||
../ \
|
|
||||||
snippets
|
snippets
|
||||||
|
|
||||||
imagedirs += images \
|
imagedirs += images \
|
||||||
|
@ -54,6 +54,7 @@
|
|||||||
#include <qtextcodec.h>
|
#include <qtextcodec.h>
|
||||||
#include <qtextstream.h>
|
#include <qtextstream.h>
|
||||||
#include <qxml.h>
|
#include <qxml.h>
|
||||||
|
#include "private/qxml_p.h"
|
||||||
#include <qvariant.h>
|
#include <qvariant.h>
|
||||||
#include <qmap.h>
|
#include <qmap.h>
|
||||||
#include <qshareddata.h>
|
#include <qshareddata.h>
|
||||||
@ -502,7 +503,7 @@ public:
|
|||||||
~QDomDocumentPrivate();
|
~QDomDocumentPrivate();
|
||||||
|
|
||||||
bool setContent(QXmlInputSource *source, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn);
|
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
|
// Attributes
|
||||||
QDomDocumentTypePrivate* doctype() { return type.data(); }
|
QDomDocumentTypePrivate* doctype() { return type.data(); }
|
||||||
@ -573,7 +574,7 @@ public:
|
|||||||
class QDomHandler : public QXmlDefaultHandler
|
class QDomHandler : public QXmlDefaultHandler
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QDomHandler(QDomDocumentPrivate* d, bool namespaceProcessing);
|
QDomHandler(QDomDocumentPrivate* d, QXmlSimpleReader *reader, bool namespaceProcessing);
|
||||||
~QDomHandler();
|
~QDomHandler();
|
||||||
|
|
||||||
// content handler
|
// content handler
|
||||||
@ -615,6 +616,7 @@ private:
|
|||||||
bool cdata;
|
bool cdata;
|
||||||
bool nsProcessing;
|
bool nsProcessing;
|
||||||
QXmlLocator *locator;
|
QXmlLocator *locator;
|
||||||
|
QXmlSimpleReader *reader;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**************************************************************
|
/**************************************************************
|
||||||
@ -6208,10 +6210,10 @@ bool QDomDocumentPrivate::setContent(QXmlInputSource *source, bool namespaceProc
|
|||||||
{
|
{
|
||||||
QXmlSimpleReader reader;
|
QXmlSimpleReader reader;
|
||||||
initializeReader(reader, namespaceProcessing);
|
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();
|
clear();
|
||||||
impl = new QDomImplementationPrivate;
|
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"))
|
bool namespaceProcessing = reader->feature(QLatin1String("http://xml.org/sax/features/namespaces"))
|
||||||
&& !reader->feature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"));
|
&& !reader->feature(QLatin1String("http://xml.org/sax/features/namespace-prefixes"));
|
||||||
|
|
||||||
QDomHandler hnd(this, namespaceProcessing);
|
QDomHandler hnd(this, simpleReader, namespaceProcessing);
|
||||||
reader->setContentHandler(&hnd);
|
reader->setContentHandler(&hnd);
|
||||||
reader->setErrorHandler(&hnd);
|
reader->setErrorHandler(&hnd);
|
||||||
reader->setLexicalHandler(&hnd);
|
reader->setLexicalHandler(&hnd);
|
||||||
@ -6758,7 +6760,7 @@ bool QDomDocument::setContent(QXmlInputSource *source, bool namespaceProcessing,
|
|||||||
impl = new QDomDocumentPrivate();
|
impl = new QDomDocumentPrivate();
|
||||||
QXmlSimpleReader reader;
|
QXmlSimpleReader reader;
|
||||||
initializeReader(reader, namespaceProcessing);
|
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)
|
if (!impl)
|
||||||
impl = new QDomDocumentPrivate();
|
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),
|
: 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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern bool qt_xml_skipped_entity_in_content;
|
|
||||||
bool QDomHandler::skippedEntity(const QString& name)
|
bool QDomHandler::skippedEntity(const QString& name)
|
||||||
{
|
{
|
||||||
// we can only handle inserting entity references into content
|
// 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;
|
return true;
|
||||||
|
|
||||||
QDomNodePrivate *n = doc->createEntityReference(name);
|
QDomNodePrivate *n = doc->createEntityReference(name);
|
||||||
|
@ -40,6 +40,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "qxml.h"
|
#include "qxml.h"
|
||||||
|
#include "qxml_p.h"
|
||||||
#include "qtextcodec.h"
|
#include "qtextcodec.h"
|
||||||
#include "qbuffer.h"
|
#include "qbuffer.h"
|
||||||
#include "qregexp.h"
|
#include "qregexp.h"
|
||||||
@ -99,10 +100,6 @@ static const signed char cltDq = 12; // "
|
|||||||
static const signed char cltSq = 13; // '
|
static const signed char cltSq = 13; // '
|
||||||
static const signed char cltUnknown = 14;
|
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
|
// character lookup table
|
||||||
static const signed char charLookupTable[256]={
|
static const signed char charLookupTable[256]={
|
||||||
cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, cltUnknown, // 0x00 - 0x07
|
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
|
\class QXmlParseException
|
||||||
\reentrant
|
\reentrant
|
||||||
@ -3470,7 +3226,7 @@ bool QXmlSimpleReader::parse(const QXmlInputSource *input, bool incremental)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
qt_xml_skipped_entity_in_content = false;
|
d->skipped_entity_in_content = false;
|
||||||
return d->parseBeginOrContinue(0, incremental);
|
return d->parseBeginOrContinue(0, incremental);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7834,13 +7590,13 @@ bool QXmlSimpleReaderPrivate::processReference()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (contentHnd) {
|
if (contentHnd) {
|
||||||
qt_xml_skipped_entity_in_content = parseReference_context == InContent;
|
skipped_entity_in_content = parseReference_context == InContent;
|
||||||
if (!contentHnd->skippedEntity(reference)) {
|
if (!contentHnd->skippedEntity(reference)) {
|
||||||
qt_xml_skipped_entity_in_content = false;
|
skipped_entity_in_content = false;
|
||||||
reportParseError(contentHnd->errorString());
|
reportParseError(contentHnd->errorString());
|
||||||
return false; // error
|
return false; // error
|
||||||
}
|
}
|
||||||
qt_xml_skipped_entity_in_content = false;
|
skipped_entity_in_content = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if ((*itExtern).notation.isNull()) {
|
} else if ((*itExtern).notation.isNull()) {
|
||||||
@ -7870,13 +7626,13 @@ bool QXmlSimpleReaderPrivate::processReference()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (skipIt && contentHnd) {
|
if (skipIt && contentHnd) {
|
||||||
qt_xml_skipped_entity_in_content = true;
|
skipped_entity_in_content = true;
|
||||||
if (!contentHnd->skippedEntity(reference)) {
|
if (!contentHnd->skippedEntity(reference)) {
|
||||||
qt_xml_skipped_entity_in_content = false;
|
skipped_entity_in_content = false;
|
||||||
reportParseError(contentHnd->errorString());
|
reportParseError(contentHnd->errorString());
|
||||||
return false; // error
|
return false; // error
|
||||||
}
|
}
|
||||||
qt_xml_skipped_entity_in_content = false;
|
skipped_entity_in_content = false;
|
||||||
}
|
}
|
||||||
parseReference_charDataRead = false;
|
parseReference_charDataRead = false;
|
||||||
} break;
|
} break;
|
||||||
|
@ -269,6 +269,7 @@ private:
|
|||||||
QScopedPointer<QXmlSimpleReaderPrivate> d_ptr;
|
QScopedPointer<QXmlSimpleReaderPrivate> d_ptr;
|
||||||
|
|
||||||
friend class QXmlSimpleReaderLocator;
|
friend class QXmlSimpleReaderLocator;
|
||||||
|
friend class QDomHandler;
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
308
src/xml/sax/qxml_p.h
Normal file
@ -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
|
@ -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
|
** Contact: http://www.qt-project.org/legal
|
||||||
**
|
**
|
||||||
** This file is part of the test suite of the Qt Toolkit.
|
** This file is part of the test suite of the Qt Toolkit.
|
||||||
@ -72,8 +72,12 @@ class tst_QDir : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
tst_QDir();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void init();
|
void init();
|
||||||
|
void initTestCase();
|
||||||
void cleanupTestCase();
|
void cleanupTestCase();
|
||||||
|
|
||||||
void getSetCheck();
|
void getSetCheck();
|
||||||
@ -198,19 +202,25 @@ private slots:
|
|||||||
void cdBelowRoot();
|
void cdBelowRoot();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString m_dataPath;
|
const QString m_dataPath;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
tst_QDir::tst_QDir()
|
||||||
|
: m_dataPath(QFileInfo(QFINDTESTDATA("testData")).absolutePath())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void tst_QDir::init()
|
void tst_QDir::init()
|
||||||
{
|
{
|
||||||
// Directory under which testdata can be found.
|
|
||||||
m_dataPath = QFileInfo(QFINDTESTDATA("testData")).absolutePath();
|
|
||||||
QVERIFY2(!m_dataPath.isEmpty(), "test data not found");
|
|
||||||
|
|
||||||
// Some tests want to use "." as relative path to data.
|
// Some tests want to use "." as relative path to data.
|
||||||
QVERIFY2(QDir::setCurrent(m_dataPath), qPrintable("Could not chdir to " + m_dataPath));
|
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()
|
void tst_QDir::cleanupTestCase()
|
||||||
{
|
{
|
||||||
QDir(QDir::currentPath() + "/tmpdir").removeRecursively();
|
QDir(QDir::currentPath() + "/tmpdir").removeRecursively();
|
||||||
|
@ -139,6 +139,7 @@ private slots:
|
|||||||
void cursorInLigatureWithMultipleLines();
|
void cursorInLigatureWithMultipleLines();
|
||||||
void xToCursorForLigatures();
|
void xToCursorForLigatures();
|
||||||
void cursorInNonStopChars();
|
void cursorInNonStopChars();
|
||||||
|
void nbsp();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QFont testFont;
|
QFont testFont;
|
||||||
@ -2011,5 +2012,28 @@ void tst_QTextLayout::justifyTrailingSpaces()
|
|||||||
QVERIFY(qFuzzyIsNull(layout.lineAt(0).cursorToX(0)));
|
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)
|
QTEST_MAIN(tst_QTextLayout)
|
||||||
#include "tst_qtextlayout.moc"
|
#include "tst_qtextlayout.moc"
|
||||||
|
@ -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-----
|
@ -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-----
|
@ -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-----
|