PDA

View Full Version : qglwidget, mdi and coords



giugio
24th March 2013, 16:43
hello.
I have this code:


int x, y, w, h = 0;
x = ptrGlWidgetImage->rect().x();
y = ptrGlWidgetImage->rect().y();
w = ptrGlWidgetImage->rect().width();
h = ptrGlWidgetImage->rect().height();
ptrGlWidgetImage->m_ptrRenderer = shared_ptr<CRenderer> (new CRenderer(x, w , h , y));

where ptrGlWidgetImage is a qglwidget.
the ptrGlWidgetimage is inside a qmdisubwindow
the values are x:0, w:800 , h:600 , y:0
but if I places this code inside the qglwidget class I obtains:

x:0 , w:786, h :563, y:0

that is the correct size for my opengl purpose.
the problem is that i must obtain these value from outside the qglwidget class.
I see mapfrom , matopglobal ecc... but i'm not understand.
Why inside the qglwidget i obtain these value ? are the no display subwindow area ?

thanks.

lanz
25th March 2013, 07:12
I can't say without looking at your code, but I guess that you get wrong values when you're calling rect() before subwindow have done layout. Then after layout has been applied to the subwindow, it resizes QGLWidget to it's correct value, and that's what you get inside QGLWidget methods.