diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-01-20 11:43:43 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2016-01-20 15:28:30 +0000 |
commit | 7d633042d321c77601d281ac4d6575ab185d89e0 (patch) | |
tree | 3b8e3331faab525743afc4e086624693a492ba19 /src/imports/controls/material/qquickmaterialstyle_p.h | |
parent | ab7f09e3f65a60e2a7515b8ff58c09dec3b33056 (diff) |
Restore Material::primary
The idea was that users would simply configure a different accent color
for the toolbar, but the only way to do this is in code, which creates
a hard dependency to the material style. A separate primary color makes
it possible to configure both colors in :/qtlabscontrols.conf, which
nicely avoids style specific dependencies.
Change-Id: Ia5ad92b57f9aea32e16e9260117e8d32b3356556
Task-number: QTBUG-50329
Reviewed-by: Nikita Krupenko <krnekit@gmail.com>
Reviewed-by: Mitch Curtis <mitch.curtis@theqtcompany.com>
Diffstat (limited to 'src/imports/controls/material/qquickmaterialstyle_p.h')
-rw-r--r-- | src/imports/controls/material/qquickmaterialstyle_p.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/imports/controls/material/qquickmaterialstyle_p.h b/src/imports/controls/material/qquickmaterialstyle_p.h index 48e7ca37..67eccb24 100644 --- a/src/imports/controls/material/qquickmaterialstyle_p.h +++ b/src/imports/controls/material/qquickmaterialstyle_p.h @@ -59,7 +59,9 @@ class QQuickMaterialStyle : public QQuickStyle { Q_OBJECT Q_PROPERTY(Theme theme READ theme WRITE setTheme RESET resetTheme NOTIFY themeChanged FINAL) + Q_PROPERTY(QVariant primary READ primary WRITE setPrimary RESET resetPrimary NOTIFY primaryChanged FINAL) Q_PROPERTY(QVariant accent READ accent WRITE setAccent RESET resetAccent NOTIFY accentChanged FINAL) + Q_PROPERTY(QColor primaryColor READ primaryColor NOTIFY primaryChanged FINAL) // TODO: remove? Q_PROPERTY(QColor accentColor READ accentColor NOTIFY accentChanged FINAL) // TODO: remove? Q_PROPERTY(QColor backgroundColor READ backgroundColor NOTIFY paletteChanged FINAL) Q_PROPERTY(QColor primaryTextColor READ primaryTextColor NOTIFY paletteChanged FINAL) @@ -153,12 +155,19 @@ public: void propagateTheme(); void resetTheme(); + QVariant primary() const; + void setPrimary(const QVariant &accent); + void inheritPrimary(uint primary, bool custom); + void propagatePrimary(); + void resetPrimary(); + QVariant accent() const; void setAccent(const QVariant &accent); void inheritAccent(uint accent, bool custom); void propagateAccent(); void resetAccent(); + QColor primaryColor() const; QColor accentColor() const; QColor backgroundColor() const; QColor primaryTextColor() const; @@ -198,6 +207,7 @@ public: Q_SIGNALS: void themeChanged(); + void primaryChanged(); void accentChanged(); void paletteChanged(); @@ -208,9 +218,12 @@ private: void init(); bool m_explicitTheme; + bool m_explicitPrimary; bool m_explicitAccent; + bool m_customPrimary; bool m_customAccent; Theme m_theme; + uint m_primary; uint m_accent; }; |