[Qt-interest] Transparent QWidget on top of a QGLWidget parent

Carl Snellman carl.snellman at gmail.com
Sat Mar 6 20:42:39 CET 2010


Hey,
If you mean Ubuntu's Visual effects
(System->Preference->Appearance->Visual Effect tab), they are disabled
on Maemo SDK Virtual Image (Ubuntu 8.04, no access to OpenGL
hardware). Also tried on Ubuntu 9.10 installed "natively" on my laptop
(OpenGL working, using Ubuntu's "normal" Visual Effects), and on Maemo
N900 device; All have the problem.
Tried with Qt 4.6.1, and Qt 4.6.2

One addition: If I change the parent QGLWidget to QWidget, everything
works fine....

Thanks,
Carl

2010/3/6 Konstantin Tokarev <annulen at yandex.ru>:
>> My enviroment: Ubuntu 9.10 (docs say that this would not work on Mac)
>
> Is compositing ("desktop effects") disabled?
>
> 06.03.10, 10:37, "Carl Snellman" <carl.snellman at gmail.com>:
>
>> Hey,
>> I have a problem I could not find any solution on the web etc, so I
>> need to turn to Qt Gods....
>> The problem is that I'm trying to place a transparent custom widget
>> into QGLWidget. You would expect (at least a novice like myself :)
>> that the QGLWIdget's content will show as the background of the custom
>> widget, but actually my computer's desktop (whatever happened to be on
>> that spot in screen) shines through?!?
>> I reduced the problem to following minimal code:
>> >>>>>>>>>>>>>>>>>>>>>>>>>>>>
>> #include
>> #include
>> #include
>> #include
>> class GlWidget : public QGLWidget  {
>> public:
>>     GlWidget() {
>>         setAutoFillBackground(true);
>>     };
>>     void paintEvent(QPaintEvent * event) {
>>         QPainter painter(this);
>>         painter.setPen(QPen(Qt::blue, 1, Qt::SolidLine, Qt::FlatCap,
>> Qt::MiterJoin));
>>         // draw vertical blue lines
>>         for(int x=0; xsetStyleSheet("color: black; border: 2px solid #8f8f91;
>> border-radius: 6px; background-color: transparent; width: 150px;
>> height: 50px;");
>>     w.show();
>>     return a.exec();
>> }
>> <<<<<<<<<<<<<<<<<<<<<<<<<<
>> I have tried pretty much every imaginable combination of
>> setAutofillbackground, palettes, styles but none worked. Is this a
>> known issue, and is there any workarounds?
>> Any help is very much appreciated!
>> Thanks,
>> Carl
>> PS.
>> My enviroment: Ubuntu 9.10 (docs say that this would not work on Mac)
>> The reason I use QGLWidget is that it gives a bit better performance
>> (FPS) on my real app.
>> _______________________________________________
>> Qt-interest mailing list
>> Qt-interest at trolltech.com
>> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
> --
> Regards,
> Konstantin
>
> Здесь спама нет http://mail.yandex.ru/nospam/sign
>




More information about the Qt-interest-old mailing list