From 6129be8a4ba976c42e51012ebaa9005eb402db80 Mon Sep 17 00:00:00 2001 From: Milian Wolff Date: Mon, 27 Jul 2015 11:49:55 +0200 Subject: Prefer QT_PLUGIN_PATH over compiled-in paths. Currently, when one compiles a Qt plugin that is also installed system wide to a local path added to QT_PLUGIN_PATH, you have no way to ever load it as the global plugin will always be preferred. This is due to the order in which the QCoreApplications::libraryPaths are constructed, which always appended the QT_PLUGIN_PATH contents to the end. Now, the QT_PLUGIN_PATH contents are put first, such that the plugins in there are preferred and loaded. [ChangeLog][QtCore][QPluginLoader] Fixed the search order of Qt plugins so that paths specified by the QT_PLUGIN_PATH environment variable are searched before built-in paths. Change-Id: Iad8ca2cd34e7a622c191a416c01c1c5cc1812fc9 Reviewed-by: Oswald Buddenhagen Reviewed-by: Olivier Goffart (Woboq GmbH) --- src/corelib/kernel/qcoreapplication.cpp | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'src/corelib/kernel/qcoreapplication.cpp') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index e08f709cd2..e9fdb8c8ef 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -2541,17 +2541,6 @@ QStringList QCoreApplication::libraryPaths() if (!coreappdata()->app_libpaths) { QStringList *app_libpaths = coreappdata()->app_libpaths = new QStringList; - QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath); - if (QFile::exists(installPathPlugins)) { - // Make sure we convert from backslashes to slashes. - installPathPlugins = QDir(installPathPlugins).canonicalPath(); - if (!app_libpaths->contains(installPathPlugins)) - app_libpaths->append(installPathPlugins); - } - - // If QCoreApplication is not yet instantiated, - // make sure we add the application path when we construct the QCoreApplication - if (self) self->d_func()->appendApplicationPathToLibraryPaths(); const QByteArray libPathEnv = qgetenv("QT_PLUGIN_PATH"); if (!libPathEnv.isEmpty()) { @@ -2564,6 +2553,18 @@ QStringList QCoreApplication::libraryPaths() } } } + + QString installPathPlugins = QLibraryInfo::location(QLibraryInfo::PluginsPath); + if (QFile::exists(installPathPlugins)) { + // Make sure we convert from backslashes to slashes. + installPathPlugins = QDir(installPathPlugins).canonicalPath(); + if (!app_libpaths->contains(installPathPlugins)) + app_libpaths->append(installPathPlugins); + } + + // If QCoreApplication is not yet instantiated, + // make sure we add the application path when we construct the QCoreApplication + if (self) self->d_func()->appendApplicationPathToLibraryPaths(); } return *(coreappdata()->app_libpaths); } -- cgit v1.2.3 From b4a48d2578825fbbef444f4beba2b9a6a37fbd7d Mon Sep 17 00:00:00 2001 From: Louai Al-Khanji Date: Mon, 24 Aug 2015 10:24:18 +0300 Subject: Move QCoreApplication::quitLockEnabled documentation to single place MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Moving the documentation to one spot reduces repetition, is more canonical, and avoids a warning due to undocumented function argument in the setter. Also document the default setting. Change-Id: Idcedacf4bf101909689025d044e96801255a3332 Reviewed-by: Topi Reiniƶ --- src/corelib/kernel/qcoreapplication.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) (limited to 'src/corelib/kernel/qcoreapplication.cpp') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 00d618745b..0de6f833d3 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -937,18 +937,14 @@ bool QCoreApplication::testAttribute(Qt::ApplicationAttribute attribute) /*! \property QCoreApplication::quitLockEnabled - Returns \c true if the use of the QEventLoopLocker feature can cause the - application to quit, otherwise returns \c false. + \brief Whether the use of the QEventLoopLocker feature can cause the + application to quit. + + The default is \c true. \sa QEventLoopLocker */ -/*! - Returns \c true if the use of the QEventLoopLocker feature can cause the - application to quit, otherwise returns \c false. - - \sa QEventLoopLocker - */ bool QCoreApplication::isQuitLockEnabled() { return quitLockRefEnabled; @@ -956,14 +952,6 @@ bool QCoreApplication::isQuitLockEnabled() static bool doNotify(QObject *, QEvent *); -/*! - Enables the ability of the QEventLoopLocker feature to quit - the application. - - If disabled, the use of QEventLoopLocker will not quit the application. - - \sa QEventLoopLocker - */ void QCoreApplication::setQuitLockEnabled(bool enabled) { quitLockRefEnabled = enabled; -- cgit v1.2.3 From 6c21a0ea0e561aaafc3dd0f9aecbcdaf5f867ec6 Mon Sep 17 00:00:00 2001 From: Louai Al-Khanji Date: Mon, 24 Aug 2015 10:26:57 +0300 Subject: Fix invalid documentation function reference MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Iccf62e3f2f7843c14dd6540400241bdd264ad376 Reviewed-by: Topi Reiniƶ --- src/corelib/kernel/qcoreapplication.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib/kernel/qcoreapplication.cpp') diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp index 0de6f833d3..8f4774a1e0 100644 --- a/src/corelib/kernel/qcoreapplication.cpp +++ b/src/corelib/kernel/qcoreapplication.cpp @@ -1807,7 +1807,7 @@ void QCoreApplicationPrivate::maybeQuit() Tells the application to exit with return code 0 (success). Equivalent to calling QCoreApplication::exit(0). - It's common to connect the QApplication::lastWindowClosed() signal + It's common to connect the QGuiApplication::lastWindowClosed() signal to quit(), and you also often connect e.g. QAbstractButton::clicked() or signals in QAction, QMenu, or QMenuBar to it. @@ -1815,7 +1815,7 @@ void QCoreApplicationPrivate::maybeQuit() \snippet code/src_corelib_kernel_qcoreapplication.cpp 1 - \sa exit(), aboutToQuit(), QApplication::lastWindowClosed() + \sa exit(), aboutToQuit(), QGuiApplication::lastWindowClosed() */ void QCoreApplication::quit() -- cgit v1.2.3