2016-07-04 23:26:48 +02:00
|
|
|
#ifndef APPLICATION_UTILITIES_QTCONFIGARGUMENTS_H
|
|
|
|
#define APPLICATION_UTILITIES_QTCONFIGARGUMENTS_H
|
2015-04-22 18:57:44 +02:00
|
|
|
|
2016-08-29 15:41:11 +02:00
|
|
|
#include "../global.h"
|
|
|
|
|
2015-04-22 18:57:44 +02:00
|
|
|
#include <c++utilities/application/argumentparser.h>
|
|
|
|
|
2018-06-16 13:10:19 +02:00
|
|
|
#ifdef QT_UTILITIES_GUI_QTQUICK
|
|
|
|
#include <QQuickStyle>
|
2018-07-15 19:44:35 +02:00
|
|
|
#include <QString>
|
2018-06-16 13:10:19 +02:00
|
|
|
|
2024-03-16 23:14:44 +01:00
|
|
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
|
|
|
#if defined(PLATFORM_ANDROID)
|
|
|
|
#define QT_UTILITIES_DEFAULT_QQC2_STYLE "Material"
|
|
|
|
#elif defined(PLATFORM_WINDOWS)
|
|
|
|
#define QT_UTILITIES_DEFAULT_QQC2_STYLE "Universal"
|
|
|
|
#endif
|
|
|
|
#else
|
2018-06-16 13:18:05 +02:00
|
|
|
#if defined(PLATFORM_ANDROID)
|
2018-06-16 13:19:00 +02:00
|
|
|
#define QT_UTILITIES_DEFAULT_QQC2_STYLE "material"
|
2018-06-16 13:18:05 +02:00
|
|
|
#elif defined(PLATFORM_WINDOWS)
|
2018-06-16 13:19:00 +02:00
|
|
|
#define QT_UTILITIES_DEFAULT_QQC2_STYLE "universal"
|
2018-06-16 13:18:05 +02:00
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2024-03-16 23:14:44 +01:00
|
|
|
#endif
|
|
|
|
|
2019-06-10 21:57:46 +02:00
|
|
|
namespace CppUtilities {
|
2015-04-22 18:57:44 +02:00
|
|
|
|
2017-05-01 03:16:25 +02:00
|
|
|
class QT_UTILITIES_EXPORT QtConfigArguments {
|
2015-04-22 18:57:44 +02:00
|
|
|
public:
|
|
|
|
QtConfigArguments();
|
|
|
|
|
|
|
|
Argument &qtWidgetsGuiArg();
|
|
|
|
Argument &qtQuickGuiArg();
|
|
|
|
Argument &languageArg();
|
|
|
|
|
|
|
|
bool areQtGuiArgsPresent() const;
|
2016-08-14 22:44:25 +02:00
|
|
|
void applySettings(bool preventApplyingDefaultFont = false) const;
|
2018-06-16 13:18:05 +02:00
|
|
|
#ifdef QT_UTILITIES_GUI_QTQUICK
|
|
|
|
void applySettingsForQuickGui() const;
|
|
|
|
#endif
|
2015-04-22 18:57:44 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
Argument m_qtWidgetsGuiArg;
|
|
|
|
Argument m_qtQuickGuiArg;
|
|
|
|
Argument m_lngArg;
|
|
|
|
Argument m_qmlDebuggerArg;
|
2019-05-04 23:34:19 +02:00
|
|
|
Argument m_widgetsStyleArg;
|
|
|
|
Argument m_quickControls2StyleArg;
|
2015-04-22 18:57:44 +02:00
|
|
|
Argument m_iconThemeArg;
|
|
|
|
Argument m_fontArg;
|
2016-02-09 01:06:50 +01:00
|
|
|
Argument m_libraryPathsArg;
|
2016-08-16 19:35:40 +02:00
|
|
|
Argument m_platformThemeArg;
|
2019-05-04 23:25:33 +02:00
|
|
|
Argument m_sceneGraphRenderLoopArg;
|
2015-04-22 18:57:44 +02:00
|
|
|
};
|
|
|
|
|
2015-09-01 20:08:43 +02:00
|
|
|
/*!
|
|
|
|
* \brief Returns the argument for the Qt Widgets GUI.
|
|
|
|
*/
|
2015-04-22 18:57:44 +02:00
|
|
|
inline Argument &QtConfigArguments::qtWidgetsGuiArg()
|
|
|
|
{
|
|
|
|
return m_qtWidgetsGuiArg;
|
|
|
|
}
|
|
|
|
|
2015-09-01 20:08:43 +02:00
|
|
|
/*!
|
|
|
|
* \brief Returns the argument for the Qt Quick GUI.
|
|
|
|
*/
|
2015-04-22 18:57:44 +02:00
|
|
|
inline Argument &QtConfigArguments::qtQuickGuiArg()
|
|
|
|
{
|
|
|
|
return m_qtQuickGuiArg;
|
|
|
|
}
|
|
|
|
|
2015-09-01 20:08:43 +02:00
|
|
|
/*!
|
|
|
|
* \brief Returns the language argument.
|
|
|
|
*/
|
2015-04-22 18:57:44 +02:00
|
|
|
inline Argument &QtConfigArguments::languageArg()
|
|
|
|
{
|
|
|
|
return m_lngArg;
|
|
|
|
}
|
|
|
|
|
2015-09-01 20:08:43 +02:00
|
|
|
/*!
|
|
|
|
* \brief Returns whether at least one of the GUI arguments is present.
|
|
|
|
*/
|
2015-04-22 18:57:44 +02:00
|
|
|
inline bool QtConfigArguments::areQtGuiArgsPresent() const
|
|
|
|
{
|
|
|
|
return m_qtWidgetsGuiArg.isPresent() || m_qtQuickGuiArg.isPresent();
|
|
|
|
}
|
2018-06-16 13:10:19 +02:00
|
|
|
|
|
|
|
#ifdef QT_UTILITIES_GUI_QTQUICK
|
|
|
|
/*!
|
|
|
|
* \brief Applies settings the for Qt Quick GUI.
|
|
|
|
*/
|
|
|
|
inline void QtConfigArguments::applySettingsForQuickGui() const
|
|
|
|
{
|
2019-05-04 23:34:19 +02:00
|
|
|
if (m_quickControls2StyleArg.isPresent()) {
|
|
|
|
QQuickStyle::setStyle(QString::fromLocal8Bit(m_quickControls2StyleArg.values().front()));
|
2018-06-16 13:10:19 +02:00
|
|
|
}
|
2018-06-16 13:19:00 +02:00
|
|
|
#ifdef QT_UTILITIES_DEFAULT_QQC2_STYLE
|
2018-06-16 13:18:05 +02:00
|
|
|
else if (qEnvironmentVariableIsEmpty("QT_QUICK_CONTROLS_STYLE")) {
|
2018-07-15 19:44:35 +02:00
|
|
|
QQuickStyle::setStyle(QStringLiteral(QT_UTILITIES_DEFAULT_QQC2_STYLE));
|
2018-06-16 13:18:05 +02:00
|
|
|
}
|
2018-07-15 19:44:35 +02:00
|
|
|
#endif // QT_UTILITIES_DEFAULT_QQC2_STYLE
|
2018-06-16 13:10:19 +02:00
|
|
|
}
|
2018-07-15 19:44:35 +02:00
|
|
|
#endif // QT_UTILITIES_GUI_QTQUICK
|
2018-06-16 13:10:19 +02:00
|
|
|
|
2019-06-10 21:57:46 +02:00
|
|
|
} // namespace CppUtilities
|
2015-04-22 18:57:44 +02:00
|
|
|
|
2016-07-04 23:26:48 +02:00
|
|
|
#endif // APPLICATION_UTILITIES_QTCONFIGARGUMENTS_H
|
2015-04-22 18:57:44 +02:00
|
|
|
|
|
|
|
#ifdef QT_CONFIG_ARGUMENTS
|
2017-05-01 03:16:25 +02:00
|
|
|
#undef QT_CONFIG_ARGUMENTS
|
2015-04-22 18:57:44 +02:00
|
|
|
#endif
|
2019-06-10 21:57:46 +02:00
|
|
|
#define QT_CONFIG_ARGUMENTS CppUtilities::QtConfigArguments
|