Commit 27987d0b authored by J-P Nurmi's avatar J-P Nurmi Committed by Jani Heikkinen
Browse files

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: default avatarEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
parent 09a56c4f
Branches
Tags
No related merge requests found
Showing with 28 additions and 0 deletions
...@@ -52,5 +52,33 @@ Drawable { ...@@ -52,5 +52,33 @@ Drawable {
anchors.fill: parent anchors.fill: parent
fillMode: Image.TileHorizontally fillMode: Image.TileHorizontally
source: AndroidStyle.filePath(styleDef.path) 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;
}
"
}
} }
} }
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment