Results 1 to 2 of 2

Thread: qglwidget, mdi and coords

  1. #1
    Join Date
    Nov 2012
    Posts
    38
    Thanks
    3

    Default qglwidget, mdi and coords

    hello.
    I have this code:
    Qt Code:
    1. int x, y, w, h = 0;
    2. x = ptrGlWidgetImage->rect().x();
    3. y = ptrGlWidgetImage->rect().y();
    4. w = ptrGlWidgetImage->rect().width();
    5. h = ptrGlWidgetImage->rect().height();
    6. ptrGlWidgetImage->m_ptrRenderer = shared_ptr<CRenderer> (new CRenderer(x, w , h , y));
    To copy to clipboard, switch view to plain text mode 
    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.

  2. #2
    Join Date
    Dec 2012
    Posts
    90
    Thanks
    5
    Thanked 20 Times in 18 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: qglwidget, mdi and coords

    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.

Similar Threads

  1. One QGLWidget that manage QGLWidget childs
    By polch in forum Qt Programming
    Replies: 4
    Last Post: 12th December 2012, 11:26
  2. QGLWidget and VBO
    By kaszewczyk in forum Newbie
    Replies: 1
    Last Post: 6th May 2010, 10:04
  3. QGLWidget
    By manmohan in forum Newbie
    Replies: 2
    Last Post: 5th June 2009, 12:54
  4. QGLWidget bug
    By Wizard in forum Qt Programming
    Replies: 11
    Last Post: 31st August 2007, 11:23
  5. Getting a widget's position in desktop coords?
    By gfunk in forum Qt Programming
    Replies: 1
    Last Post: 5th January 2007, 06:17

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.