6#include <QtCore/qdebug.h>
8#include <QtCore/qsettings.h>
10#include <QtQml/qqmlinfo.h>
11#include <QtQuickControls2/private/qquickstyle_p.h>
468 m_explicitTheme =
true;
469 if (m_theme ==
theme)
477 if (!m_hasBackground)
479 if (!m_hasForeground)
485 if (m_explicitTheme || m_theme ==
theme)
493 if (!m_hasBackground)
495 if (!m_hasForeground)
511 if (!m_explicitTheme)
514 m_explicitTheme =
false;
539 if (!variantToRgba(
var,
"primary", &
primary, &custom))
542 m_explicitPrimary =
true;
546 m_customPrimary = custom;
554 if (m_explicitPrimary || m_primary ==
primary)
557 m_customPrimary = custom;
575 if (!m_explicitPrimary)
578 m_customPrimary =
false;
579 m_explicitPrimary =
false;
603 if (!variantToRgba(
var,
"accent", &
accent, &custom))
606 m_explicitAccent =
true;
610 m_customAccent = custom;
618 if (m_explicitAccent || m_accent ==
accent)
621 m_customAccent = custom;
639 if (!m_explicitAccent)
642 m_customAccent =
false;
643 m_explicitAccent =
false;
659 if (!m_hasForeground)
661 if (m_customForeground)
675 m_hasForeground =
true;
676 m_explicitForeground =
true;
680 m_customForeground = custom;
688 if (m_explicitForeground || m_foreground ==
foreground)
691 m_hasForeground = has;
692 m_customForeground = custom;
710 if (!m_explicitForeground)
713 m_hasForeground =
false;
714 m_customForeground =
false;
715 m_explicitForeground =
false;
740 m_hasBackground =
true;
741 m_explicitBackground =
true;
745 m_customBackground = custom;
753 if (m_explicitBackground || m_background ==
background)
756 m_hasBackground = has;
757 m_customBackground = custom;
775 if (!m_explicitBackground)
778 m_hasBackground =
false;
779 m_customBackground =
false;
780 m_explicitBackground =
false;
819 return m_roundedScale;
838 return m_containerStyle;
881 if (!m_hasBackground)
883 if (m_customBackground)
903 if (m_explicitForeground)
921 color.setAlphaF(0.4f);
946 bool enabled,
bool flat,
bool highlighted,
bool checked)
const
963 if (m_explicitBackground) {
965 }
else if (highlighted) {
966 if (m_theme ==
Light) {
977 color.setAlphaF(0.25);
1050 if (m_theme ==
Light)
1055 return darkHandleColor;
1091 if (m_hasBackground)
1108 if (m_explicitBackground)
1115 if (m_explicitBackground)
1122 if (m_hasForeground || m_customPrimary)
1125 switch (m_primary) {
1174 if (color < 0 || color >=
count)
1178 if (shade < 0 || shade >=
count)
1262 Q_UNREACHABLE_RETURN(
QColor());
1338template <
typename Enum>
1341 QMetaEnum enumeration = QMetaEnum::fromType<Enum>();
1348#if QT_CONFIG(settings)
1361 Theme themeEnum = toEnumValue<Theme>(themeValue, &
ok);
1364 else if (!themeValue.
isEmpty())
1365 qWarning().nospace().noquote() <<
"Material: unknown theme value: " << themeValue;
1368 Variant variantEnum = toEnumValue<Variant>(variantValue, &
ok);
1371 else if (!variantValue.
isEmpty())
1372 qWarning().nospace().noquote() <<
"Material: unknown variant value: " << variantValue;
1375 Color primaryEnum = toEnumValue<Color>(primaryValue, &
ok);
1381 if (
color.isValid()) {
1384 }
else if (!primaryValue.
isEmpty()) {
1385 qWarning().nospace().noquote() <<
"Material: unknown primary value: " << primaryValue;
1390 Color accentEnum = toEnumValue<Color>(accentValue, &
ok);
1394 }
else if (!accentValue.
isEmpty()) {
1396 if (
color.isValid()) {
1400 qWarning().nospace().noquote() <<
"Material: unknown accent value: " << accentValue;
1405 Color foregroundEnum = toEnumValue<Color>(foregroundValue, &
ok);
1410 }
else if (!foregroundValue.
isEmpty()) {
1412 if (
color.isValid()) {
1417 qWarning().nospace().noquote() <<
"Material: unknown foreground value: " << foregroundValue;
1422 Color backgroundEnum = toEnumValue<Color>(backgroundValue, &
ok);
1427 }
else if (!backgroundValue.
isEmpty()) {
1429 if (
color.isValid()) {
1434 qWarning().nospace().noquote() <<
"Material: unknown background value: " << backgroundValue;
1445 inheritAccent(material->m_accent, material->m_customAccent);
1446 inheritForeground(material->m_foreground, material->m_customForeground, material->m_hasForeground);
1447 inheritBackground(material->m_background, material->m_customBackground, material->m_hasBackground);
1452bool QQuickMaterialStyle::variantToRgba(
const QVariant &
var,
const char *
name,
QRgb *rgba,
bool *custom)
const
1468 if (!
color.isValid()) {
1473 *rgba =
color.rgba();
1481#include "moc_qquickmaterialstyle_p.cpp"
bool isEmpty() const noexcept
Returns true if the byte array has size 0; otherwise returns false.
The QColor class provides colors based on RGB, HSV or CMYK values.
void setHslF(float h, float s, float l, float a=1.0)
QColor convertTo(Spec colorSpec) const noexcept
Creates a copy of this color in the format specified by colorSpec.
void setAlphaF(float alpha)
Sets the alpha of this color to alpha.
float hueF() const noexcept
Returns the HSV hue color component of this color.
static QColor fromRgb(QRgb rgb) noexcept
Static convenience function that returns a QColor constructed from the given QRgb value rgb.
static QColor fromRgba(QRgb rgba) noexcept
Static convenience function that returns a QColor constructed from the given QRgb value rgba.
static QColor fromString(QAnyStringView name) noexcept
void setAlpha(int alpha)
Sets the alpha of this color to alpha.
float saturationF() const noexcept
Returns the HSV saturation color component of this color.
float lightnessF() const noexcept
QObject * parent() const
Returns a pointer to the parent object.
The QQuickAttachedPropertyPropagator class provides a way to propagate attached properties.
QQuickAttachedPropertyPropagator * attachedParent() const
This function returns the attached parent of this attached object.
QList< QQuickAttachedPropertyPropagator * > attachedChildren() const
This function returns the attached children of this attached object.
void initialize()
Finds and sets the attached parent for this attached object, and then does the same for its children.
QColor scrollBarHoveredColor
void resetContainerStyle()
void propagateForeground()
QColor scrollBarPressedColor
int menuItemVerticalPadding
void inheritAccent(uint accent, bool custom)
void themeOrAccentChanged()
QColor switchDisabledCheckedIconColor
ContainerStyle containerStyle
void setContainerStyle(ContainerStyle containerStyle)
QColor switchDisabledCheckedHandleColor
QColor switchUncheckedHoveredHandleColor
Q_INVOKABLE QColor color(Color color, Shade shade=Shade500) const
RoundedScale roundedScale
QColor textSelectionColor
void primaryHighlightedTextColorChanged()
QColor switchUncheckedTrackColor
void inheritForeground(uint foreground, bool custom, bool has)
Q_INVOKABLE QColor buttonColor(Theme theme, const QVariant &background, const QVariant &accent, bool enabled, bool flat, bool highlighted, bool checked) const
QQuickMaterialStyle(QObject *parent=nullptr)
void inheritBackground(uint background, bool custom, bool has)
QColor switchDisabledUncheckedIconColor
QColor secondaryTextColor
QColor highlightedRippleColor
QColor spinBoxDisabledIconColor
QColor textFieldFilledContainerColor
int dialogButtonBoxHeight
void setForeground(const QVariant &foreground)
int textFieldHorizontalPadding
static void initGlobals()
QColor listHighlightColor
void setElevation(int elevation)
QColor switchCheckedHandleColor
void setBackground(const QVariant &background)
void tooltipColorChanged()
void propagateBackground()
void inheritTheme(Theme theme)
Q_INVOKABLE QColor shade(const QColor &color, Shade shade) const
QColor primaryHighlightedTextColor
QColor backgroundDimColor
QColor switchDisabledCheckedTrackColor
QColor switchDisabledUncheckedTrackBorderColor
int switchDelegateVerticalPadding
void attachedParentChange(QQuickAttachedPropertyPropagator *newParent, QQuickAttachedPropertyPropagator *oldParent) override
This function is called whenever the attached parent of this QQuickAttachedPropertyPropagator changes...
void inheritPrimary(uint primary, bool custom)
QColor switchCheckedTrackColor
void containerStyleChanged()
QColor switchDisabledUncheckedTrackColor
QColor sliderDisabledColor
void setTheme(Theme theme)
void setAccent(const QVariant &accent)
void setPrimary(const QVariant &accent)
int textFieldVerticalPadding
void toolBarColorChanged()
static QQuickMaterialStyle * qmlAttachedProperties(QObject *object)
void setRoundedScale(RoundedScale roundedScale)
void roundedScaleChanged()
QColor switchUncheckedHandleColor
QColor switchDisabledUncheckedHandleColor
void dialogColorChanged()
void toolTextColorChanged()
static QSharedPointer< QSettings > settings(const QString &group=QString())
static bool isDarkSystemTheme()
QVariant value(QAnyStringView key, const QVariant &defaultValue) const
Returns the value for setting key.
\macro QT_RESTRICTED_CAST_FROM_ASCII
int toInt(bool *ok=nullptr) const
Returns the variant as an int if the variant has userType() \l QMetaType::Int, \l QMetaType::Bool,...
QString toString() const
Returns the variant as a QString if the variant has a userType() including, but not limited to:
QByteArray toByteArray() const
Returns the variant as a QByteArray if the variant has userType() \l QMetaType::QByteArray or \l QMet...
QMetaType metaType() const
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLenum GLenum GLsizei count
GLenum GLenum GLsizei const GLuint GLboolean enabled
Q_QML_EXPORT QQmlInfo qmlWarning(const QObject *me)
static QByteArray resolveSetting(const QByteArray &env, const QSharedPointer< QSettings > &settings, const QString &name)
static const QRgb rippleColorLight
static const QRgb switchUncheckedTrackColorLight
static const QRgb secondaryTextColorDark
static bool globalPrimaryCustom
static bool globalForegroundCustom
static QQuickMaterialStyle::Theme effectiveTheme(QQuickMaterialStyle::Theme theme)
static const QRgb switchDisabledUncheckedIconColorDark
static const QRgb switchDisabledUncheckedTrackColorLight
static const QRgb iconDisabledColorLight
static const QRgb frameColorLight
static uint globalPrimary
static QByteArray resolveSetting(const QByteArray &env, const QSharedPointer< QSettings > &settings, const QString &name)
static Enum toEnumValue(const QByteArray &value, bool *ok)
static QT_BEGIN_NAMESPACE const QRgb colors[][14]
static bool hasGlobalForeground
static const QRgb frameColorDark
static const QRgb switchDisabledUncheckedIconColorLight
static const QRgb sliderDisabledColorLight
static const QRgb raisedButtonDisabledColorDark
static const QRgb backgroundColorLight
static QQuickMaterialStyle::Theme globalTheme
static const QRgb primaryTextColorDark
static QColor darkerShade(const QColor &color, qreal amount)
static const QRgb dividerColorLight
static const QRgb switchDisabledUncheckedTrackBorderColorDark
static bool hasGlobalBackground
static const QRgb secondaryTextColorLight
static const QRgb primaryTextColorLight
static const QRgb raisedButtonDisabledColorLight
static const QRgb rippleColorDark
static const QRgb textFieldFilledContainerColorDark
static bool globalBackgroundCustom
static const QRgb iconDisabledColorDark
static const QRgb spinBoxDisabledIconColorLight
static const QRgb switchUncheckedTrackColorDark
static const QRgb sliderDisabledColorDark
static const QRgb iconColorLight
static bool globalAccentCustom
static const QRgb switchDisabledCheckedTrackColorDark
static const QRgb spinBoxDisabledIconColorDark
static const QRgb dialogColorDark
static const QRgb switchDisabledUncheckedTrackColorDark
static const QRgb backgroundColorDark
static const QRgb textFieldFilledContainerColorLight
static uint globalForeground
static QColor lighterShade(const QColor &color, qreal amount)
static const QRgb switchDisabledUncheckedTrackBorderColorLight
static const QRgb iconColorDark
static const QRgb hintTextColorLight
static const QRgb dividerColorDark
static QQuickMaterialStyle::Variant globalVariant
static const QRgb switchDisabledCheckedTrackColorLight
static const QRgb hintTextColorDark
static const QRgb raisedButtonColorLight
static uint globalBackground
static const QRgb raisedButtonColorDark
static const QRgb dialogColorLight
QT_BEGIN_NAMESPACE typedef unsigned int QRgb
#define QStringLiteral(str)
Q_CORE_EXPORT QByteArray qgetenv(const char *varName)
QSettings settings("MySoft", "Star Runner")
[0]
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent