diff --git a/src/corelib/io/qstandardpaths.cpp b/src/corelib/io/qstandardpaths.cpp index bd399f511e..ea917c90d9 100644 --- a/src/corelib/io/qstandardpaths.cpp +++ b/src/corelib/io/qstandardpaths.cpp @@ -347,6 +347,10 @@ QString QStandardPaths::displayName(StandardLocation type) /*! \fn void QStandardPaths::enableTestMode(bool testMode) + \obsolete Use QStandardPaths::setTestModeEnabled + */ +/*! + \fn void QStandardPaths::setTestModeEnabled(bool testMode) If \a testMode is true, this enables a special "test mode" in QStandardPaths, which changes writable locations @@ -369,10 +373,17 @@ QString QStandardPaths::displayName(StandardLocation type) static bool qsp_testMode = false; +#if QT_DEPRECATED_SINCE(5, 2) void QStandardPaths::enableTestMode(bool testMode) { qsp_testMode = testMode; } +#endif + +void QStandardPaths::setTestModeEnabled(bool testMode) +{ + qsp_testMode = testMode; +} /*! \fn void QStandardPaths::isTestModeEnabled() diff --git a/src/corelib/io/qstandardpaths.h b/src/corelib/io/qstandardpaths.h index d8b6d24f57..df9089ace7 100644 --- a/src/corelib/io/qstandardpaths.h +++ b/src/corelib/io/qstandardpaths.h @@ -89,7 +89,10 @@ public: static QString findExecutable(const QString &executableName, const QStringList &paths = QStringList()); - static void enableTestMode(bool testMode); +#if QT_DEPRECATED_SINCE(5, 2) + static QT_DEPRECATED void enableTestMode(bool testMode); +#endif + static void setTestModeEnabled(bool testMode); static bool isTestModeEnabled(); private: diff --git a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp index f94c8eac4f..501dde1ba5 100644 --- a/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp +++ b/tests/auto/corelib/io/qstandardpaths/tst_qstandardpaths.cpp @@ -166,7 +166,7 @@ void tst_qstandardpaths::testCustomLocations() void tst_qstandardpaths::enableTestMode() { QVERIFY(!QStandardPaths::isTestModeEnabled()); - QStandardPaths::enableTestMode(true); + QStandardPaths::setTestModeEnabled(true); QVERIFY(QStandardPaths::isTestModeEnabled()); #ifdef Q_XDG_PLATFORM @@ -204,7 +204,7 @@ void tst_qstandardpaths::enableTestMode() // On Windows, what should "Program Files" become, in test mode? //testLocations.insert(QStandardPaths::ApplicationsLocation, QStandardPaths::writableLocation(QStandardPaths::ApplicationsLocation)); - QStandardPaths::enableTestMode(false); + QStandardPaths::setTestModeEnabled(false); for (LocationHash::const_iterator it = testLocations.constBegin(); it != testLocations.constEnd(); ++it) QVERIFY2(QStandardPaths::writableLocation(it.key()) != it.value(), qPrintable(it.value()));