1#ifndef APPLICATION_UTILITIES_QTCONFIGARGUMENTS_H
2#define APPLICATION_UTILITIES_QTCONFIGARGUMENTS_H
6#include <c++utilities/application/argumentparser.h>
8#ifdef QT_UTILITIES_GUI_QTQUICK
12#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
13#if defined(PLATFORM_ANDROID)
14#define QT_UTILITIES_DEFAULT_QQC2_STYLE "Material"
15#elif defined(PLATFORM_WINDOWS)
16#include <QLibraryInfo>
17#include <QOperatingSystemVersion>
18#define QT_UTILITIES_DEFAULT_QQC2_STYLE "Universal"
19#define QT_UTILITIES_DEFAULT_QQC2_STYLE_QSTRING \
20 (QLibraryInfo::version() >= QVersionNumber(6, 8, 0) \
21 && QOperatingSystemVersion::current() >= QOperatingSystemVersion(QOperatingSystemVersion::Windows11) \
22 ? QStringLiteral("FluentWinUI3") \
23 : QStringLiteral("Universal"))
26#if defined(PLATFORM_ANDROID)
27#define QT_UTILITIES_DEFAULT_QQC2_STYLE "material"
28#elif defined(PLATFORM_WINDOWS)
29#define QT_UTILITIES_DEFAULT_QQC2_STYLE "universal"
32#if defined(QT_UTILITIES_DEFAULT_QQC2_STYLE) && !defined(QT_UTILITIES_DEFAULT_QQC2_STYLE_QSTRING)
33#define QT_UTILITIES_DEFAULT_QQC2_STYLE_QSTRING QStringLiteral(QT_UTILITIES_DEFAULT_QQC2_STYLE)
49 void applySettings(
bool preventApplyingDefaultFont =
false)
const;
50#ifdef QT_UTILITIES_GUI_QTQUICK
51 void applySettingsForQuickGui()
const;
55 Argument m_qtWidgetsGuiArg;
56 Argument m_qtQuickGuiArg;
58 Argument m_qmlDebuggerArg;
59 Argument m_widgetsStyleArg;
60 Argument m_quickControls2StyleArg;
61 Argument m_iconThemeArg;
63 Argument m_libraryPathsArg;
64 Argument m_platformThemeArg;
65 Argument m_sceneGraphRenderLoopArg;
73 return m_qtWidgetsGuiArg;
81 return m_qtQuickGuiArg;
97 return m_qtWidgetsGuiArg.isPresent() || m_qtQuickGuiArg.isPresent();
100#ifdef QT_UTILITIES_GUI_QTQUICK
104inline void QtConfigArguments::applySettingsForQuickGui()
const
106 if (m_quickControls2StyleArg.isPresent()) {
107 QQuickStyle::setStyle(QString::fromLocal8Bit(m_quickControls2StyleArg.values().front()));
109#ifdef QT_UTILITIES_DEFAULT_QQC2_STYLE
110 else if (qEnvironmentVariableIsEmpty(
"QT_QUICK_CONTROLS_STYLE")) {
111 if (qEnvironmentVariableIsEmpty(
"QT_QUICK_CONTROLS_MATERIAL_THEME")) {
112 qputenv(
"QT_QUICK_CONTROLS_MATERIAL_THEME",
"System");
114 if (qEnvironmentVariableIsEmpty(
"QT_QUICK_CONTROLS_UNIVERSAL_THEME")) {
115 qputenv(
"QT_QUICK_CONTROLS_UNIVERSAL_THEME",
"System");
117 QQuickStyle::setStyle(QT_UTILITIES_DEFAULT_QQC2_STYLE_QSTRING);
127#ifdef QT_CONFIG_ARGUMENTS
128#undef QT_CONFIG_ARGUMENTS
130#define QT_CONFIG_ARGUMENTS CppUtilities::QtConfigArguments
Argument & qtWidgetsGuiArg()
Returns the argument for the Qt Widgets GUI.
QtConfigArguments()
Constructs new Qt config arguments.
Argument & qtQuickGuiArg()
Returns the argument for the Qt Quick GUI.
Argument & languageArg()
Returns the language argument.
void applySettings(bool preventApplyingDefaultFont=false) const
Applies the settings from the arguments.
bool areQtGuiArgsPresent() const
Returns whether at least one of the GUI arguments is present.
#define QT_UTILITIES_EXPORT
Marks the symbol to be exported by the qtutilities library.
The CppUtilities namespace contains addons to the c++utilities library provided by the qtutilities li...