I write some app and need to create window with transparency mask. How I can create QtQuick 2.0 top level window with masked transparency?
Asked
Active
Viewed 1,642 times
0
-
http://www.lothlorien.com/kf6gpe/?p=204 – khajvah Sep 12 '13 at 12:52
-
@khajvah Nope, that QtQuick 1.0 – Dcow Sep 12 '13 at 13:03
-
My bad, it really doesn't work with qtquick 2.0 – khajvah Sep 12 '13 at 13:10
-
Try [this](http://stackoverflow.com/questions/14009549/how-to-make-a-transparent-window-with-qt-quick-2-0) – khajvah Sep 12 '13 at 13:11
-
@khajvah doesn`t work for me =( – Dcow Sep 12 '13 at 17:49
-
Dcom: does not work is a poor definition of the problem. Could you please elaborate? – László Papp Sep 12 '13 at 20:14
-
https://bugreports.qt-project.org/browse/QTBUG-28214 For now `quickwidget` don`t work. Change SurfaceFormat does not work too. – Dcow Sep 12 '13 at 21:38
-
I do not think there is any other way to it. – László Papp Sep 13 '13 at 03:48
1 Answers
0
For mask, you can use setMask function of QWindow, it's work for QQuickView. But you need to launch QML UI with QQuickView and not with qmlscene application (cf http://qt-project.org/doc/qt-5.1/qtgui/qwindow.html#setMask)

gbdivers
- 1,147
- 9
- 9
-
-
Yes, using QPixmap::mask() : view.setMask(QPixmap(":/images/mask.png").mask()); – gbdivers Sep 25 '13 at 19:15
-
I`m sorry, but what about semi transparency? I apply same mask for window and that what I see : http://gyazo.com/11ad63fc89baed0c62691ef3fe5d657e – Dcow Sep 26 '13 at 18:47
-
Mask use binary value, then you can't set real value for alpha. Use opacity property (for unique alpha value in item) ou Image (I think jpeg format is not well supported for alpha channel, use png. or inverse). – gbdivers Sep 26 '13 at 18:56
-
I use png image with alpha for mask and background. What exactly I need to do ? – Dcow Sep 26 '13 at 19:03
-
You can use mask with QQuickView (for no rectangular shaping) and Image as main item (with you png) for transparent. Maybe it's better to generate black and white image from your png for the mask. – gbdivers Sep 26 '13 at 20:50
-
Same result with QQUickView and Image as main obj http://gyazo.com/48b9b1d327ee90208d5037d4058fbe50 – Dcow Sep 26 '13 at 21:19