DiscussionsIssue archiveOther usage issues

Archived discussion

Transparent Qt widgets

Other usage issuesSat, 03/15/2014 - 15:213 replies

Browse this forum
QuestionAuthor

Hello,

I think adding transparent UI into the viewer is essential for CAD applications (HUD display, ocaf tree ect)
So I am trying to add transparent Qt widgets on the OpenGl viewer.
According to this http://doc.qt.digia.com/qq/qq26-openglcanvas.html you need to:

1. Subclass QGraphicsScene.
2. reimplement drawBackground() function.
3. Render your OpenGl scene in drawBackground().
4. Add transparent widgets to the scene.

This is straight forward except for step 3. drawBackground requires you to put in your (pure) OpenGl commands (Not view->Redraw(); )
So the question is, How can we render the viewer inside drawBackground(); ?
Is there a function that can be used to render like it does in the example?

I have attached a simple project of how it should be used.

Thank you

Discussion

3 archived replies

Posts are displayed in their archived order.

01Commenter-1

I'm very curious about this as well Author...
Have you seen [1]?
It mentions getting the OGL context, which perhaps might be the gateway to this?

-jelle

[1] http://www.opencascade.org/org/forum/thread_25912/?forum=3

02Commenter-2

Yes that may be a possibility, I am looking into it.

Thanks Author

03Commenter-3

You might also consider using a FBO, especially if you are going to use Qt::WA_TranslucentBackground.

---------
setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
---------

Because if you add this lines to any widget, OpenGL content would not be properly displayed.