diff options
Diffstat (limited to 'src')
34 files changed, 469 insertions, 145 deletions
diff --git a/src/3rdparty/pcre/patches/pcre-r1495.patch b/src/3rdparty/pcre/patches/pcre-r1495.patch new file mode 100644 index 0000000000..d8b4ce097a --- /dev/null +++ b/src/3rdparty/pcre/patches/pcre-r1495.patch @@ -0,0 +1,23 @@ +Index: pcre_compile.c +=================================================================== +--- pcre_compile.c (revision 1494) ++++ pcre_compile.c (revision 1495) +@@ -8267,12 +8267,16 @@ + + /* If it was a capturing subpattern, check to see if it contained any + recursive back references. If so, we must wrap it in atomic brackets. +- In any event, remove the block from the chain. */ ++ Because we are moving code along, we must ensure that any pending recursive ++ references are updated. In any event, remove the block from the chain. */ + + if (capnumber > 0) + { + if (cd->open_caps->flag) + { ++ *code = OP_END; ++ adjust_recurse(start_bracket, 1 + LINK_SIZE, ++ (options & PCRE_UTF8) != 0, cd, cd->hwm); + memmove(start_bracket + 1 + LINK_SIZE, start_bracket, + IN_UCHARS(code - start_bracket)); + *start_bracket = OP_ONCE; + diff --git a/src/3rdparty/pcre/patches/pcre-r1498.patch b/src/3rdparty/pcre/patches/pcre-r1498.patch new file mode 100644 index 0000000000..8ae48a4336 --- /dev/null +++ b/src/3rdparty/pcre/patches/pcre-r1498.patch @@ -0,0 +1,45 @@ +Index: pcre_compile.c +=================================================================== +--- pcre_compile.c (revision 1497) ++++ pcre_compile.c (revision 1498) +@@ -2374,6 +2374,7 @@ + if (c == OP_RECURSE) + { + const pcre_uchar *scode = cd->start_code + GET(code, 1); ++ const pcre_uchar *endgroup = scode; + BOOL empty_branch; + + /* Test for forward reference or uncompleted reference. This is disabled +@@ -2388,24 +2389,20 @@ + if (GET(scode, 1) == 0) return TRUE; /* Unclosed */ + } + +- /* If we are scanning a completed pattern, there are no forward references +- and all groups are complete. We need to detect whether this is a recursive +- call, as otherwise there will be an infinite loop. If it is a recursion, +- just skip over it. Simple recursions are easily detected. For mutual +- recursions we keep a chain on the stack. */ ++ /* If the reference is to a completed group, we need to detect whether this ++ is a recursive call, as otherwise there will be an infinite loop. If it is ++ a recursion, just skip over it. Simple recursions are easily detected. For ++ mutual recursions we keep a chain on the stack. */ + ++ do endgroup += GET(endgroup, 1); while (*endgroup == OP_ALT); ++ if (code >= scode && code <= endgroup) continue; /* Simple recursion */ + else +- { ++ { + recurse_check *r = recurses; +- const pcre_uchar *endgroup = scode; +- +- do endgroup += GET(endgroup, 1); while (*endgroup == OP_ALT); +- if (code >= scode && code <= endgroup) continue; /* Simple recursion */ +- + for (r = recurses; r != NULL; r = r->prev) + if (r->group == scode) break; + if (r != NULL) continue; /* Mutual recursion */ +- } ++ } + + /* Completed reference; scan the referenced group, remembering it on the + stack chain to detect mutual recursions. */ diff --git a/src/3rdparty/pcre/pcre_compile.c b/src/3rdparty/pcre/pcre_compile.c index 5ce6b73c44..ce365e2915 100644 --- a/src/3rdparty/pcre/pcre_compile.c +++ b/src/3rdparty/pcre/pcre_compile.c @@ -2370,6 +2370,7 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE); if (c == OP_RECURSE) { const pcre_uchar *scode = cd->start_code + GET(code, 1); + const pcre_uchar *endgroup = scode; BOOL empty_branch; /* Test for forward reference or uncompleted reference. This is disabled @@ -2384,24 +2385,20 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE); if (GET(scode, 1) == 0) return TRUE; /* Unclosed */ } - /* If we are scanning a completed pattern, there are no forward references - and all groups are complete. We need to detect whether this is a recursive - call, as otherwise there will be an infinite loop. If it is a recursion, - just skip over it. Simple recursions are easily detected. For mutual - recursions we keep a chain on the stack. */ + /* If the reference is to a completed group, we need to detect whether this + is a recursive call, as otherwise there will be an infinite loop. If it is + a recursion, just skip over it. Simple recursions are easily detected. For + mutual recursions we keep a chain on the stack. */ + do endgroup += GET(endgroup, 1); while (*endgroup == OP_ALT); + if (code >= scode && code <= endgroup) continue; /* Simple recursion */ else - { + { recurse_check *r = recurses; - const pcre_uchar *endgroup = scode; - - do endgroup += GET(endgroup, 1); while (*endgroup == OP_ALT); - if (code >= scode && code <= endgroup) continue; /* Simple recursion */ - for (r = recurses; r != NULL; r = r->prev) if (r->group == scode) break; if (r != NULL) continue; /* Mutual recursion */ - } + } /* Completed reference; scan the referenced group, remembering it on the stack chain to detect mutual recursions. */ @@ -8244,12 +8241,16 @@ for (;;) /* If it was a capturing subpattern, check to see if it contained any recursive back references. If so, we must wrap it in atomic brackets. - In any event, remove the block from the chain. */ + Because we are moving code along, we must ensure that any pending recursive + references are updated. In any event, remove the block from the chain. */ if (capnumber > 0) { if (cd->open_caps->flag) { + *code = OP_END; + adjust_recurse(start_bracket, 1 + LINK_SIZE, + (options & PCRE_UTF8) != 0, cd, cd->hwm); memmove(start_bracket + 1 + LINK_SIZE, start_bracket, IN_UCHARS(code - start_bracket)); *start_bracket = OP_ONCE; diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index 31a99bf910..014023ecb1 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -108,15 +108,20 @@ public class QtNative } } - public static void openURL(String url) + public static boolean openURL(String url) { + boolean ok = true; + try { Uri uri = Uri.parse(url); Intent intent = new Intent(Intent.ACTION_VIEW, uri); activity().startActivity(intent); } catch (Exception e) { e.printStackTrace(); + ok = false; } + + return ok; } // this method loads full path libs diff --git a/src/corelib/kernel/qjni.cpp b/src/corelib/kernel/qjni.cpp index aa9b196e62..4581b70ca7 100644 --- a/src/corelib/kernel/qjni.cpp +++ b/src/corelib/kernel/qjni.cpp @@ -721,7 +721,7 @@ jboolean QJNIObjectPrivate::callStaticMethod<jboolean>(jclass clazz, { va_list args; va_start(args, sig); - jboolean res = callStaticMethod<jboolean>(clazz, methodName, sig); + jboolean res = callStaticMethod<jboolean>(clazz, methodName, sig, args); va_end(args); return res; } @@ -1026,7 +1026,7 @@ jlong QJNIObjectPrivate::callStaticMethod<jlong>(jclass clazz, { va_list args; va_start(args, sig); - jlong res = callStaticMethod<jlong>(clazz, methodName, sig); + jlong res = callStaticMethod<jlong>(clazz, methodName, sig, args); va_end(args); return res; } @@ -1119,7 +1119,7 @@ jdouble QJNIObjectPrivate::callStaticMethod<jdouble>(const char *className, { va_list args; va_start(args, sig); - jdouble res = callStaticMethod<jdouble>(className, methodName, sig); + jdouble res = callStaticMethod<jdouble>(className, methodName, sig, args); va_end(args); return res; } diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp index db2b086ff2..45bf4b62c5 100644 --- a/src/corelib/kernel/qobject.cpp +++ b/src/corelib/kernel/qobject.cpp @@ -4749,10 +4749,14 @@ bool QObject::disconnectImpl(const QObject *sender, void **signal, const QObject int signal_index = -1; if (signal) { void *args[] = { &signal_index, signal }; - senderMetaObject->static_metacall(QMetaObject::IndexOfMethod, 0, args); - if (signal_index < 0 || signal_index >= QMetaObjectPrivate::get(senderMetaObject)->signalCount) { - qWarning("QObject::disconnect: signal not found in %s", senderMetaObject->className()); - return false; + for (; senderMetaObject && signal_index < 0; senderMetaObject = senderMetaObject->superClass()) { + senderMetaObject->static_metacall(QMetaObject::IndexOfMethod, 0, args); + if (signal_index >= 0 && signal_index < QMetaObjectPrivate::get(senderMetaObject)->signalCount) + break; + } + if (!senderMetaObject) { + qWarning("QObject::disconnect: signal not found in %s", sender->metaObject()->className()); + return QMetaObject::Connection(0); } signal_index += QMetaObjectPrivate::signalOffset(senderMetaObject); } diff --git a/src/corelib/statemachine/qstatemachine.cpp b/src/corelib/statemachine/qstatemachine.cpp index a147b85eb7..0e6fad48df 100644 --- a/src/corelib/statemachine/qstatemachine.cpp +++ b/src/corelib/statemachine/qstatemachine.cpp @@ -526,10 +526,6 @@ QList<QAbstractState*> QStateMachinePrivate::computeStatesToEnter(const QList<QA QAbstractState *s = lst.at(j); addStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry); } - for (int j = src ? 1 : 0; j < lst.size(); ++j) { - QAbstractState *s = lst.at(j); - addAncestorStatesToEnter(s, lca, statesToEnter, statesForDefaultEntry); - } if (isParallel(lca)) { QList<QAbstractState*> lcac = QStatePrivate::get(lca)->childStates(); foreach (QAbstractState* child,lcac) { @@ -727,6 +723,7 @@ void QStateMachinePrivate::addStatesToEnter(QAbstractState *s, QState *root, return; } } + addAncestorStatesToEnter(s, root, statesToEnter, statesForDefaultEntry); } } @@ -1095,7 +1092,6 @@ void QStateMachinePrivate::setError(QStateMachine::Error errorCode, QAbstractSta if (currentErrorState != 0) { QState *lca = findLCA(QList<QAbstractState*>() << currentErrorState << currentContext); addStatesToEnter(currentErrorState, lca, pendingErrorStates, pendingErrorStatesForDefaultEntry); - addAncestorStatesToEnter(currentErrorState, lca, pendingErrorStates, pendingErrorStatesForDefaultEntry); } else { qWarning("Unrecoverable error detected in running state machine: %s", qPrintable(errorString)); diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 23c75f4e05..2ce8a3a45b 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -8029,6 +8029,11 @@ QString &QString::setRawData(const QChar *unicode, int size) Returns the Latin-1 string stored in this object. */ +/*! \fn const char *QLatin1String::data() const + + Returns the Latin-1 string stored in this object. +*/ + /*! \fn int QLatin1String::size() const Returns the size of the Latin-1 string stored in this object. @@ -8059,6 +8064,20 @@ QString &QString::setRawData(const QChar *unicode, int size) go through QObject::tr(), for example. */ +/*! + \fn bool QLatin1String::operator==(const QByteArray &other) const + \since 5.0 + \overload + + The \a other byte array is converted to a QString using + the QString::fromUtf8() function. + + You can disable this operator by defining \c + QT_NO_CAST_FROM_ASCII when you compile your applications. This + can be useful if you want to ensure that all user-visible strings + go through QObject::tr(), for example. +*/ + /*! \fn bool QLatin1String::operator!=(const QString &other) const Returns \c true if this string is not equal to string \a other; @@ -8085,6 +8104,20 @@ QString &QString::setRawData(const QChar *unicode, int size) */ /*! + \fn bool QLatin1String::operator!=(const QByteArray &other) const + \since 5.0 + \overload operator!=() + + The \a other byte array is converted to a QString using + the QString::fromUtf8() function. + + You can disable this operator by defining \c + QT_NO_CAST_FROM_ASCII when you compile your applications. This + can be useful if you want to ensure that all user-visible strings + go through QObject::tr(), for example. +*/ + +/*! \fn bool QLatin1String::operator>(const QString &other) const Returns \c true if this string is lexically greater than string \a @@ -8111,6 +8144,20 @@ QString &QString::setRawData(const QChar *unicode, int size) */ /*! + \fn bool QLatin1String::operator>(const QByteArray &other) const + \since 5.0 + \overload + + The \a other const char pointer is converted to a QString using + the QString::fromUtf8() function. + + You can disable this operator by defining \c QT_NO_CAST_FROM_ASCII + when you compile your applications. This can be useful if you want + to ensure that all user-visible strings go through QObject::tr(), + for example. +*/ + +/*! \fn bool QLatin1String::operator<(const QString &other) const Returns \c true if this string is lexically less than the \a other @@ -8137,6 +8184,20 @@ QString &QString::setRawData(const QChar *unicode, int size) */ /*! + \fn bool QLatin1String::operator<(const QByteArray &other) const + \since 5.0 + \overload + + The \a other const char pointer is converted to a QString using + the QString::fromUtf8() function. + + You can disable this operator by defining \c + QT_NO_CAST_FROM_ASCII when you compile your applications. This + can be useful if you want to ensure that all user-visible strings + go through QObject::tr(), for example. +*/ + +/*! \fn bool QLatin1String::operator>=(const QString &other) const Returns \c true if this string is lexically greater than or equal @@ -8162,6 +8223,20 @@ QString &QString::setRawData(const QChar *unicode, int size) go through QObject::tr(), for example. */ +/*! + \fn bool QLatin1String::operator>=(const QByteArray &other) const + \since 5.0 + \overload + + The \a other array is converted to a QString using + the QString::fromUtf8() function. + + You can disable this operator by defining \c + QT_NO_CAST_FROM_ASCII when you compile your applications. This + can be useful if you want to ensure that all user-visible strings + go through QObject::tr(), for example. +*/ + /*! \fn bool QLatin1String::operator<=(const QString &other) const Returns \c true if this string is lexically less than or equal @@ -8187,6 +8262,19 @@ QString &QString::setRawData(const QChar *unicode, int size) go through QObject::tr(), for example. */ +/*! + \fn bool QLatin1String::operator<=(const QByteArray &other) const + \since 5.0 + \overload + + The \a other array is converted to a QString using + the QString::fromUtf8() function. + + You can disable this operator by defining \c + QT_NO_CAST_FROM_ASCII when you compile your applications. This + can be useful if you want to ensure that all user-visible strings + go through QObject::tr(), for example. +*/ /*! \fn bool operator==(QLatin1String s1, QLatin1String s2) diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index 71a1d1e074..6b2bb092b1 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -639,6 +639,7 @@ bool QOpenGLContext::create() */ void QOpenGLContext::destroy() { + deleteQGLContext(); Q_D(QOpenGLContext); if (d->platformGLContext) emit aboutToBeDestroyed(); @@ -1086,6 +1087,9 @@ void *QOpenGLContext::qGLContextHandle() const } /*! + internal: If the delete function is specified QOpenGLContext "owns" + the passed context handle and will use the delete function to destroy it. + \internal */ void QOpenGLContext::setQGLContextHandle(void *handle,void (*qGLContextDeleteFunction)(void *)) diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 46e1572376..2d27b19ebe 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -198,6 +198,7 @@ class Q_GUI_EXPORT QOpenGLContextPrivate : public QObjectPrivate public: QOpenGLContextPrivate() : qGLContextHandle(0) + , qGLContextDeleteFunction(0) , platformGLContext(0) , shareContext(0) , shareGroup(0) diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp index 3335a88cbb..f5ce8865a8 100644 --- a/src/gui/opengl/qopenglversionfunctions.cpp +++ b/src/gui/opengl/qopenglversionfunctions.cpp @@ -98,8 +98,10 @@ void QAbstractOpenGLFunctionsPrivate::removeFunctionsBackend(QOpenGLContext *con Qt now provides a family of classes which all inherit from QAbstractOpenGLFunctions which expose every core OpenGL function by way of a corresponding member function. There is a class for every valid combination - of OpenGL version and profile. Each class follows the naming convention - QOpenGLFunctions_<MAJOR VERSION>_<MINOR VERSION>[_PROFILE]. + of OpenGL version and profile. Each class follows the naming convention: + \badcode + QOpenGLFunctions_<MAJOR VERSION>_<MINOR VERSION>[_PROFILE] + \endcode For OpenGL versions 1.0 through to 3.0 there are no profiles, leading to the classes: diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 2e340219b9..914691375a 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -921,7 +921,7 @@ void QRasterPaintEngine::renderHintsChanged() bool was_aa = s->flags.antialiased; bool was_bilinear = s->flags.bilinear; - s->flags.antialiased = bool(s->renderHints & QPainter::Antialiasing); + s->flags.antialiased = bool(s->renderHints & (QPainter::Antialiasing | QPainter::HighQualityAntialiasing)); s->flags.bilinear = bool(s->renderHints & QPainter::SmoothPixmapTransform); s->flags.legacy_rounding = !bool(s->renderHints & QPainter::Antialiasing) && bool(s->renderHints & QPainter::Qt4CompatiblePainting); @@ -2726,7 +2726,7 @@ void QRasterPaintEngine::alphaPenBlt(const void* src, int bpl, int depth, int rx scanline += bpl; } } else { // 32-bit alpha... - uint *sl = (uint *) src; + uint *sl = (uint *) scanline; for (int y = y0; y < y1; ++y) { for (int x = x0; x < x1; ) { // Skip those with 0 coverage diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp index e9ffa68591..5dc81d241d 100644 --- a/src/gui/text/qplatformfontdatabase.cpp +++ b/src/gui/text/qplatformfontdatabase.cpp @@ -402,6 +402,16 @@ QString QPlatformFontDatabase::fontDir() const } /*! + Returns true if the font family is private. For any given family name, + the result is platform dependent. +*/ +bool QPlatformFontDatabase::isPrivateFontFamily(const QString &family) const +{ + Q_UNUSED(family); + return false; +} + +/*! Returns the default system font. \sa QGuiApplication::font() diff --git a/src/gui/text/qplatformfontdatabase.h b/src/gui/text/qplatformfontdatabase.h index b200cf0e58..46ef5c0f46 100644 --- a/src/gui/text/qplatformfontdatabase.h +++ b/src/gui/text/qplatformfontdatabase.h @@ -110,6 +110,7 @@ public: virtual QString fontDir() const; virtual QFont defaultFont() const; + virtual bool isPrivateFontFamily(const QString &family) const; virtual QString resolveFontFamilyAlias(const QString &family) const; virtual bool fontsAlwaysScalable() const; diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp index bead45ab83..e572745d51 100644 --- a/src/network/socket/qabstractsocket.cpp +++ b/src/network/socket/qabstractsocket.cpp @@ -2008,6 +2008,9 @@ static int qt_timeout_value(int msecs, int elapsed) \note Multiple calls to this functions do not accumulate the time. If the function times out, the connecting process will be aborted. + \note This function may fail randomly on Windows. Consider using the event + loop and the connected() signal if your software will run on Windows. + \sa connectToHost(), connected() */ bool QAbstractSocket::waitForConnected(int msecs) @@ -2107,6 +2110,9 @@ bool QAbstractSocket::waitForConnected(int msecs) there is new data available for reading; otherwise it returns \c false (if an error occurred or the operation timed out). + \note This function may fail randomly on Windows. Consider using the event + loop and the readyRead() signal if your software will run on Windows. + \sa waitForBytesWritten() */ bool QAbstractSocket::waitForReadyRead(int msecs) @@ -2166,6 +2172,20 @@ bool QAbstractSocket::waitForReadyRead(int msecs) } /*! \reimp + + This function blocks until at least one byte has been written on the socket + and the \l{QIODevice::}{bytesWritten()} signal has been emitted. The + function will timeout after \a msecs milliseconds; the default timeout is + 30000 milliseconds. + + The function returns \c true if the bytesWritten() signal is emitted; + otherwise it returns \c false (if an error occurred or the operation timed + out). + + \note This function may fail randomly on Windows. Consider using the event + loop and the bytesWritten() signal if your software will run on Windows. + + \sa waitForReadyRead() */ bool QAbstractSocket::waitForBytesWritten(int msecs) { @@ -2247,6 +2267,9 @@ bool QAbstractSocket::waitForBytesWritten(int msecs) If msecs is -1, this function will not time out. + \note This function may fail randomly on Windows. Consider using the event + loop and the disconnected() signal if your software will run on Windows. + \sa disconnectFromHost(), close() */ bool QAbstractSocket::waitForDisconnected(int msecs) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 10ba8ac2ee..d2c017fcac 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -2126,7 +2126,7 @@ QGLContext::QGLContext(const QGLFormat &format) d->init(0, format); } -void qDeleteQGLContext(void *handle) +static void qDeleteQGLContext(void *handle) { QGLContext *context = static_cast<QGLContext *>(handle); delete context; @@ -3475,7 +3475,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext) d->valid = d->guiGlContext->create(); if (d->valid) - d->guiGlContext->setQGLContextHandle(this, qDeleteQGLContext); + d->guiGlContext->setQGLContextHandle(this, 0); d->glFormat = QGLFormat::fromSurfaceFormat(d->guiGlContext->format()); d->setupSharing(); diff --git a/src/opengl/qgl_p.h b/src/opengl/qgl_p.h index 6dd939c2de..fb71e60ba9 100644 --- a/src/opengl/qgl_p.h +++ b/src/opengl/qgl_p.h @@ -242,6 +242,7 @@ public: void swapRegion(const QRegion ®ion); QOpenGLContext *guiGlContext; + // true if QGLContext owns the QOpenGLContext (for who deletes who) bool ownContext; void setupSharing(); diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm index 7ae72cc446..4da209e769 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase.mm @@ -211,6 +211,13 @@ void QCoreTextFontDatabase::populateFontDatabase() QPlatformFontDatabase::registerAliasToFontFamily(familyName, localizedFamilyName); #endif } + + // Force creating the theme fonts to get the descriptors in m_systemFontDescriptors + if (m_themeFonts.isEmpty()) + (void)themeFonts(); + + Q_FOREACH (CTFontDescriptorRef fontDesc, m_systemFontDescriptors) + populateFromDescriptor(fontDesc); } void QCoreTextFontDatabase::populateFamily(const QString &familyName) @@ -231,16 +238,29 @@ void QCoreTextFontDatabase::populateFamily(const QString &familyName) populateFromDescriptor(CTFontDescriptorRef(CFArrayGetValueAtIndex(matchingFonts, i))); } -void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font) +struct FontDescription { + QCFString familyName; + QCFString styleName; + QString foundryName; + QFont::Weight weight; + QFont::Style style; + QFont::Stretch stretch; + int pixelSize; + bool fixedPitch; + QSupportedWritingSystems writingSystems; +}; + +static void getFontDescription(CTFontDescriptorRef font, FontDescription *fd) { - QString foundryName = QStringLiteral("CoreText"); - QCFString familyName = (CFStringRef) CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute); - QCFString styleName = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontStyleNameAttribute); QCFType<CFDictionaryRef> styles = (CFDictionaryRef) CTFontDescriptorCopyAttribute(font, kCTFontTraitsAttribute); - QFont::Weight weight = QFont::Normal; - QFont::Style style = QFont::StyleNormal; - QFont::Stretch stretch = QFont::Unstretched; - bool fixedPitch = false; + + fd->foundryName = QStringLiteral("CoreText"); + fd->familyName = (CFStringRef) CTFontDescriptorCopyAttribute(font, kCTFontFamilyNameAttribute); + fd->styleName = (CFStringRef)CTFontDescriptorCopyAttribute(font, kCTFontStyleNameAttribute); + fd->weight = QFont::Normal; + fd->style = QFont::StyleNormal; + fd->stretch = QFont::Unstretched; + fd->fixedPitch = false; if (styles) { if (CFNumberRef weightValue = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontWeightTrait)) { @@ -248,15 +268,15 @@ void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font) double normalizedWeight; if (CFNumberGetValue(weightValue, kCFNumberDoubleType, &normalizedWeight)) { if (normalizedWeight >= 0.62) - weight = QFont::Black; + fd->weight = QFont::Black; else if (normalizedWeight >= 0.4) - weight = QFont::Bold; + fd->weight = QFont::Bold; else if (normalizedWeight >= 0.3) - weight = QFont::DemiBold; + fd->weight = QFont::DemiBold; else if (normalizedWeight == 0.0) - weight = QFont::Normal; + fd->weight = QFont::Normal; else if (normalizedWeight <= -0.4) - weight = QFont::Light; + fd->weight = QFont::Light; } } if (CFNumberRef italic = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontSlantTrait)) { @@ -264,34 +284,32 @@ void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font) double d; if (CFNumberGetValue(italic, kCFNumberDoubleType, &d)) { if (d > 0.0) - style = QFont::StyleItalic; + fd->style = QFont::StyleItalic; } } if (CFNumberRef symbolic = (CFNumberRef) CFDictionaryGetValue(styles, kCTFontSymbolicTrait)) { int d; if (CFNumberGetValue(symbolic, kCFNumberSInt32Type, &d)) { if (d & kCTFontMonoSpaceTrait) - fixedPitch = true; + fd->fixedPitch = true; if (d & kCTFontExpandedTrait) - stretch = QFont::Expanded; + fd->stretch = QFont::Expanded; else if (d & kCTFontCondensedTrait) - stretch = QFont::Condensed; + fd->stretch = QFont::Condensed; } } } - int pixelSize = 0; if (QCFType<CFNumberRef> size = (CFNumberRef) CTFontDescriptorCopyAttribute(font, kCTFontSizeAttribute)) { if (CFNumberIsFloatType(size)) { double d; CFNumberGetValue(size, kCFNumberDoubleType, &d); - pixelSize = d; + fd->pixelSize = d; } else { - CFNumberGetValue(size, kCFNumberIntType, &pixelSize); + CFNumberGetValue(size, kCFNumberIntType, &fd->pixelSize); } } - QSupportedWritingSystems writingSystems; if (QCFType<CFArrayRef> languages = (CFArrayRef) CTFontDescriptorCopyAttribute(font, kCTFontLanguagesAttribute)) { CFIndex length = CFArrayGetCount(languages); for (int i = 1; i < LanguageCount; ++i) { @@ -299,14 +317,24 @@ void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font) continue; QCFString lang = CFStringCreateWithCString(NULL, languageForWritingSystem[i], kCFStringEncodingASCII); if (CFArrayContainsValue(languages, CFRangeMake(0, length), lang)) - writingSystems.setSupported(QFontDatabase::WritingSystem(i)); + fd->writingSystems.setSupported(QFontDatabase::WritingSystem(i)); } } +} +void QCoreTextFontDatabase::populateFromDescriptor(CTFontDescriptorRef font) +{ + FontDescription fd; + getFontDescription(font, &fd); + populateFromFontDescription(font, fd); +} + +void QCoreTextFontDatabase::populateFromFontDescription(CTFontDescriptorRef font, const FontDescription &fd) +{ CFRetain(font); - QPlatformFontDatabase::registerFont(familyName, styleName, foundryName, weight, style, stretch, + QPlatformFontDatabase::registerFont(fd.familyName, fd.styleName, fd.foundryName, fd.weight, fd.style, fd.stretch, true /* antialiased */, true /* scalable */, - pixelSize, fixedPitch, writingSystems, (void *) font); + fd.pixelSize, fd.fixedPitch, fd.writingSystems, (void *) font); } void QCoreTextFontDatabase::releaseHandle(void *handle) @@ -612,6 +640,113 @@ QStringList QCoreTextFontDatabase::addApplicationFont(const QByteArray &fontData return families; } +bool QCoreTextFontDatabase::isPrivateFontFamily(const QString &family) const +{ + if (family.startsWith(QLatin1Char('.'))) + return true; + + return QPlatformFontDatabase::isPrivateFontFamily(family); +} + +static CTFontUIFontType fontTypeFromTheme(QPlatformTheme::Font f) +{ + switch (f) { + case QPlatformTheme::SystemFont: + return kCTFontSystemFontType; + + case QPlatformTheme::MenuFont: + case QPlatformTheme::MenuBarFont: + case QPlatformTheme::MenuItemFont: + return kCTFontMenuItemFontType; + + case QPlatformTheme::MessageBoxFont: + return kCTFontEmphasizedSystemFontType; + + case QPlatformTheme::LabelFont: + return kCTFontSystemFontType; + + case QPlatformTheme::TipLabelFont: + return kCTFontToolTipFontType; + + case QPlatformTheme::StatusBarFont: + return kCTFontSystemFontType; + + case QPlatformTheme::TitleBarFont: + return kCTFontWindowTitleFontType; + + case QPlatformTheme::MdiSubWindowTitleFont: + case QPlatformTheme::DockWidgetTitleFont: + return kCTFontSystemFontType; + + case QPlatformTheme::PushButtonFont: + return kCTFontPushButtonFontType; + + case QPlatformTheme::CheckBoxFont: + case QPlatformTheme::RadioButtonFont: + return kCTFontSystemFontType; + + case QPlatformTheme::ToolButtonFont: + return kCTFontSmallToolbarFontType; + + case QPlatformTheme::ItemViewFont: + return kCTFontSystemFontType; + + case QPlatformTheme::ListViewFont: + return kCTFontViewsFontType; + + case QPlatformTheme::HeaderViewFont: + return kCTFontSmallSystemFontType; + + case QPlatformTheme::ListBoxFont: + return kCTFontViewsFontType; + + case QPlatformTheme::ComboMenuItemFont: + return kCTFontSystemFontType; + + case QPlatformTheme::ComboLineEditFont: + return kCTFontViewsFontType; + + case QPlatformTheme::SmallFont: + return kCTFontSmallSystemFontType; + + case QPlatformTheme::MiniFont: + return kCTFontMiniSystemFontType; + + case QPlatformTheme::FixedFont: + return kCTFontUserFixedPitchFontType; + + default: + return kCTFontSystemFontType; + } +} + +const QHash<QPlatformTheme::Font, QFont *> &QCoreTextFontDatabase::themeFonts() const +{ + if (m_themeFonts.isEmpty()) { + for (long f = QPlatformTheme::SystemFont; f < QPlatformTheme::NFonts; f++) { + QPlatformTheme::Font ft = static_cast<QPlatformTheme::Font>(f); + m_themeFonts.insert(ft, themeFont(ft)); + } + } + + return m_themeFonts; +} + +QFont *QCoreTextFontDatabase::themeFont(QPlatformTheme::Font f) const +{ + CTFontUIFontType fontType = fontTypeFromTheme(f); + + QCFType<CTFontRef> ctFont = CTFontCreateUIFontForLanguage(fontType, 0.0, NULL); + CTFontDescriptorRef fontDesc = CTFontCopyFontDescriptor(ctFont); + + FontDescription fd; + getFontDescription(fontDesc, &fd); + m_systemFontDescriptors.insert(fontDesc); + + QFont *font = new QFont(fd.familyName, fd.pixelSize, fd.weight, fd.style == QFont::StyleItalic); + return font; +} + QFont QCoreTextFontDatabase::defaultFont() const { if (defaultFontName.isEmpty()) { diff --git a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h index c73f4a32ca..a3da27b28d 100644 --- a/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h +++ b/src/platformsupport/fontdatabases/mac/qcoretextfontdatabase_p.h @@ -47,6 +47,7 @@ #define HAVE_ATS QT_MAC_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_5, __IPHONE_NA) #include <qpa/qplatformfontdatabase.h> +#include <qpa/qplatformtheme.h> #include <private/qcore_mac_p.h> #ifndef Q_OS_IOS @@ -66,6 +67,8 @@ Q_DECLARE_METATYPE(ATSFontContainerRef); QT_BEGIN_NAMESPACE +struct FontDescription; + class QCoreTextFontDatabase : public QPlatformFontDatabase { public: @@ -79,17 +82,25 @@ public: QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const; QStringList addApplicationFont(const QByteArray &fontData, const QString &fileName); void releaseHandle(void *handle); + bool isPrivateFontFamily(const QString &family) const; QFont defaultFont() const; QList<int> standardSizes() const; + // For iOS and OS X platform themes + QFont *themeFont(QPlatformTheme::Font) const; + const QHash<QPlatformTheme::Font, QFont *> &themeFonts() const; + private: void populateFromDescriptor(CTFontDescriptorRef font); + void populateFromFontDescription(CTFontDescriptorRef font, const FontDescription &fd); mutable QString defaultFontName; void removeApplicationFonts(); QVector<QVariant> m_applicationFonts; + mutable QSet<CTFontDescriptorRef> m_systemFontDescriptors; + mutable QHash<QPlatformTheme::Font, QFont *> m_themeFonts; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/android/androidjnimain.cpp b/src/plugins/platforms/android/androidjnimain.cpp index f776e43efa..de30fa825a 100644 --- a/src/plugins/platforms/android/androidjnimain.cpp +++ b/src/plugins/platforms/android/androidjnimain.cpp @@ -401,10 +401,8 @@ namespace QtAndroid { QMutexLocker lock(&m_surfacesMutex); const auto &it = m_surfaces.find(surfaceId); - if (it == m_surfaces.end()) - return; - - m_surfaces.remove(surfaceId); + if (it != m_surfaces.end()) + m_surfaces.remove(surfaceId); if (m_surfaces.isEmpty()) m_surfaceId = 1; diff --git a/src/plugins/platforms/android/qandroidplatformservices.cpp b/src/plugins/platforms/android/qandroidplatformservices.cpp index 9c21abe39b..1f2f58f838 100644 --- a/src/plugins/platforms/android/qandroidplatformservices.cpp +++ b/src/plugins/platforms/android/qandroidplatformservices.cpp @@ -54,11 +54,10 @@ QAndroidPlatformServices::QAndroidPlatformServices() bool QAndroidPlatformServices::openUrl(const QUrl &url) { QJNIObjectPrivate urlString = QJNIObjectPrivate::fromString(url.toString()); - QJNIObjectPrivate::callStaticMethod<void>(QtAndroid::applicationClass(), - "openURL", - "(Ljava/lang/String;)V", - urlString.object()); - return true; + return QJNIObjectPrivate::callStaticMethod<jboolean>(QtAndroid::applicationClass(), + "openURL", + "(Ljava/lang/String;)Z", + urlString.object()); } bool QAndroidPlatformServices::openDocument(const QUrl &url) diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.h b/src/plugins/platforms/cocoa/qcocoasystemsettings.h index 9ce301f7e7..3861da6230 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemsettings.h +++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.h @@ -50,7 +50,6 @@ QT_BEGIN_NAMESPACE QPalette * qt_mac_createSystemPalette(); QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes(); -QHash<QPlatformTheme::Font, QFont *> qt_mac_createRoleFonts(); QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm index 26aa871998..3ce2f06763 100644 --- a/src/plugins/platforms/cocoa/qcocoasystemsettings.mm +++ b/src/plugins/platforms/cocoa/qcocoasystemsettings.mm @@ -213,48 +213,4 @@ QHash<QPlatformTheme::Palette, QPalette*> qt_mac_createRolePalettes() return palettes; } -QFont *qt_mac_qfontForThemeFont(ThemeFontID themeID) -{ - CTFontUIFontType ctID = HIThemeGetUIFontType(themeID); - QCFType<CTFontRef> ctfont = CTFontCreateUIFontForLanguage(ctID, 0, 0); - QString familyName = QCFString(CTFontCopyFamilyName(ctfont)); - QCFType<CFDictionaryRef> dict = CTFontCopyTraits(ctfont); - CFNumberRef num = static_cast<CFNumberRef>(CFDictionaryGetValue(dict, kCTFontWeightTrait)); - float fW; - CFNumberGetValue(num, kCFNumberFloat32Type, &fW); - QFont::Weight wght = fW > 0. ? QFont::Bold : QFont::Normal; - num = static_cast<CFNumberRef>(CFDictionaryGetValue(dict, kCTFontSlantTrait)); - CFNumberGetValue(num, kCFNumberFloatType, &fW); - bool italic = (fW != 0.0); - return new QFont(familyName, CTFontGetSize(ctfont), wght, italic); -} - -QHash<QPlatformTheme::Font, QFont *> qt_mac_createRoleFonts() -{ - QHash<QPlatformTheme::Font, QFont *> fonts; - - fonts.insert(QPlatformTheme::SystemFont, qt_mac_qfontForThemeFont(kThemeApplicationFont)); - fonts.insert(QPlatformTheme::PushButtonFont, qt_mac_qfontForThemeFont(kThemePushButtonFont)); - fonts.insert(QPlatformTheme::ListViewFont, qt_mac_qfontForThemeFont(kThemeViewsFont)); - fonts.insert(QPlatformTheme::ListBoxFont, qt_mac_qfontForThemeFont(kThemeViewsFont)); - fonts.insert(QPlatformTheme::TitleBarFont, qt_mac_qfontForThemeFont(kThemeWindowTitleFont)); - fonts.insert(QPlatformTheme::MenuFont, qt_mac_qfontForThemeFont(kThemeMenuItemFont)); - fonts.insert(QPlatformTheme::MenuBarFont, qt_mac_qfontForThemeFont(kThemeMenuItemFont)); - fonts.insert(QPlatformTheme::ComboMenuItemFont, qt_mac_qfontForThemeFont(kThemeSystemFont)); - fonts.insert(QPlatformTheme::HeaderViewFont, qt_mac_qfontForThemeFont(kThemeSmallSystemFont)); - fonts.insert(QPlatformTheme::TipLabelFont, qt_mac_qfontForThemeFont(kThemeSmallSystemFont)); - fonts.insert(QPlatformTheme::LabelFont, qt_mac_qfontForThemeFont(kThemeSystemFont)); - fonts.insert(QPlatformTheme::ToolButtonFont, qt_mac_qfontForThemeFont(kThemeSmallSystemFont)); - fonts.insert(QPlatformTheme::MenuItemFont, qt_mac_qfontForThemeFont(kThemeMenuItemFont)); - fonts.insert(QPlatformTheme::ComboLineEditFont, qt_mac_qfontForThemeFont(kThemeViewsFont)); - fonts.insert(QPlatformTheme::SmallFont, qt_mac_qfontForThemeFont(kThemeSmallSystemFont)); - fonts.insert(QPlatformTheme::MiniFont, qt_mac_qfontForThemeFont(kThemeMiniSystemFont)); - - QFont* fixedFont = new QFont(QStringLiteral("Monaco"), fonts[QPlatformTheme::SystemFont]->pointSize()); - fixedFont->setStyleHint(QFont::TypeWriter); - fonts.insert(QPlatformTheme::FixedFont, fixedFont); - - return fonts; -} - QT_END_NAMESPACE diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm index dce1671800..ae42fee82c 100644 --- a/src/plugins/platforms/cocoa/qcocoatheme.mm +++ b/src/plugins/platforms/cocoa/qcocoatheme.mm @@ -60,6 +60,7 @@ #include <QtCore/qfileinfo.h> #include <QtGui/private/qguiapplication_p.h> #include <QtGui/qpainter.h> +#include <QtPlatformSupport/private/qcoretextfontdatabase_p.h> #include <qpa/qplatformintegration.h> #include <qpa/qplatformnativeinterface.h> @@ -134,6 +135,12 @@ const QPalette *QCocoaTheme::palette(Palette type) const return 0; } +QHash<QPlatformTheme::Font, QFont *> qt_mac_createRoleFonts() +{ + QCoreTextFontDatabase *ctfd = static_cast<QCoreTextFontDatabase *>(QGuiApplicationPrivate::platformIntegration()->fontDatabase()); + return ctfd->themeFonts(); +} + const QFont *QCocoaTheme::font(Font type) const { if (m_fonts.isEmpty()) { diff --git a/src/plugins/platforms/ios/qiostheme.mm b/src/plugins/platforms/ios/qiostheme.mm index e7093185aa..e51e97bd5a 100644 --- a/src/plugins/platforms/ios/qiostheme.mm +++ b/src/plugins/platforms/ios/qiostheme.mm @@ -46,6 +46,10 @@ #include <QtGui/QFont> +#include <QtPlatformSupport/private/qcoretextfontdatabase_p.h> +#include <QtGui/private/qguiapplication_p.h> +#include <qpa/qplatformintegration.h> + #include <UIKit/UIFont.h> #include <UIKit/UIInterface.h> @@ -75,19 +79,8 @@ QVariant QIOSTheme::themeHint(ThemeHint hint) const const QFont *QIOSTheme::font(Font type) const { if (m_fonts.isEmpty()) { - // The real system font on iOS is '.Helvetica Neue UI', as returned by both [UIFont systemFontOfSize] - // and CTFontCreateUIFontForLanguage(kCTFontSystemFontType, ...), but this font is not included when - // populating the available fonts in QCoreTextFontDatabase::populateFontDatabase(), since the font - // is internal to iOS and not supposed to be used by applications. We could potentially add this - // font to the font-database, but it would then show up when enumerating user fonts from Qt - // applications since we don't have a flag in Qt to mark a font as a private system font. - // For now we hard-code the font to Helvetica, which should be very close to the actual - // system font. - QLatin1String systemFontFamilyName("Helvetica"); - m_fonts.insert(QPlatformTheme::SystemFont, new QFont(systemFontFamilyName, [UIFont systemFontSize])); - m_fonts.insert(QPlatformTheme::SmallFont, new QFont(systemFontFamilyName, [UIFont smallSystemFontSize])); - m_fonts.insert(QPlatformTheme::LabelFont, new QFont(systemFontFamilyName, [UIFont labelFontSize])); - m_fonts.insert(QPlatformTheme::PushButtonFont, new QFont(systemFontFamilyName, [UIFont buttonFontSize])); + QCoreTextFontDatabase *ctfd = static_cast<QCoreTextFontDatabase *>(QGuiApplicationPrivate::platformIntegration()->fontDatabase()); + m_fonts = ctfd->themeFonts(); } return m_fonts.value(type, 0); diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index d3cbea0b92..35b7f13ea4 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -1345,6 +1345,7 @@ void QWindowsMultiFontEngine::loadEngine(int at) fontEngine->fontDef.pixelSize, data); fedw->fontDef = fontDef; + fedw->fontDef.family = fam; fedw->ref.ref(); engines[at] = fedw; @@ -1370,6 +1371,7 @@ void QWindowsMultiFontEngine::loadEngine(int at) engines[at] = new QWindowsFontEngine(fam, hfont, stockFont, lf, data); engines[at]->ref.ref(); engines[at]->fontDef = fontDef; + engines[at]->fontDef.family = fam; qCDebug(lcQpaFonts) << __FUNCTION__ << at << fam; // TODO: increase cost in QFontCache for the font engine loaded here diff --git a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp index f85fe0839f..506c29c9cf 100644 --- a/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp +++ b/src/plugins/platformthemes/gtk2/qgtk2dialoghelpers.cpp @@ -308,7 +308,13 @@ QUrl QGtk2FileDialogHelper::directory() const void QGtk2FileDialogHelper::selectFile(const QUrl &filename) { GtkDialog *gtkDialog = d->gtkDialog(); - gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(gtkDialog), filename.toLocalFile().toUtf8()); + if (options()->acceptMode() == QFileDialogOptions::AcceptSave) { + QFileInfo fi(filename.toLocalFile()); + gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(gtkDialog), fi.path().toUtf8()); + gtk_file_chooser_set_current_name(GTK_FILE_CHOOSER(gtkDialog), fi.fileName().toUtf8()); + } else { + gtk_file_chooser_select_filename(GTK_FILE_CHOOSER(gtkDialog), filename.toLocalFile().toUtf8()); + } } QList<QUrl> QGtk2FileDialogHelper::selectedFiles() const diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp index bf39b9309d..926d36f73f 100644 --- a/src/printsupport/kernel/qprintengine_win.cpp +++ b/src/printsupport/kernel/qprintengine_win.cpp @@ -203,7 +203,7 @@ bool QWin32PrintEngine::newPage() bool transparent = GetBkMode(d->hdc) == TRANSPARENT; - if (!EndPage(d->hdc)) { + if (EndPage(d->hdc) <= 0) { qErrnoWarning("QWin32PrintEngine::newPage: EndPage failed"); return false; } @@ -216,7 +216,7 @@ bool QWin32PrintEngine::newPage() d->reinit = false; } - if (!StartPage(d->hdc)) { + if (StartPage(d->hdc) <= 0) { qErrnoWarning("Win32PrintEngine::newPage: StartPage failed"); return false; } @@ -235,7 +235,7 @@ bool QWin32PrintEngine::newPage() bool success = false; if (d->hdc && d->state == QPrinter::Active) { - if (EndPage(d->hdc) != SP_ERROR) { + if (EndPage(d->hdc) > 0) { // reinitialize the DC before StartPage if needed, // because resetdc is disabled between calls to the StartPage and EndPage functions // (see StartPage documentation in the Platform SDK:Windows GDI) @@ -248,7 +248,7 @@ bool QWin32PrintEngine::newPage() qErrnoWarning("QWin32PrintEngine::newPage(), ResetDC failed (2)"); d->reinit = false; } - success = (StartPage(d->hdc) != SP_ERROR); + success = (StartPage(d->hdc) > 0); } if (!success) { d->state = QPrinter::Aborted; diff --git a/src/widgets/dialogs/qfiledialog.cpp b/src/widgets/dialogs/qfiledialog.cpp index d202884416..77b94c02a4 100644 --- a/src/widgets/dialogs/qfiledialog.cpp +++ b/src/widgets/dialogs/qfiledialog.cpp @@ -91,9 +91,7 @@ Q_GLOBAL_STATIC(QUrl, lastVisitedDir) The QFileDialog class enables a user to traverse the file system in order to select one or many files or a directory. - The easiest way to create a QFileDialog is to use the static - functions. On Windows, Mac OS X, KDE and GNOME, these static functions will - call the native file dialog when possible. + The easiest way to create a QFileDialog is to use the static functions. \snippet code/src_gui_dialogs_qfiledialog.cpp 0 diff --git a/src/widgets/dialogs/qfontdialog.cpp b/src/widgets/dialogs/qfontdialog.cpp index 5a68bfbc66..fc9f36f0c2 100644 --- a/src/widgets/dialogs/qfontdialog.cpp +++ b/src/widgets/dialogs/qfontdialog.cpp @@ -65,6 +65,10 @@ #include <private/qdialog_p.h> #include <private/qfont_p.h> +#include <QtGui/private/qguiapplication_p.h> +#include <qpa/qplatformintegration.h> +#include <qpa/qplatformfontdatabase.h> + QT_BEGIN_NAMESPACE class QFontListView : public QListView @@ -485,8 +489,13 @@ void QFontDialogPrivate::updateFamilies() const QFontDialog::FontDialogOptions spacingMask = (QFontDialog::ProportionalFonts | QFontDialog::MonospacedFonts); const QFontDialog::FontDialogOptions options = q->options(); + QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); + QStringList familyNames; foreach (const QString &family, fdb.families(writingSystem)) { + if (pfdb->isPrivateFontFamily(family)) + continue; + if ((options & scalableMask) && (options & scalableMask) != scalableMask) { if (bool(options & QFontDialog::ScalableFonts) != fdb.isSmoothlyScalable(family)) continue; diff --git a/src/widgets/itemviews/qabstractitemview.cpp b/src/widgets/itemviews/qabstractitemview.cpp index 4b59e72545..37dcede6e3 100644 --- a/src/widgets/itemviews/qabstractitemview.cpp +++ b/src/widgets/itemviews/qabstractitemview.cpp @@ -1370,6 +1370,15 @@ bool QAbstractItemView::tabKeyNavigation() const return d->tabKeyNavigation; } +/*! + \since 5.2 + \reimp +*/ +QSize QAbstractItemView::viewportSizeHint() const +{ + return QAbstractScrollArea::viewportSizeHint(); +} + #ifndef QT_NO_DRAGANDDROP /*! \property QAbstractItemView::showDropIndicator @@ -1391,15 +1400,6 @@ bool QAbstractItemView::showDropIndicator() const } /*! - \since 5.2 - \reimp -*/ -QSize QAbstractItemView::viewportSizeHint() const -{ - return QAbstractScrollArea::viewportSizeHint(); -} - -/*! \property QAbstractItemView::dragEnabled \brief whether the view supports dragging of its own items diff --git a/src/widgets/widgets/qfontcombobox.cpp b/src/widgets/widgets/qfontcombobox.cpp index db01543629..bdf5092d9e 100644 --- a/src/widgets/widgets/qfontcombobox.cpp +++ b/src/widgets/widgets/qfontcombobox.cpp @@ -53,6 +53,10 @@ #include <QDesktopWidget> #include <qdebug.h> +#include <QtGui/private/qguiapplication_p.h> +#include <qpa/qplatformintegration.h> +#include <qpa/qplatformfontdatabase.h> + QT_BEGIN_NAMESPACE static QFontDatabase::WritingSystem writingSystemFromScript(QLocale::Script script) @@ -328,7 +332,12 @@ void QFontComboBoxPrivate::_q_updateModel() int offset = 0; QFontInfo fi(currentFont); + QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); + for (int i = 0; i < list.size(); ++i) { + if (pfdb->isPrivateFontFamily(list.at(i))) + continue; + if ((filters & scalableMask) && (filters & scalableMask) != scalableMask) { if (bool(filters & QFontComboBox::ScalableFonts) != fdb.isSmoothlyScalable(list.at(i))) continue; diff --git a/src/widgets/widgets/qwidgetanimator.cpp b/src/widgets/widgets/qwidgetanimator.cpp index 1209ade536..a2d950c12b 100644 --- a/src/widgets/widgets/qwidgetanimator.cpp +++ b/src/widgets/widgets/qwidgetanimator.cpp @@ -41,6 +41,7 @@ #include <QtCore/qpropertyanimation.h> #include <QtWidgets/qwidget.h> +#include <QtWidgets/qstyle.h> #include <private/qmainwindowlayout_p.h> #include "qwidgetanimator_p.h" diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro index 284f2a2201..b891e4bce0 100644 --- a/src/winmain/winmain.pro +++ b/src/winmain/winmain.pro @@ -29,10 +29,7 @@ load(qt_installs) TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end load(qt_targets) +load(qt_build_paths) +load(qt_common) wince*:QMAKE_POST_LINK = - -lib_replace.match = $$[QT_INSTALL_LIBS/get] -lib_replace.replace = $$[QT_INSTALL_LIBS/raw] -lib_replace.CONFIG = path -QMAKE_PRL_INSTALL_REPLACE += lib_replace |