Friday, June 11, 2010

QML opacity

It's easy to change the opacity to child QML elements. It's only setting opacity property between 0(full transparency) to 1(full opacity).

import Qt 4.7
import org.webkit 1.0

Rectangle {
    width: webView.width
    height: webView.height
    Text {
        x: 300
        y: 200
        text: "hidden text"
        smooth: true
    }
    WebView {
        id: webView
        width: 640
        height: 480
        opacity: 0.5
        url: 'http://html5demos.com/canvas-grad'
    }
}

This sample(opacity is 0.5) seems like below:

And if opacity is 0, above sample seems like below:

No comments:

Post a Comment