Is there an API in QML similar to setMask() API of Qt?
-
We want to make a particular region of a QML rectangle transparent.
In case of -QT- Qt, to do the same thing, we have used the setMask API of QWidget.
Is there any API in QML which does the same.
What I feel is that we can use the pass the QML rectangle to the -QT- Qt cpp file and use setMask() API on the rectangle, but will this be possible?
-
QDeclarativeView is derived from QObject and setMask property is of QWidget so we can not use setMask for QDeclarativeView. can any one please suggest some way of masking in QML.
-
Oh!!! that's right, so i have to pass the base Rectangle from QML application to QT CPP application and then Type cast it to QWidget and then call setMask on it, is it the right way?
-
It is worth pointing out that meego has this feature built in:
http://harmattan-dev.nokia.com/docs/library/html/qt-components/qt-components-meego-maskeditem.html
And even if you are on a different platform, you can just grab the source code from here:
http://qt.gitorious.org/qt-components/qt-components/blobs/master/src/meego/mdeclarativemaskeditem.h (.cpp)In Qt Quick 2, you could use a shader to achieve the same thing.