diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2014-11-09 16:19:46 +0100 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@theqtcompany.com> | 2014-11-10 16:06:53 +0100 |
commit | 27987d0b6ab181205e446e392d7c099c7ea81e94 (patch) | |
tree | a4830b1f12a9202c7cd8599cdb21619692f3af9d /src | |
parent | 09a56c4fe9999b5e1ab8921d37ae8f9a000f6ad6 (diff) | |
download | qtquickcontrols-27987d0b6ab181205e446e392d7c099c7ea81e94.tar.gz |
Android 5.0: apply tint color
Without this change checkboxes, radio buttons, slider handle etc.
are black on Android 5.0. This change applies the tint color so
that the controls become green/cyan as appropriate.
Task-number: QTBUG-42520
Change-Id: Ib8bd9d279f34e0f7951b311f398bc1fb11f7b1ba
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/controls/Styles/Android/drawables/ImageDrawable.qml | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/controls/Styles/Android/drawables/ImageDrawable.qml b/src/controls/Styles/Android/drawables/ImageDrawable.qml index 1e71a389..4b41b2f2 100644 --- a/src/controls/Styles/Android/drawables/ImageDrawable.qml +++ b/src/controls/Styles/Android/drawables/ImageDrawable.qml @@ -52,5 +52,33 @@ Drawable { anchors.fill: parent fillMode: Image.TileHorizontally source: AndroidStyle.filePath(styleDef.path) + + layer.enabled: !!styleDef && !!styleDef.tintList + layer.effect: ShaderEffect { + property variant source: image + property color color: AndroidStyle.colorValue(styleDef.tintList[state]) + state: { + var states = [] + if (pressed) states.push("PRESSED") + if (enabled) states.push("ENABLED") + if (focused) states.push("FOCUSED") + if (selected) states.push("SELECTED") + if (window_focused) states.push("WINDOW_FOCUSED") + if (!states.length) + states.push("EMPTY") + return states.join("_") + "_STATE_SET" + } + // QtGraphicalEffects/ColorOverlay: + fragmentShader: " + varying mediump vec2 qt_TexCoord0; + uniform highp float qt_Opacity; + uniform lowp sampler2D source; + uniform highp vec4 color; + void main() { + highp vec4 pixelColor = texture2D(source, qt_TexCoord0); + gl_FragColor = vec4(mix(pixelColor.rgb/max(pixelColor.a, 0.00390625), color.rgb/max(color.a, 0.00390625), color.a) * pixelColor.a, pixelColor.a) * qt_Opacity; + } + " + } } } |