diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-04-12 12:53:13 +0200 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-04-12 12:53:13 +0200 |
commit | aa3754d1058c08b18dc5c3f38ca9496ce152c584 (patch) | |
tree | f2df5de02aab5d82a75e63c54f1bb9882ff89583 /src | |
parent | a12a67c820fb010bc0396233528d652b717842e6 (diff) | |
parent | 8c81b282f8e18897257b93cb3fc149d74441c40e (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Iee73c93067c5822d8dd51a8692e6da9df4ba49f5
Diffstat (limited to 'src')
33 files changed, 137 insertions, 96 deletions
diff --git a/src/angle/src/config.pri b/src/angle/src/config.pri index 923a40597e..465bcf6a1e 100644 --- a/src/angle/src/config.pri +++ b/src/angle/src/config.pri @@ -54,12 +54,13 @@ angle_d3d11 { CONFIG(debug, debug|release) { DEFINES += _DEBUG } else { + CONFIG += rtti_off DEFINES += NDEBUG } # c++11 is needed by MinGW to get support for unordered_map. CONFIG -= qt -CONFIG += stl rtti_off exceptions c++11 +CONFIG += stl exceptions c++11 contains(QT_CONFIG, debug_and_release):CONFIG += debug_and_release contains(QT_CONFIG, build_all):CONFIG += build_all diff --git a/src/corelib/Qt5CTestMacros.cmake b/src/corelib/Qt5CTestMacros.cmake index e507c8009e..126a348b47 100644 --- a/src/corelib/Qt5CTestMacros.cmake +++ b/src/corelib/Qt5CTestMacros.cmake @@ -19,6 +19,10 @@ if (CMAKE_TOOLCHAIN_FILE) list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}") endif() +if (CMAKE_VERBOSE_MAKEFILE) + list(APPEND BUILD_OPTIONS_LIST "-DCMAKE_VERBOSE_MAKEFILE=1") +endif() + if (NO_WIDGETS) list(APPEND BUILD_OPTIONS_LIST "-DNO_WIDGETS=True") endif() @@ -110,24 +114,29 @@ function(test_module_includes) "${packages_string} find_package(Qt5${qtmodule} 5.0.0 REQUIRED) include_directories(\${Qt5${qtmodule}_INCLUDE_DIRS}) - add_definitions(\${Qt5${qtmodule}_DEFINITIONS}) - - if(NOT \"\${Qt5${qtmodule}_VERSION}\" VERSION_EQUAL ${CMAKE_MODULE_VERSION}) - message(SEND_ERROR \"Qt5${qtmodule}_VERSION variable was not ${CMAKE_MODULE_VERSION}. Got \${Qt5${qtmodule}_VERSION} instead.\") - endif() - if(NOT \"\${Qt5${qtmodule}_VERSION_MAJOR}\" VERSION_EQUAL ${CMAKE_${qtmodule}_MODULE_MAJOR_VERSION}) - message(SEND_ERROR \"Qt5${qtmodule}_VERSION_MAJOR variable was not ${CMAKE_${qtmodule}_MODULE_MAJOR_VERSION}. Got \${Qt5${qtmodule}_VERSION_MAJOR} instead.\") - endif() - if(NOT \"\${Qt5${qtmodule}_VERSION_MINOR}\" VERSION_EQUAL ${CMAKE_${qtmodule}_MODULE_MINOR_VERSION}) - message(SEND_ERROR \"Qt5${qtmodule}_VERSION_MINOR variable was not ${CMAKE_${qtmodule}_MODULE_MINOR_VERSION}. Got \${Qt5${qtmodule}_VERSION_MINOR} instead.\") - endif() - if(NOT \"\${Qt5${qtmodule}_VERSION_PATCH}\" VERSION_EQUAL ${CMAKE_${qtmodule}_MODULE_PATCH_VERSION}) - message(SEND_ERROR \"Qt5${qtmodule}_VERSION_PATCH variable was not ${CMAKE_${qtmodule}_MODULE_PATCH_VERSION}. Got \${Qt5${qtmodule}_VERSION_PATCH} instead.\") - endif() - if(NOT \"\${Qt5${qtmodule}_VERSION_STRING}\" VERSION_EQUAL ${CMAKE_MODULE_VERSION}) - message(SEND_ERROR \"Qt5${qtmodule}_VERSION_STRING variable was not ${CMAKE_MODULE_VERSION}. Got \${Qt5${qtmodule}_VERSION_STRING} instead.\") - endif()\n" - ) + add_definitions(\${Qt5${qtmodule}_DEFINITIONS})\n") + + list(FIND CMAKE_MODULES_UNDER_TEST ${qtmodule} _findIndex) + if (NOT _findIndex STREQUAL -1) + set(packages_string + "${packages_string} + if(NOT \"\${Qt5${qtmodule}_VERSION}\" VERSION_EQUAL ${CMAKE_MODULE_VERSION}) + message(SEND_ERROR \"Qt5${qtmodule}_VERSION variable was not ${CMAKE_MODULE_VERSION}. Got \${Qt5${qtmodule}_VERSION} instead.\") + endif() + if(NOT \"\${Qt5${qtmodule}_VERSION_MAJOR}\" VERSION_EQUAL ${CMAKE_${qtmodule}_MODULE_MAJOR_VERSION}) + message(SEND_ERROR \"Qt5${qtmodule}_VERSION_MAJOR variable was not ${CMAKE_${qtmodule}_MODULE_MAJOR_VERSION}. Got \${Qt5${qtmodule}_VERSION_MAJOR} instead.\") + endif() + if(NOT \"\${Qt5${qtmodule}_VERSION_MINOR}\" VERSION_EQUAL ${CMAKE_${qtmodule}_MODULE_MINOR_VERSION}) + message(SEND_ERROR \"Qt5${qtmodule}_VERSION_MINOR variable was not ${CMAKE_${qtmodule}_MODULE_MINOR_VERSION}. Got \${Qt5${qtmodule}_VERSION_MINOR} instead.\") + endif() + if(NOT \"\${Qt5${qtmodule}_VERSION_PATCH}\" VERSION_EQUAL ${CMAKE_${qtmodule}_MODULE_PATCH_VERSION}) + message(SEND_ERROR \"Qt5${qtmodule}_VERSION_PATCH variable was not ${CMAKE_${qtmodule}_MODULE_PATCH_VERSION}. Got \${Qt5${qtmodule}_VERSION_PATCH} instead.\") + endif() + if(NOT \"\${Qt5${qtmodule}_VERSION_STRING}\" VERSION_EQUAL ${CMAKE_MODULE_VERSION}) + message(SEND_ERROR \"Qt5${qtmodule}_VERSION_STRING variable was not ${CMAKE_MODULE_VERSION}. Got \${Qt5${qtmodule}_VERSION_STRING} instead.\") + endif()\n" + ) + endif() set(libraries_string "${libraries_string} Qt5::${qtmodule}") endwhile() diff --git a/src/corelib/Qt5Config.cmake.in b/src/corelib/Qt5Config.cmake.in index 408dd64496..a7e9a042e8 100644 --- a/src/corelib/Qt5Config.cmake.in +++ b/src/corelib/Qt5Config.cmake.in @@ -18,7 +18,7 @@ if (Qt5_FIND_QUIETLY) set(_Qt5_FIND_PARTS_QUIET QUIET) endif() -get_filename_component(_qt5_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/$${CMAKE_RELATIVE_INSTALL_DIR}\" ABSOLUTE) +get_filename_component(_qt5_install_prefix \"${CMAKE_CURRENT_LIST_DIR}/..\" ABSOLUTE) set(_Qt5_NOTFOUND_MESSAGE) @@ -30,9 +30,9 @@ foreach(module ${Qt5_FIND_COMPONENTS}) ) if (NOT Qt5${module}_FOUND) if (Qt5_FIND_REQUIRED_${module}) - set(_Qt5_NOTFOUND_MESSAGE \"${_Qt5_NOTFOUND_MESSAGE}Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_qt5_install_prefix}/lib/cmake/Qt5${module}/Qt5${module}Config.cmake\\\"\\n\") + set(_Qt5_NOTFOUND_MESSAGE \"${_Qt5_NOTFOUND_MESSAGE}Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_qt5_install_prefix}/Qt5${module}/Qt5${module}Config.cmake\\\"\\n\") elseif(NOT Qt5_FIND_QUIETLY) - message(WARNING \"Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_qt5_install_prefix}/lib/cmake/Qt5${module}/Qt5${module}Config.cmake\\\"\") + message(WARNING \"Failed to find Qt5 component \\\"${module}\\\" config file at \\\"${_qt5_install_prefix}/Qt5${module}/Qt5${module}Config.cmake\\\"\") endif() endif() endforeach() diff --git a/src/corelib/Qt5CoreMacros.cmake b/src/corelib/Qt5CoreMacros.cmake index e3115db8ee..b6124b40cd 100644 --- a/src/corelib/Qt5CoreMacros.cmake +++ b/src/corelib/Qt5CoreMacros.cmake @@ -215,6 +215,7 @@ function(QT5_ADD_RESOURCES outfiles ) set(${outfiles} ${${outfiles}} PARENT_SCOPE) endfunction() +set(_Qt5_COMPONENT_PATH "${CMAKE_CURRENT_LIST_DIR}/..") if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) macro(qt5_use_modules _target _link_type) @@ -234,7 +235,7 @@ if (NOT CMAKE_VERSION VERSION_LESS 2.8.9) foreach(_module ${_qt5_modules}) if (NOT Qt5${_module}_FOUND) - find_package(Qt5${_module} PATHS ${_qt5Core_install_prefix} NO_DEFAULT_PATH) + find_package(Qt5${_module} PATHS "${_Qt5_COMPONENT_PATH}" NO_DEFAULT_PATH) if (NOT Qt5${_module}_FOUND) message(FATAL_ERROR "Can not use \"${_module}\" module which has not yet been found.") endif() diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index f95e1e9447..c8293beb4e 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -876,7 +876,13 @@ static void qDefaultMessageHandler(QtMsgType type, const QMessageLogContext &con #if defined(QT_USE_SLOG2) slog2_default_handler(type, logMessage.toLocal8Bit().constData()); #elif defined(Q_OS_ANDROID) - android_default_message_handler(type, context, logMessage); + static bool logToAndroid = qEnvironmentVariableIsEmpty("QT_ANDROID_PLAIN_LOG"); + if (logToAndroid) { + android_default_message_handler(type, context, logMessage); + } else { + fprintf(stderr, "%s", logMessage.toLocal8Bit().constData()); + fflush(stderr); + } #else fprintf(stderr, "%s", logMessage.toLocal8Bit().constData()); fflush(stderr); diff --git a/src/corelib/kernel/qtcore_eval.cpp b/src/corelib/kernel/qtcore_eval.cpp index ab575371c8..e9ff786074 100644 --- a/src/corelib/kernel/qtcore_eval.cpp +++ b/src/corelib/kernel/qtcore_eval.cpp @@ -496,6 +496,7 @@ public: setParent(parentWidget(), Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint); QTimer::singleShot(7000, this, SLOT(close())); setAttribute(Qt::WA_DeleteOnClose); + setAttribute(Qt::WA_QuitOnClose, false); } setFixedSize(sizeHint()); diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h index a06fb7b4eb..816e1f15f6 100644 --- a/src/corelib/tools/qvector.h +++ b/src/corelib/tools/qvector.h @@ -493,7 +493,7 @@ void QVector<T>::reallocData(const int asize, const int aalloc, QArrayData::Allo } x->capacityReserved = d->capacityReserved; } else { - Q_ASSERT(d->alloc == aalloc); // resize, without changing allocation size + Q_ASSERT(int(d->alloc) == aalloc); // resize, without changing allocation size Q_ASSERT(isDetached()); // can be done only on detached d Q_ASSERT(x == d); // in this case we do not need to allocate anything if (asize <= d->size) { diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp index 7487aabde5..4fd595ed5a 100644 --- a/src/gui/accessible/qaccessible.cpp +++ b/src/gui/accessible/qaccessible.cpp @@ -1507,7 +1507,7 @@ QAccessibleInterface *QAccessibleEvent::accessibleInterface() const QAccessibleInterface *iface = QAccessible::queryAccessibleInterface(m_object); if (!iface || !iface->isValid()) { static bool hasWarned = false; - if (!hasWarned) { + if (!iface && !hasWarned) { qWarning() << "Problem creating accessible interface for: " << m_object << endl << "Make sure to deploy Qt with accessibility plugins."; hasWarned = true; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c2e19ca2a8..432929fec5 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -602,6 +602,12 @@ bool QGuiApplicationPrivate::isWindowBlocked(QWindow *window, QWindow **blocking return false; } +bool QGuiApplicationPrivate::synthesizeMouseFromTouchEventsEnabled() +{ + return QCoreApplication::testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents) + && QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool(); +} + /*! Returns the QWindow that receives events tied to focus, such as key events. @@ -2054,7 +2060,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To } QGuiApplication::sendSpontaneousEvent(w, &touchEvent); - if (!e->synthetic && !touchEvent.isAccepted() && qApp->testAttribute(Qt::AA_SynthesizeMouseForUnhandledTouchEvents)) { + if (!e->synthetic && !touchEvent.isAccepted() && synthesizeMouseFromTouchEventsEnabled()) { // exclude touchpads as those generate their own mouse events if (touchEvent.device()->type() != QTouchDevice::TouchPad) { Qt::MouseButtons b = eventType == QEvent::TouchEnd ? Qt::NoButton : Qt::LeftButton; diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 22d95b2121..376890ef47 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -191,6 +191,8 @@ public: static void updateBlockedStatus(QWindow *window); virtual bool isWindowBlocked(QWindow *window, QWindow **blockingWindow = 0) const; + static bool synthesizeMouseFromTouchEventsEnabled(); + static Qt::MouseButtons buttons; static ulong mousePressTime; static Qt::MouseButton mousePressButton; diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index fc694dc497..1d6cf3ceca 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -191,8 +191,8 @@ QFontPrivate::QFontPrivate(const QFontPrivate &other) QFontPrivate::~QFontPrivate() { - if (engineData) - engineData->ref.deref(); + if (engineData && !engineData->ref.deref()) + delete engineData; engineData = 0; if (scFont && scFont != this) scFont->ref.deref(); @@ -210,7 +210,8 @@ QFontEngine *QFontPrivate::engineForScript(int script) const script = QChar::Script_Common; if (engineData && engineData->fontCache != QFontCache::instance()) { // throw out engineData that came from a different thread - engineData->ref.deref(); + if (!engineData->ref.deref()) + delete engineData; engineData = 0; } if (!engineData || !QT_FONT_ENGINE_FROM_DATA(engineData, script)) @@ -316,13 +317,14 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other) QFontEngineData::QFontEngineData() - : ref(1), fontCache(QFontCache::instance()) + : ref(0), fontCache(QFontCache::instance()) { memset(engines, 0, QChar::ScriptCount * sizeof(QFontEngine *)); } QFontEngineData::~QFontEngineData() { + Q_ASSERT(ref.load() == 0); for (int i = 0; i < QChar::ScriptCount; ++i) { if (engines[i]) { if (!engines[i]->ref.deref()) @@ -637,8 +639,8 @@ QFont::QFont(QFontPrivate *data) void QFont::detach() { if (d->ref.load() == 1) { - if (d->engineData) - d->engineData->ref.deref(); + if (d->engineData && !d->engineData->ref.deref()) + delete d->engineData; d->engineData = 0; if (d->scFont && d->scFont != d.data()) d->scFont->ref.deref(); @@ -2641,7 +2643,7 @@ QFontCache::~QFontCache() EngineDataCache::ConstIterator it = engineDataCache.constBegin(), end = engineDataCache.constEnd(); while (it != end) { - if (it.value()->ref.load() == 0) + if (!it.value()->ref.deref()) delete it.value(); else FC_DEBUG("QFontCache::~QFontCache: engineData %p still has refcount %d", @@ -2713,7 +2715,9 @@ void QFontCache::insertEngineData(const QFontDef &def, QFontEngineData *engineDa def.pixelSize, def.weight, def.style, def.fixedPitch); } #endif + Q_ASSERT(!engineDataCache.contains(def)); + engineData->ref.ref(); engineDataCache.insert(def, engineData); increaseCost(sizeof(QFontEngineData)); } @@ -2829,7 +2833,7 @@ void QFontCache::timerEvent(QTimerEvent *) for (; it != end; ++it) { FC_DEBUG(" %p: ref %2d", it.value(), int(it.value()->ref.load())); - if (it.value()->ref.load() != 0) + if (it.value()->ref.load() != 1) in_use_cost += engine_data_cost; } } @@ -2894,9 +2898,10 @@ void QFontCache::timerEvent(QTimerEvent *) // clean out all unused engine data EngineDataCache::Iterator it = engineDataCache.begin(); while (it != engineDataCache.end()) { - if (it.value()->ref.load() == 0) { + if (it.value()->ref.load() == 1) { FC_DEBUG(" %p", it.value()); decreaseCost(sizeof(QFontEngineData)); + it.value()->ref.deref(); delete it.value(); it = engineDataCache.erase(it); } else { diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 4cbf51d59c..115e866f24 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -143,6 +143,9 @@ public: QFontCache *fontCache; QFontEngine *engines[QChar::ScriptCount]; + +private: + Q_DISABLE_COPY(QFontEngineData) }; diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index e3270b430f..62379cd592 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -344,6 +344,7 @@ struct QtFontFamily bool askedForFallback; unsigned char writingSystems[QFontDatabase::WritingSystemsCount]; + bool matchesFamilyName(const QString &familyName) const; QtFontFoundry *foundry(const QString &f, bool = false); }; @@ -383,6 +384,11 @@ QtFontFoundry *QtFontFamily::foundry(const QString &f, bool create) return foundries[count++]; } +bool QtFontFamily::matchesFamilyName(const QString &familyName) const +{ + return name.compare(familyName, Qt::CaseInsensitive) == 0 || aliases.contains(familyName, Qt::CaseInsensitive); +} + class QFontDatabasePrivate { @@ -613,9 +619,8 @@ static void getEngineData(const QFontPrivate *d, const QFontDef &def) // create a new one d->engineData = new QFontEngineData; QFontCache::instance()->insertEngineData(def, d->engineData); - } else { - d->engineData->ref.ref(); } + d->engineData->ref.ref(); } static QStringList familyList(const QFontDef &req) @@ -852,19 +857,7 @@ static bool matchFamilyName(const QString &familyName, QtFontFamily *f) { if (familyName.isEmpty()) return true; - - if (f->name.compare(familyName, Qt::CaseInsensitive) == 0) - return true; - - QStringList::const_iterator it = f->aliases.constBegin(); - while (it != f->aliases.constEnd()) { - if ((*it).compare(familyName, Qt::CaseInsensitive) == 0) - return true; - - ++it; - } - - return false; + return f->matchesFamilyName(familyName); } /*! diff --git a/src/gui/text/qfontdatabase_qpa.cpp b/src/gui/text/qfontdatabase_qpa.cpp index be42e892fa..32580ada7a 100644 --- a/src/gui/text/qfontdatabase_qpa.cpp +++ b/src/gui/text/qfontdatabase_qpa.cpp @@ -110,8 +110,7 @@ static QStringList fallbackFamilies(const QString &family, QFont::Style style, Q for (i = retList.begin(); i != retList.end(); ++i) { bool contains = false; for (int j = 0; j < db->count; j++) { - QtFontFamily *qtFamily = db->families[j]; - if (!(i->compare(qtFamily->name,Qt::CaseInsensitive))) { + if (db->families[j]->matchesFamilyName(*i)) { contains = true; break; } diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 19b4411b47..10225febcb 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -232,7 +232,7 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, QScopedPointer<QFreetypeFace> newFreetype(new QFreetypeFace); FT_Face face; if (!face_id.filename.isEmpty()) { - QString fileName = QString::fromUtf8(face_id.filename); + QString fileName = QFile::decodeName(face_id.filename); if (face_id.filename.startsWith(":qmemoryfonts/")) { // from qfontdatabase.cpp QByteArray idx = face_id.filename; diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp index edde5a4687..31aaa6e1c5 100644 --- a/src/network/socket/qlocalsocket_tcp.cpp +++ b/src/network/socket/qlocalsocket_tcp.cpp @@ -234,7 +234,7 @@ bool QLocalSocket::open(OpenMode openMode) } const QLatin1String prefix("QLocalServer/"); - if (name.startsWith(prefix)) + if (d->serverName.startsWith(prefix)) d->fullServerName = d->serverName; else d->fullServerName = prefix + d->serverName; diff --git a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp index 49440c8566..9b87418846 100644 --- a/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp +++ b/src/platformsupport/fontdatabases/basic/qbasicfontdatabase.cpp @@ -123,7 +123,7 @@ QFontEngine *QBasicFontDatabase::fontEngine(const QFontDef &fontDef, QChar::Scri QFontEngineFT *engine; FontFile *fontfile = static_cast<FontFile *> (usrPtr); QFontEngine::FaceId fid; - fid.filename = fontfile->fileName.toLocal8Bit(); + fid.filename = QFile::encodeName(fontfile->fileName); fid.index = fontfile->indexValue; engine = new QFontEngineFT(fontDef); diff --git a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp index 6ba71d112e..8d6f415fba 100644 --- a/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp +++ b/src/platformsupport/fontdatabases/fontconfig/qfontconfigdatabase.cpp @@ -356,7 +356,7 @@ static bool isSymbolFont(FontFile *fontFile) return false; QFontEngine::FaceId id; - id.filename = fontFile->fileName.toLocal8Bit(); + id.filename = QFile::encodeName(fontFile->fileName); id.index = fontFile->indexValue; QFreetypeFace *f = QFreetypeFace::getFace(id); @@ -370,6 +370,8 @@ static bool isSymbolFont(FontFile *fontFile) return hasSymbolMap; } +Q_GUI_EXPORT void qt_registerAliasToFontFamily(const QString &familyName, const QString &alias); + void QFontconfigDatabase::populateFontDatabase() { FcFontSet *fonts; @@ -511,6 +513,9 @@ void QFontconfigDatabase::populateFontDatabase() QString styleName = style_value ? QString::fromUtf8((const char *) style_value) : QString(); QPlatformFontDatabase::registerFont(familyName,styleName,QLatin1String((const char *)foundry_value),weight,style,stretch,antialias,scalable,pixel_size,fixedPitch,writingSystems,fontFile); // qDebug() << familyName << (const char *)foundry_value << weight << style << &writingSystems << scalable << true << pixel_size; + + for (int k = 1; FcPatternGetString(fonts->fonts[i], FC_FAMILY, k, &value) == FcResultMatch; ++k) + qt_registerAliasToFontFamily(familyName, QString::fromUtf8((const char *)value)); } FcFontSetDestroy (fonts); @@ -562,7 +567,7 @@ QFontEngine *QFontconfigDatabase::fontEngine(const QFontDef &f, QChar::Script sc QFontEngineFT *engine; FontFile *fontfile = static_cast<FontFile *> (usrPtr); QFontEngine::FaceId fid; - fid.filename = fontfile->fileName.toLocal8Bit(); + fid.filename = QFile::encodeName(fontfile->fileName); fid.index = fontfile->indexValue; bool antialias = !(fontDef.styleStrategy & QFont::NoAntialias); diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 1e9acd79ed..7093d27efe 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -211,7 +211,7 @@ static QString strippedText(QString s) - (void)closePanel { - *mCurrentSelection = QT_PREPEND_NAMESPACE(QCFString::toQString)([[mSavePanel URL] path]); + *mCurrentSelection = QT_PREPEND_NAMESPACE(QCFString::toQString)([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C); if ([mSavePanel respondsToSelector:@selector(close)]) [mSavePanel close]; if ([mSavePanel isSheet]) @@ -376,11 +376,11 @@ static QString strippedText(QString s) QStringList result; NSArray* array = [mOpenPanel URLs]; for (NSUInteger i=0; i<[array count]; ++i) - result << QCFString::toQString([[array objectAtIndex:i] path]); + result << QCFString::toQString([[array objectAtIndex:i] path]).normalized(QString::NormalizationForm_C); return result; } else { QStringList result; - QString filename = QT_PREPEND_NAMESPACE(QCFString::toQString)([[mSavePanel URL] path]); + QString filename = QT_PREPEND_NAMESPACE(QCFString::toQString)([[mSavePanel URL] path]).normalized(QString::NormalizationForm_C); result << filename.remove(QLatin1String("___qt_very_unlikely_prefix_")); return result; } @@ -586,7 +586,7 @@ QString QCocoaFileDialogHelper::directory() const { QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *delegate = static_cast<QT_MANGLE_NAMESPACE(QNSOpenSavePanelDelegate) *>(mDelegate); if (delegate) - return QCFString::toQString([[delegate->mSavePanel directoryURL] path]); + return QCFString::toQString([[delegate->mSavePanel directoryURL] path]).normalized(QString::NormalizationForm_C); return QString(); } diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 59e7ce1526..2b10a26c88 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -507,6 +507,7 @@ void QQnxIntegration::createDisplay(screen_display_t display, bool isPrimary) QQnxScreen *screen = new QQnxScreen(m_screenContext, display, isPrimary); m_screens.append(screen); screenAdded(screen); + screen->adjustOrientation(); QObject::connect(m_screenEventHandler, SIGNAL(newWindowCreated(void*)), screen, SLOT(newWindowCreated(void*))); diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 7614abdc6a..2b81559ab6 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -498,6 +498,18 @@ void QQnxScreen::onWindowPost(QQnxWindow *window) } } +void QQnxScreen::adjustOrientation() +{ + if (!m_primaryScreen) + return; + + bool ok = false; + const int rotation = qgetenv("ORIENTATION").toInt(&ok); + + if (ok) + setRotation(rotation); +} + QPlatformCursor * QQnxScreen::cursor() const { return m_cursor; diff --git a/src/plugins/platforms/qnx/qqnxscreen.h b/src/plugins/platforms/qnx/qqnxscreen.h index 41dc675599..98f2a90fbc 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.h +++ b/src/plugins/platforms/qnx/qqnxscreen.h @@ -92,6 +92,7 @@ public: void updateHierarchy(); void onWindowPost(QQnxWindow *window); + void adjustOrientation(); QSharedPointer<QQnxRootWindow> rootWindow() const; diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index 545484de8d..3f4555a31f 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -271,22 +271,19 @@ QWindowsContextPrivate::QWindowsContextPrivate() : m_eventType(QByteArrayLiteral("windows_generic_MSG")), m_lastActiveWindow(0), m_asyncExpose(0) { + const QSysInfo::WinVersion ver = QSysInfo::windowsVersion(); #ifndef Q_OS_WINCE QWindowsContext::user32dll.init(); QWindowsContext::shell32dll.init(); -#endif // Ensure metrics functions report correct data, QTBUG-30063. if (QWindowsContext::user32dll.setProcessDPIAware) QWindowsContext::user32dll.setProcessDPIAware(); - m_displayContext = GetDC(0); - m_defaultDPI = GetDeviceCaps(m_displayContext, LOGPIXELSY); - const QSysInfo::WinVersion ver = QSysInfo::windowsVersion(); -#ifndef Q_OS_WINCE if (hasTouchSupport(ver) && QWindowsContext::user32dll.initTouch()) m_systemInfo |= QWindowsContext::SI_SupportsTouch; -#endif - +#endif // !Q_OS_WINCE + m_displayContext = GetDC(0); + m_defaultDPI = GetDeviceCaps(m_displayContext, LOGPIXELSY); if (useRTL_Extensions(ver)) { m_systemInfo |= QWindowsContext::SI_RTL_Extensions; m_keyMapper.setUseRTLExtensions(true); @@ -417,10 +414,7 @@ QString QWindowsContext::registerWindowClass(const QWindow *w, bool isGL) if (icon) cname += QStringLiteral("Icon"); - HBRUSH brush = 0; - if (!isGL) - brush = GetSysColorBrush(COLOR_WINDOW); - return registerWindowClass(cname, qWindowsWndProc, style, brush, icon); + return registerWindowClass(cname, qWindowsWndProc, style, GetSysColorBrush(COLOR_WINDOW), icon); } QString QWindowsContext::registerWindowClass(QString cname, diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index 98b4e7af62..7f97d58be4 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -285,7 +285,7 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, return false; if (!QDir::isAbsolutePath(value)) - value.prepend(QString::fromLocal8Bit(qgetenv("windir") + "\\Fonts\\")); + value.prepend(QFile::decodeName(qgetenv("windir") + "\\Fonts\\")); QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index c402f00453..5757bcad4e 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -190,7 +190,7 @@ void QWindowsFontEngine::getCMap() unitsPerEm = otm->otmEMSquare; x_height = (int)otm->otmsXHeight; loadKerningPairs(designToDevice); - _faceId.filename = QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFullName)).toLatin1(); + _faceId.filename = QFile::encodeName(QString::fromWCharArray((wchar_t *)((char *)otm + (quintptr)otm->otmpFullName))); lineWidth = otm->otmsUnderscoreSize; fsType = otm->otmfsType; free(otm); diff --git a/src/testlib/qtestmouse.h b/src/testlib/qtestmouse.h index ea57ac5b8c..4d70aff27e 100644 --- a/src/testlib/qtestmouse.h +++ b/src/testlib/qtestmouse.h @@ -84,6 +84,9 @@ namespace QTest QTEST_ASSERT(window); extern int Q_TESTLIB_EXPORT defaultMouseDelay(); + if (!window->geometry().contains(pos)) + QTest::qWarn("Mouse event occurs outside of target window."); + static Qt::MouseButton lastButton = Qt::NoButton; if (delay == -1 || delay < defaultMouseDelay()) diff --git a/src/tools/qdoc/quoter.h b/src/tools/qdoc/quoter.h index 223fdd96b3..622e225421 100644 --- a/src/tools/qdoc/quoter.h +++ b/src/tools/qdoc/quoter.h @@ -83,7 +83,6 @@ private: int unindent = 0); bool silent; - bool validRegExp; QStringList plainLines; QStringList markedLines; Location codeLocation; diff --git a/src/tools/uic/databaseinfo.cpp b/src/tools/uic/databaseinfo.cpp index 9832f332db..a052cdf55a 100644 --- a/src/tools/uic/databaseinfo.cpp +++ b/src/tools/uic/databaseinfo.cpp @@ -46,8 +46,7 @@ QT_BEGIN_NAMESPACE -DatabaseInfo::DatabaseInfo(Driver *drv) - : driver(drv) +DatabaseInfo::DatabaseInfo() { } diff --git a/src/tools/uic/databaseinfo.h b/src/tools/uic/databaseinfo.h index 043407d4f7..db60a1b0ff 100644 --- a/src/tools/uic/databaseinfo.h +++ b/src/tools/uic/databaseinfo.h @@ -53,7 +53,7 @@ class Driver; class DatabaseInfo : public TreeWalker { public: - DatabaseInfo(Driver *driver); + DatabaseInfo(); void acceptUI(DomUI *node); void acceptWidget(DomWidget *node); @@ -68,7 +68,6 @@ public: { return m_fields.value(connection); } private: - Driver *driver; QStringList m_connections; QMap<QString, QStringList> m_cursors; QMap<QString, QStringList> m_fields; diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp index 1afa19b321..be4df64696 100644 --- a/src/tools/uic/uic.cpp +++ b/src/tools/uic/uic.cpp @@ -67,7 +67,6 @@ Uic::Uic(Driver *d) : drv(d), out(d->output()), opt(d->option()), - info(d), externalPix(true) { } diff --git a/src/widgets/kernel/qapplication.cpp b/src/widgets/kernel/qapplication.cpp index ac25d3ed7f..d036f6bada 100644 --- a/src/widgets/kernel/qapplication.cpp +++ b/src/widgets/kernel/qapplication.cpp @@ -3210,7 +3210,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = acceptTouchEvents && d->notify_helper(widget, touchEvent); // If the touch event wasn't accepted, synthesize a mouse event and see if the widget wants it. - if (!touchEvent->isAccepted()) + if (!touchEvent->isAccepted() && QGuiApplicationPrivate::synthesizeMouseFromTouchEventsEnabled()) res = d->translateTouchToMouse(widget, touchEvent); break; } @@ -3237,7 +3237,7 @@ bool QApplication::notify(QObject *receiver, QEvent *e) res = acceptTouchEvents && d->notify_helper(widget, touchEvent); // If the touch event wasn't accepted, synthesize a mouse event and see if the widget wants it. - if (!touchEvent->isAccepted()) { + if (!touchEvent->isAccepted() && QGuiApplicationPrivate::synthesizeMouseFromTouchEventsEnabled()) { res = d->translateTouchToMouse(widget, touchEvent); eventAccepted = touchEvent->isAccepted(); if (eventAccepted) @@ -3801,10 +3801,6 @@ private: bool QApplicationPrivate::translateTouchToMouse(QWidget *widget, QTouchEvent *event) { - // Check if the platform wants synthesized mouse events. - if (!QGuiApplicationPrivate::platformIntegration()->styleHint(QPlatformIntegration::SynthesizeMouseFromTouchEvents).toBool()) - return false; - Q_FOREACH (const QTouchEvent::TouchPoint &p, event->touchPoints()) { const QEvent::Type eventType = (p.state() & Qt::TouchPointPressed) ? QEvent::MouseButtonPress : (p.state() & Qt::TouchPointReleased) ? QEvent::MouseButtonRelease @@ -3841,7 +3837,7 @@ bool QApplicationPrivate::translateTouchToMouse(QWidget *widget, QTouchEvent *ev return false; } -void QApplicationPrivate::translateRawTouchEvent(QWidget *window, +bool QApplicationPrivate::translateRawTouchEvent(QWidget *window, QTouchDevice *device, const QList<QTouchEvent::TouchPoint> &touchPoints, ulong timestamp) @@ -3903,8 +3899,9 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, } if (widgetsNeedingEvents.isEmpty()) - return; + return false; + bool accepted = false; QHash<QWidget *, StatesAndTouchPoints>::ConstIterator it = widgetsNeedingEvents.constBegin(); const QHash<QWidget *, StatesAndTouchPoints>::ConstIterator end = widgetsNeedingEvents.constEnd(); for (; it != end; ++it) { @@ -3943,19 +3940,23 @@ void QApplicationPrivate::translateRawTouchEvent(QWidget *window, { // if the TouchBegin handler recurses, we assume that means the event // has been implicitly accepted and continue to send touch events - widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent); - (void ) QApplication::sendSpontaneousEvent(widget, &touchEvent); + if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) { + accepted = true; + widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent); + } break; } default: if (widget->testAttribute(Qt::WA_WState_AcceptedTouchBeginEvent)) { if (touchEvent.type() == QEvent::TouchEnd) widget->setAttribute(Qt::WA_WState_AcceptedTouchBeginEvent, false); - (void) QApplication::sendSpontaneousEvent(widget, &touchEvent); + if (QApplication::sendSpontaneousEvent(widget, &touchEvent) && touchEvent.isAccepted()) + accepted = true; } break; } } + return accepted; } void QApplicationPrivate::translateTouchCancel(QTouchDevice *device, ulong timestamp) diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h index ca1bccb727..87cf259ba5 100644 --- a/src/widgets/kernel/qapplication_p.h +++ b/src/widgets/kernel/qapplication_p.h @@ -284,7 +284,7 @@ public: void appendTouchPoint(const QTouchEvent::TouchPoint &touchPoint); void removeTouchPoint(int touchPointId); bool translateTouchToMouse(QWidget *widget, QTouchEvent *event); - static void translateRawTouchEvent(QWidget *widget, + static bool translateRawTouchEvent(QWidget *widget, QTouchDevice *device, const QList<QTouchEvent::TouchPoint> &touchPoints, ulong timestamp); diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index ddb570d6c7..bedcfe78bf 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -473,10 +473,12 @@ void QWidgetWindow::handleMouseEvent(QMouseEvent *event) void QWidgetWindow::handleTouchEvent(QTouchEvent *event) { - if (event->type() == QEvent::TouchCancel) + if (event->type() == QEvent::TouchCancel) { QApplicationPrivate::translateTouchCancel(event->device(), event->timestamp()); - else - QApplicationPrivate::translateRawTouchEvent(m_widget, event->device(), event->touchPoints(), event->timestamp()); + event->accept(); + } else { + event->setAccepted(QApplicationPrivate::translateRawTouchEvent(m_widget, event->device(), event->touchPoints(), event->timestamp())); + } } void QWidgetWindow::handleKeyEvent(QKeyEvent *event) |