Is there an API in QML similar to setMask() API of Qt?
-
wrote on 15 Oct 2011, 09:52 last edited by
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?
-
wrote on 15 Oct 2011, 09:57 last edited by
Well, QDeclarativeView is a QWidget after all - so you just might give it a try.
-
wrote on 17 Oct 2011, 13:31 last edited by
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.
-
wrote on 17 Oct 2011, 13:40 last edited by
QDeclarativeView is a QGraphicsView is a QAbstractScrollArea is a QFrame is a QWidget (is a QObject).
-
wrote on 17 Oct 2011, 13:48 last edited by
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?
-
wrote on 18 Oct 2011, 09:55 last edited by
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.
1/6