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

Konstantin Tokarev annulen at yandex.ru
Sat Mar 6 20:29:29 CET 2010


> 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