Results 1 to 4 of 4

Thread: Area for detachable QDialogs within QGridLayout

  1. #1
    Join Date
    Aug 2013
    Location
    Texas, U.S.A.
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Question Area for detachable QDialogs within QGridLayout

    I have a QMainWindow with a QGridLayout of various widgets that looks like the attached png.

    layout.jpg

    I will have various little input dialogs that come up at different times, and I want them to appear in certain cell of the layout (bright cyan area below purple tab widget in picture). They would show up in this cell by default but should be detachable and able to be moved around as desired (just like a regular, stray QDialog).

    What would be the best way to go about this?

    I tried using a QDockWidget and just adding it right into the grid layout, but it seems I cannot un-dock it and move it around, even with a call to setFeatures that should allow this freedom.

    The addDockWidget function allows the desired movement, but this won't let me incorporate the dock area within the grid; it just puts the dock widget on, e.g., one side of the entire main window.

  2. #2
    Join Date
    Jun 2006
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 4 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Area for detachable QDialogs within QGridLayout

    QMainWindow::AllowNestedDocks might do what you need.

    Mind, however, that the main window layout is not a grid layout, with all pros and cons.

  3. #3
    Join Date
    Aug 2013
    Location
    Texas, U.S.A.
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Area for detachable QDialogs within QGridLayout

    Hmm...would it work if the main window had a nested set of QHBox/QVBoxLayouts to imitate the grid? This wouldn't be ideal, though, so maybe I just need an alternative to QDockWidget in general.

    Perhaps something else floatable, like a QToolBar that gets the appropriate "dialog" features shown on it at the appropriate times?

  4. #4
    Join Date
    Aug 2013
    Location
    Texas, U.S.A.
    Posts
    8
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Re: Area for detachable QDialogs within QGridLayout

    Somewhat of a work-around: I put the tab widget itself into a DockWidget, then made a dock widget as before for the dialogs and put them both in the same DockWidgetArea of the main window. This stacks them nicely (though it does mean that the upper toolbars and text edit no longer go all the way across) and is pretty close to the desired result.

    To really go all-out, I suppose I could try docking the upper toolbars as well, which would be flexible, but for now, this will do!

Similar Threads

  1. Working with multiple local QDialogs
    By Momergil in forum Qt Programming
    Replies: 4
    Last Post: 1st April 2013, 23:35
  2. QDialogs are always on top - why?
    By Maximka in forum Newbie
    Replies: 4
    Last Post: 21st February 2010, 17:40
  3. Seg Fault with multiple QDialogs
    By kroenecker in forum Qt Programming
    Replies: 2
    Last Post: 21st March 2009, 15:21
  4. Replies: 1
    Last Post: 18th November 2008, 18:41
  5. Delete a QGridLayout and New QGridLayout at runtime
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 5th November 2007, 14:01

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.