Advertisement
Guest User

Untitled

a guest
Mar 7th, 2017
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 0.99 KB | None | 0 0
  1. import QtQuick 2.0
  2. import QtGraphicalEffects 1.0
  3.  
  4. Rectangle {
  5.     width: 280
  6.     height: 280
  7.     color: "black"
  8.  
  9.     Text {
  10.         id: faultyItem
  11.         anchors.centerIn: parent
  12.         color: "red"
  13.  
  14.         layer.enabled: true
  15.         layer.effect: ShaderEffect {
  16.             fragmentShader: "
  17.                uniform lowp sampler2D source; // this item
  18.                uniform lowp float qt_Opacity; // inherited opacity of this item
  19.                varying highp vec2 qt_TexCoord0;
  20.                void main() {
  21.                    lowp vec4 p = texture2D(source, qt_TexCoord0);
  22.                    lowp float g = dot(p.xyz, vec3(0.344, 0.5, 0.156));
  23.                    gl_FragColor = vec4(g, g, g, p.a) * qt_Opacity;
  24.                }"
  25.         }
  26.     }
  27.  
  28.     Timer {
  29.         repeat: true
  30.         interval: 1000
  31.         running: true
  32.         property int count: 0
  33.         onTriggered: {
  34.             count = count +1
  35.             faultyItem.text = count
  36.         }
  37.     }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement