diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2021-08-13 16:00:13 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-08-17 19:04:39 +0000 |
commit | fcdd613dbeb9945604f15c164b4c97aba4f195a0 (patch) | |
tree | c9bab0f2f4cc93d31c3f9a2ad564e8bd0d4f74e2 | |
parent | 841128d48120a2f3cbc26bce6bd25c900c99a7cf (diff) |
Use qEnvironmentVariableIntValue() instead of qgetenv().toInt()
The docs tell us that it's faster.
Change-Id: Ib828ed9a10bbb617670a61e7525cbbe25704815d
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
(cherry picked from commit ca89437d00aeb8916738a964a62aef3cff7dc5ab)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | examples/quick/shared/shared.h | 4 | ||||
-rw-r--r-- | src/quick/scenegraph/coreapi/qsgrenderer.cpp | 2 | ||||
-rw-r--r-- | tests/auto/quickcontrols2/snippets/tst_snippets.cpp | 2 | ||||
-rw-r--r-- | tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp | 2 |
4 files changed, 5 insertions, 5 deletions
diff --git a/examples/quick/shared/shared.h b/examples/quick/shared/shared.h index a6a468ddcb..b6c7c4a45b 100644 --- a/examples/quick/shared/shared.h +++ b/examples/quick/shared/shared.h @@ -59,13 +59,13 @@ app.setOrganizationDomain("qt-project.org");\ app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName());\ QQuickView view;\ - if (qgetenv("QT_QUICK_CORE_PROFILE").toInt()) {\ + if (qEnvironmentVariableIntValue("QT_QUICK_CORE_PROFILE")) {\ QSurfaceFormat f = view.format();\ f.setProfile(QSurfaceFormat::CoreProfile);\ f.setVersion(4, 4);\ view.setFormat(f);\ }\ - if (qgetenv("QT_QUICK_MULTISAMPLE").toInt()) {\ + if (qEnvironmentVariableIntValue("QT_QUICK_MULTISAMPLE")) {\ QSurfaceFormat f = view.format();\ f.setSamples(4);\ view.setFormat(f);\ diff --git a/src/quick/scenegraph/coreapi/qsgrenderer.cpp b/src/quick/scenegraph/coreapi/qsgrenderer.cpp index 4b3cd9f2c1..e47126754b 100644 --- a/src/quick/scenegraph/coreapi/qsgrenderer.cpp +++ b/src/quick/scenegraph/coreapi/qsgrenderer.cpp @@ -55,7 +55,7 @@ int qt_sg_envInt(const char *name, int defaultValue) if (Q_LIKELY(!qEnvironmentVariableIsSet(name))) return defaultValue; bool ok = false; - int value = qgetenv(name).toInt(&ok); + int value = qEnvironmentVariableIntValue(name, &ok); return ok ? value : defaultValue; } diff --git a/tests/auto/quickcontrols2/snippets/tst_snippets.cpp b/tests/auto/quickcontrols2/snippets/tst_snippets.cpp index 17ae6aa614..6be53d274e 100644 --- a/tests/auto/quickcontrols2/snippets/tst_snippets.cpp +++ b/tests/auto/quickcontrols2/snippets/tst_snippets.cpp @@ -79,7 +79,7 @@ void tst_Snippets::initTestCase() QDir screenshotsDir(QDir::current().filePath("screenshots")); - takeScreenshots = qgetenv("SCREENSHOTS").toInt(); + takeScreenshots = qEnvironmentVariableIntValue("SCREENSHOTS"); if (takeScreenshots) QVERIFY(screenshotsDir.exists() || QDir::current().mkpath("screenshots")); diff --git a/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp b/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp index bbcb24ca38..ea2a63dc52 100644 --- a/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp +++ b/tests/benchmarks/quickcontrols2/objectcount/tst_objectcount.cpp @@ -42,7 +42,7 @@ using namespace QQuickVisualTestUtil; -static int qt_verbose = qgetenv("VERBOSE").toInt() != 0; +static int qt_verbose = qEnvironmentVariableIntValue("VERBOSE") != 0; Q_GLOBAL_STATIC(QObjectList, qt_qobjects) |