[Qt-creator] Sharing GL ctx with qt-designer.

Paulo Silva paulo.jnkml at gmail.com
Tue Jun 19 15:31:14 CEST 2012


Hi Eike,

thanks for the advice. I'll ask it at

> Would probably be better asked on the interest@ mailing list, anyhow, trying to point to potential problems:
>
> So, you "promoted" all your widgets in designer to "MyClass"?

Yes, that's correct.

>
>> static QGLContext* const _shared_context(new QGLContext(QGLFormat()));
> If you really do that, you create a new QGLContext for each _shared_context() call. But that doesn't look like "real" code, so I suppose you return a single static instance here?

It's not real code... That thing is created only once.

>
>> MyClass():
> I'd think that designer generates code that calls a constructor that takes a "QWidget *parent". Is your constructor actually called?

Well, actually it does. Hey don't ask me. I though it was a hack. But
it seems to work.

>While debugging the frame i
> What does the generated ui_*.h file actually do? Have you debugged what is actually called with what parameters?

I have. The constructor of my class is called with the frame that
contains it (designer is doing that I guess), and I can confirm that
all widgets have the same context. They are just not sharing it.
Drawing fails for all widgets after the first.

=)
Paulo



More information about the Qt-creator mailing list