diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/Qt5CoreConfigExtras.cmake.in | 6 | ||||
-rw-r--r-- | src/corelib/corelib.pro | 3 | ||||
-rw-r--r-- | src/corelib/kernel/qcoreapplication.cpp | 8 | ||||
-rw-r--r-- | src/gui/opengl/qopengltexturehelper.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qfont.cpp | 9 | ||||
-rw-r--r-- | src/gui/text/qfont_p.h | 5 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft.cpp | 44 | ||||
-rw-r--r-- | src/gui/text/qfontengine_ft_p.h | 2 | ||||
-rw-r--r-- | src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp | 64 | ||||
-rw-r--r-- | src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h | 1 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicsitem.cpp | 4 | ||||
-rw-r--r-- | src/widgets/graphicsview/qgraphicswidget_p.cpp | 5 | ||||
-rw-r--r-- | src/widgets/styles/qmacstyle_mac.mm | 1 | ||||
-rw-r--r-- | src/widgets/widgets/qdockwidget.cpp | 8 | ||||
-rw-r--r-- | src/widgets/widgets/qmdiarea.cpp | 5 | ||||
-rw-r--r-- | src/widgets/widgets/qmdisubwindow.cpp | 5 |
16 files changed, 121 insertions, 51 deletions
diff --git a/src/corelib/Qt5CoreConfigExtras.cmake.in b/src/corelib/Qt5CoreConfigExtras.cmake.in index 1e00c74aa6..9bda70ec07 100644 --- a/src/corelib/Qt5CoreConfigExtras.cmake.in +++ b/src/corelib/Qt5CoreConfigExtras.cmake.in @@ -81,6 +81,12 @@ list(APPEND Qt5Core_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT_NAMESPACE=$$QT_NAMESPACE) !!ENDIF +!!IF !isEmpty(CMAKE_DISABLED_FEATURES) +set(Qt5_DISABLED_FEATURES + $$CMAKE_DISABLED_FEATURES +) +!!ENDIF + set_property(TARGET Qt5::Core APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS $<$<NOT:$<CONFIG:Debug>>:QT_NO_DEBUG>) !!IF contains(QT_CONFIG, reduce_exports) diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index 2e4181efb1..b513149e7c 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -79,6 +79,9 @@ cmake_umbrella_config_version_file.input = $$PWD/../../mkspecs/features/data/cma cmake_umbrella_config_version_file.output = $$DESTDIR/cmake/Qt5/Qt5ConfigVersion.cmake load(cmake_functions) +load(qfeatures) + +CMAKE_DISABLED_FEATURES = $$join(QT_DISABLED_FEATURES, "$$escape_expand(\\n) ") CMAKE_HOST_DATA_DIR = $$cmakeRelativePath($$[QT_HOST_DATA/src], $$[QT_INSTALL_PREFIX]) contains(CMAKE_HOST_DATA_DIR, "^\\.\\./.*"):!isEmpty(CMAKE_HOST_DATA_DIR) { diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 43c64b7b2c..61ad4f9be1 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1939,6 +1939,14 @@ QString QCoreApplication::applicationFilePath() } QCoreApplicationPrivate *d = self->d_func(); + + static char *procName = d->argv[0]; + if (qstrcmp(procName, d->argv[0]) != 0) { + // clear the cache if the procname changes, so we reprocess it. + d->cachedApplicationFilePath = QString(); + procName = d->argv[0]; + } + if (!d->cachedApplicationFilePath.isNull()) return d->cachedApplicationFilePath; diff --git a/src/gui/opengl/qopengltexturehelper.cpp b/src/gui/opengl/qopengltexturehelper.cpp index 7cd7ca54b2..676c0802de 100644 --- a/src/gui/opengl/qopengltexturehelper.cpp +++ b/src/gui/opengl/qopengltexturehelper.cpp @@ -148,7 +148,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context) } #endif -#if defined(Q_OS_WIN) +#if defined(Q_OS_WIN) && !defined(QT_OPENGL_ES_2) HMODULE handle = GetModuleHandleA("opengl32.dll"); // OpenGL 1.0 diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index a410004c06..49b5a9ba46 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -208,7 +208,7 @@ QFontEngine *QFontPrivate::engineForScript(int script) const QMutexLocker locker(qt_fontdatabase_mutex()); if (script <= QChar::Script_Latin) script = QChar::Script_Common; - if (engineData && engineData->fontCache != QFontCache::instance()) { + if (engineData && engineData->fontCacheId != QFontCache::instance()->id()) { // throw out engineData that came from a different thread if (!engineData->ref.deref()) delete engineData; @@ -317,7 +317,7 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other) QFontEngineData::QFontEngineData() - : ref(0), fontCache(QFontCache::instance()) + : ref(0), fontCacheId(QFontCache::instance()->id()) { memset(engines, 0, QChar::ScriptCount * sizeof(QFontEngine *)); } @@ -2638,9 +2638,12 @@ void QFontCache::cleanup() } #endif // QT_NO_THREAD +QBasicAtomicInt font_cache_id = Q_BASIC_ATOMIC_INITIALIZER(1); + QFontCache::QFontCache() : QObject(), total_cost(0), max_cost(min_cost), - current_timestamp(0), fast(false), timer_id(-1) + current_timestamp(0), fast(false), timer_id(-1), + m_id(font_cache_id.fetchAndAddRelaxed(1)) { } diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 115e866f24..5b7f918e21 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -140,7 +140,7 @@ public: ~QFontEngineData(); QAtomicInt ref; - QFontCache *fontCache; + const int fontCacheId; QFontEngine *engines[QChar::ScriptCount]; @@ -206,6 +206,8 @@ public: QFontCache(); ~QFontCache(); + int id() const { return m_id; } + void clear(); struct Key { @@ -263,6 +265,7 @@ private: uint current_timestamp; bool fast; int timer_id; + const int m_id; }; Q_GUI_EXPORT int qt_defaultDpiX(); diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 5f53a36629..6af97145d6 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -124,11 +124,21 @@ public: QtFreetypeData() : library(0) { } + ~QtFreetypeData(); FT_Library library; QHash<QFontEngine::FaceId, QFreetypeFace *> faces; }; +QtFreetypeData::~QtFreetypeData() +{ + for (QHash<QFontEngine::FaceId, QFreetypeFace *>::ConstIterator iter = faces.begin(); iter != faces.end(); ++iter) + iter.value()->cleanup(); + faces.clear(); + FT_Done_FreeType(library); + library = 0; +} + #ifdef QT_NO_THREAD Q_GLOBAL_STATIC(QtFreetypeData, theFreetypeData) @@ -292,23 +302,35 @@ QFreetypeFace *QFreetypeFace::getFace(const QFontEngine::FaceId &face_id, return freetype; } +void QFreetypeFace::cleanup() +{ + if (hbFace && hbFace_destroy_func) { + hbFace_destroy_func(hbFace); + hbFace = 0; + } + FT_Done_Face(face); + face = 0; +} + void QFreetypeFace::release(const QFontEngine::FaceId &face_id) { - QtFreetypeData *freetypeData = qt_getFreetypeData(); if (!ref.deref()) { - if (hbFace && hbFace_destroy_func) { - hbFace_destroy_func(hbFace); - hbFace = 0; + if (face) { + QtFreetypeData *freetypeData = qt_getFreetypeData(); + + cleanup(); + + if (freetypeData->faces.contains(face_id)) + freetypeData->faces.take(face_id); + + if (freetypeData->faces.isEmpty()) { + FT_Done_FreeType(freetypeData->library); + freetypeData->library = 0; + } } - FT_Done_Face(face); - if(freetypeData->faces.contains(face_id)) - freetypeData->faces.take(face_id); + delete this; } - if (freetypeData->faces.isEmpty()) { - FT_Done_FreeType(freetypeData->library); - freetypeData->library = 0; - } } diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index e64fec2f27..7df66b9678 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -114,9 +114,11 @@ public: private: friend class QFontEngineFT; + friend class QtFreetypeData; friend struct QScopedPointerDeleter<QFreetypeFace>; QFreetypeFace() : _lock(QMutex::Recursive) {} ~QFreetypeFace() {} + void cleanup(); QAtomicInt ref; QMutex _lock; QByteArray fontData; diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp index b5e3aa741e..dad34e121b 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.cpp @@ -100,7 +100,6 @@ void TableGenerator::findComposeFile() qDebug() << "Using Compose file from: " << composeFile; #endif } - // check if user’s home directory has a file named .XCompose if (!found && cleanState()) { QString composeFile = qgetenv("HOME") + QStringLiteral("/.XCompose"); @@ -111,10 +110,12 @@ void TableGenerator::findComposeFile() qDebug() << "Using Compose file from: " << composeFile; #endif } - // check for the system provided compose files if (!found && cleanState()) { - QString table = readLocaleMappings(locale().toUpper().toUtf8()); + QByteArray loc = locale().toUpper().toUtf8(); + QString table = readLocaleMappings(loc); + if (table.isEmpty()) + table = readLocaleMappings(readLocaleAliases(loc)); if (cleanState()) { if (table.isEmpty()) @@ -177,8 +178,11 @@ QString TableGenerator::locale() const QString TableGenerator::readLocaleMappings(const QByteArray &locale) { - QFile mappings(systemComposeDir() + QLatin1String("/compose.dir")); QString file; + if (locale.isEmpty()) + return file; + + QFile mappings(systemComposeDir() + QLatin1String("/compose.dir")); if (mappings.open(QIODevice::ReadOnly)) { const int localeNameLength = locale.size(); const char * const localeData = locale.constData(); @@ -208,9 +212,8 @@ QString TableGenerator::readLocaleMappings(const QByteArray &locale) while (*line && *line != ' ' && *line != '\t' && *line != '\n') ++line; *line = '\0'; - if (localeNameLength == (line - lc) && !strncasecmp(lc, localeData, line - lc)) { - file = QString::fromUtf8(l, composeFileNameEnd - l); + file = QString::fromLocal8Bit(l, composeFileNameEnd - l); break; } } @@ -220,6 +223,47 @@ QString TableGenerator::readLocaleMappings(const QByteArray &locale) return file; } +QByteArray TableGenerator::readLocaleAliases(const QByteArray &locale) +{ + QFile aliases(systemComposeDir() + QLatin1String("/locale.alias")); + QByteArray fullLocaleName; + if (aliases.exists()) { + aliases.open(QIODevice::ReadOnly); + while (!aliases.atEnd()) { + char l[1024]; + int read = aliases.readLine(l, sizeof(l)); + char *line = l; + if (read && ((*line >= 'a' && *line <= 'z') || + (*line >= 'A' && *line <= 'Z'))) { + const char *alias = line; + while (*line && *line != ':' && *line != ' ' && *line != '\t') + ++line; + if (!*line) + continue; + *line = 0; + if (locale.size() == (line - alias) + && !strncasecmp(alias, locale.constData(), line - alias)) { + // found a match for alias, read the real locale name + ++line; + while (*line && (*line == ' ' || *line == '\t')) + ++line; + const char *fullName = line; + while (*line && *line != ' ' && *line != '\t' && *line != '\n') + ++line; + *line = 0; + fullLocaleName = fullName; +#ifdef DEBUG_GENERATOR + qDebug() << "Alias for: " << alias << "is: " << fullLocaleName; + break; +#endif + } + } + } + aliases.close(); + } + return fullLocaleName; +} + bool TableGenerator::processFile(QString composeFileName) { QFile composeFile(composeFileName); @@ -254,7 +298,7 @@ void TableGenerator::parseComposeFile(QFile *composeFile) if (*line == '<') parseKeySequence(line); else if (!strncmp(line, "include", 7)) - parseIncludeInstruction(QString::fromUtf8(line)); + parseIncludeInstruction(QString::fromLocal8Bit(line)); } composeFile->close(); @@ -308,7 +352,7 @@ ushort TableGenerator::keysymToUtf8(quint32 sym) qDebug() << QString("keysym - 0x%1 : utf8 - %2").arg(QString::number(sym, 16)) .arg(codec->toUnicode(chars)); #endif - return QString::fromUtf8(chars).at(0).unicode(); + return QString::fromLocal8Bit(chars).at(0).unicode(); } static inline int fromBase8(const char *s, const char *end) @@ -377,13 +421,13 @@ void TableGenerator::parseKeySequence(char *line) // handle direct text encoded in the locale if (*composeValue == '\\') ++composeValue; - elem.value = QString::fromUtf8(composeValue).at(0).unicode(); + elem.value = QString::fromLocal8Bit(composeValue).at(0).unicode(); ++composeValue; } #ifdef DEBUG_GENERATOR // find the comment - elem.comment = QString::fromUtf8(composeValueEnd + 1).trimmed(); + elem.comment = QString::fromLocal8Bit(composeValueEnd + 1).trimmed(); #endif // find the key sequence and convert to X11 keysym diff --git a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h index aa65b7b895..248c09f3ea 100644 --- a/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h +++ b/src/plugins/platforminputcontexts/compose/generator/qtablegenerator.h @@ -122,6 +122,7 @@ protected: ushort keysymToUtf8(quint32 sym); QString readLocaleMappings(const QByteArray &locale); + QByteArray readLocaleAliases(const QByteArray &locale); void initPossibleLocations(); bool cleanState() const { return ((m_state & NoErrors) == NoErrors); } QString locale() const; diff --git a/src/widgets/graphicsview/qgraphicsitem.cpp b/src/widgets/graphicsview/qgraphicsitem.cpp index 7cab132a2e..a4adb3d20b 100644 --- a/src/widgets/graphicsview/qgraphicsitem.cpp +++ b/src/widgets/graphicsview/qgraphicsitem.cpp @@ -10307,7 +10307,9 @@ void QGraphicsTextItem::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) QVariant QGraphicsTextItem::inputMethodQuery(Qt::InputMethodQuery query) const { QVariant v; - if (dd->control) + if (query == Qt::ImHints) + v = int(inputMethodHints()); + else if (dd->control) v = dd->control->inputMethodQuery(query); if (v.type() == QVariant::RectF) v = v.toRectF().translated(-dd->controlOffset()); diff --git a/src/widgets/graphicsview/qgraphicswidget_p.cpp b/src/widgets/graphicsview/qgraphicswidget_p.cpp index 14cd7007ba..e1dd23f177 100644 --- a/src/widgets/graphicsview/qgraphicswidget_p.cpp +++ b/src/widgets/graphicsview/qgraphicswidget_p.cpp @@ -90,11 +90,6 @@ qreal QGraphicsWidgetPrivate::titleBarHeight(const QStyleOptionTitleBar &options { Q_Q(const QGraphicsWidget); int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options); -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) - if (qobject_cast<QMacStyle*>(q->style())) { - height -=4; - } -#endif return (qreal)height; } diff --git a/src/widgets/styles/qmacstyle_mac.mm b/src/widgets/styles/qmacstyle_mac.mm index 0b860450d1..503055e32f 100644 --- a/src/widgets/styles/qmacstyle_mac.mm +++ b/src/widgets/styles/qmacstyle_mac.mm @@ -2191,7 +2191,6 @@ int QMacStyle::pixelMetric(PixelMetric metric, const QStyleOption *opt, const QW HIRect rect; ptrHIShapeGetBounds(region, &rect); ret = int(rect.size.height); - ret += 4; } break; case PM_TabBarTabVSpace: diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index 8b151e65bd..46929397a0 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -455,14 +455,6 @@ int QDockWidgetLayout::titleHeight() const perp(verticalTitleBar, floatSize)); QFontMetrics titleFontMetrics = q->fontMetrics(); -#ifdef Q_WS_MAC - if (qobject_cast<QMacStyle *>(q->style())) { - //### this breaks on proxy styles. (But is this code still called?) - QFont font = qt_app_fonts_hash()->value("QToolButton", q->font()); - titleFontMetrics = QFontMetrics(font); - } -#endif - int mw = q->style()->pixelMetric(QStyle::PM_DockWidgetTitleMargin, 0, q); return qMax(buttonHeight + 2, titleFontMetrics.height() + 2*mw); diff --git a/src/widgets/widgets/qmdiarea.cpp b/src/widgets/widgets/qmdiarea.cpp index 5c1d7a6c05..349d8c3423 100644 --- a/src/widgets/widgets/qmdiarea.cpp +++ b/src/widgets/widgets/qmdiarea.cpp @@ -354,11 +354,6 @@ void SimpleCascader::rearrange(QList<QWidget *> &widgets, const QRect &domain) c QStyleOptionTitleBar options; options.initFrom(widgets.at(0)); int titleBarHeight = widgets.at(0)->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, widgets.at(0)); -#if defined(Q_WS_MAC) && !defined(QT_NO_STYLE_MAC) - // ### Remove this after the mac style has been fixed - if (qobject_cast<QMacStyle *>(widgets.at(0)->style())) - titleBarHeight -= 4; -#endif const QFontMetrics fontMetrics = QFontMetrics(QApplication::font("QMdiSubWindowTitleBar")); const int dy = qMax(titleBarHeight - (titleBarHeight - fontMetrics.height()) / 2, 1); diff --git a/src/widgets/widgets/qmdisubwindow.cpp b/src/widgets/widgets/qmdisubwindow.cpp index b80eb069e2..8e1dcbee18 100644 --- a/src/widgets/widgets/qmdisubwindow.cpp +++ b/src/widgets/widgets/qmdisubwindow.cpp @@ -1710,11 +1710,6 @@ int QMdiSubWindowPrivate::titleBarHeight(const QStyleOptionTitleBar &options) co } int height = q->style()->pixelMetric(QStyle::PM_TitleBarHeight, &options, q); -#if defined(Q_OS_MAC) && !defined(QT_NO_STYLE_MAC) - // ### Fix mac style, the +4 pixels hack is not necessary anymore - if (qobject_cast<QMacStyle *>(q->style())) - height -= 4; -#endif if (hasBorder(options)) height += q->isMinimized() ? 8 : 4; return height; |