Results 1 to 5 of 5

Thread: QMdiArea: Maximaized SubWindow in background?

  1. #1
    Join Date
    Mar 2010
    Posts
    10
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QMdiArea: Maximaized SubWindow in background?

    Hi everyone!

    I am using a QMdiArea with a couple of QGLWidget-subwindows. I would like to have one of the GLWidgets to fill the whole background of the QMdiArea, so that all other subwindows are always in front of it. As its background objects QMdiArea expects a QBrush-Objects, so there's no chance to set a normal widget as background I suppose?!

    Now I was wondering if I could place a maximized subwindow in the background, having the other subwindows always on top of it. Is that possible? (I would need the maximized window to catch mouse+keyboard events)

    Or is there a better/nicer solution for my problem?!

    Many thanks!

    J.R

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMdiArea: Maximaized SubWindow in background?

    Use QAbstractScrollArea::setViewport() to set a custom widget as the viewport of the mdi area.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    JohnnyRep (23rd March 2012)

  4. #3
    Join Date
    Mar 2010
    Posts
    10
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QMdiArea: Maximaized SubWindow in background?

    Ah perfect! Thanks wysota!
    It seems to work fine when I used a QTreeWidget (just for testing), but the QGLWidget gets reduced to 50x100pixel.
    I would have thought that the viewport-widget always takes the maximum space available (= the full QMdiArea). setMinimumSize() etc. did not work!
    Do you know, if I have to set a QSize somewhere to resize the GLWidget?

  5. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QMdiArea: Maximaized SubWindow in background?

    The viewport occupies the whole visible area of the scroll area (apart the scrollbars). Maybe it's not the GL widget that is so small but rather you don't initialize the projection matrix of the GL widget properly?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  6. #5
    Join Date
    Mar 2010
    Posts
    10
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QMdiArea: Maximaized SubWindow in background?

    I must have done something wrong. When I am using the QGLWidget as a QMdiArea Subwindows it works fine (it always has the full size of the subwindow and I can resize and maximize it).
    By adding a QMenu to my QGLWidget and set it as viewport it seems that just the QMenu is drawn. Is there any difference between a widget used in a subwindow and one used as a viewport? For me it looks like the QGLWidget does not take its space by the default when it is set as a viewport, when I am using a different Widget, such as the QTableWidget it'll take as much space as needed.

Similar Threads

  1. Center image on QMdiArea background
    By cia.michele in forum Qt Programming
    Replies: 0
    Last Post: 5th October 2010, 13:02
  2. QMdiArea / SubWindow Problem
    By ericV in forum Qt Programming
    Replies: 2
    Last Post: 19th September 2009, 00:09
  3. QMdiArea/SubWindow issue...
    By b1 in forum Qt Programming
    Replies: 3
    Last Post: 2nd September 2009, 08:22
  4. QMdiArea how to connect the subwindow changed
    By SamSong in forum Qt Programming
    Replies: 3
    Last Post: 21st May 2009, 02:15
  5. cannot open a subwindow!
    By cbarmpar in forum Qt Programming
    Replies: 1
    Last Post: 22nd September 2008, 16:06

Tags for this Thread

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.