Qt Utilities 6.12.0
Common Qt related C++ classes and routines used by my applications such as dialogs, widgets and models
Loading...
Searching...
No Matches
qtconfigarguments.h
Go to the documentation of this file.
1#ifndef APPLICATION_UTILITIES_QTCONFIGARGUMENTS_H
2#define APPLICATION_UTILITIES_QTCONFIGARGUMENTS_H
3
4#include "../global.h"
5
6#include <c++utilities/application/argumentparser.h>
7
8#ifdef QT_UTILITIES_GUI_QTQUICK
9#include <QQuickStyle>
10#include <QString>
11
12#if defined(PLATFORM_ANDROID)
13#define QT_UTILITIES_DEFAULT_QQC2_STYLE "material"
14#elif defined(PLATFORM_WINDOWS)
15#define QT_UTILITIES_DEFAULT_QQC2_STYLE "universal"
16#endif
17#endif
18
19namespace CppUtilities {
20
22public:
24
25 Argument &qtWidgetsGuiArg();
26 Argument &qtQuickGuiArg();
27 Argument &languageArg();
28
29 bool areQtGuiArgsPresent() const;
30 void applySettings(bool preventApplyingDefaultFont = false) const;
31#ifdef QT_UTILITIES_GUI_QTQUICK
32 void applySettingsForQuickGui() const;
33#endif
34
35private:
36 Argument m_qtWidgetsGuiArg;
37 Argument m_qtQuickGuiArg;
38 Argument m_lngArg;
39 Argument m_qmlDebuggerArg;
40 Argument m_widgetsStyleArg;
41 Argument m_quickControls2StyleArg;
42 Argument m_iconThemeArg;
43 Argument m_fontArg;
44 Argument m_libraryPathsArg;
45 Argument m_platformThemeArg;
46 Argument m_sceneGraphRenderLoopArg;
47};
48
53{
54 return m_qtWidgetsGuiArg;
55}
56
61{
62 return m_qtQuickGuiArg;
63}
64
69{
70 return m_lngArg;
71}
72
77{
78 return m_qtWidgetsGuiArg.isPresent() || m_qtQuickGuiArg.isPresent();
79}
80
81#ifdef QT_UTILITIES_GUI_QTQUICK
85inline void QtConfigArguments::applySettingsForQuickGui() const
86{
87 if (m_quickControls2StyleArg.isPresent()) {
88 QQuickStyle::setStyle(QString::fromLocal8Bit(m_quickControls2StyleArg.values().front()));
89 }
90#ifdef QT_UTILITIES_DEFAULT_QQC2_STYLE
91 else if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
92 QQuickStyle::setStyle(QStringLiteral(QT_UTILITIES_DEFAULT_QQC2_STYLE));
93 }
94#endif // QT_UTILITIES_DEFAULT_QQC2_STYLE
95}
96#endif // QT_UTILITIES_GUI_QTQUICK
97
98} // namespace CppUtilities
99
100#endif // APPLICATION_UTILITIES_QTCONFIGARGUMENTS_H
101
102#ifdef QT_CONFIG_ARGUMENTS
103#undef QT_CONFIG_ARGUMENTS
104#endif
105#define QT_CONFIG_ARGUMENTS CppUtilities::QtConfigArguments
Argument & qtWidgetsGuiArg()
Returns the argument for the Qt Widgets GUI.
Argument & qtQuickGuiArg()
Returns the argument for the Qt Quick GUI.
Argument & languageArg()
Returns the language argument.
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...