PDA

View Full Version : QGLWidget with frame around it



winder
16th March 2010, 00:32
I think the title says it all! I 've done some experiments by myself, but i always get weird results. So whats the best approach in drawing a widget (and a qglwidget in particular, but it shouldn't make a difference) with a frame (with the color and a width of your choice).

Thanks in advance

john_god
16th March 2010, 01:26
Just draw four lines in the extreme coordinates sides of the qlwidget

winder
16th March 2010, 01:45
i'm sorry but i can't quite follow you. Can you elaborate pls?

john_god
16th March 2010, 19:12
check this link (http://qt.nokia.com/doc/3.3/geometry.html)
You'll have to use width() and height() to get the qglwidget client area coordinates. than just draw 4 lines, like a frame in the client area perimeter.
Note that qglwidgt requires you to define a viewport, so you'll have to do proper math conversion's between opengl and widget
coordinates. Any doubt let me know.

JD2000
16th March 2010, 19:33
Or you could insert your widget into a QSplitter and use one of its setFrame... member functions.

john_god
16th March 2010, 21:00
You're right, that sound's much more simple :)