Results 1 to 3 of 3

Thread: DockWidgets with no centralWidget

  1. #1
    Join Date
    Dec 2009
    Posts
    21
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default DockWidgets with no centralWidget

    I'm looking to create an app who's front end would be 3 windows that fill the main window. These 3 can be dragged arround inside mainwindow, and can be dragged out to become floating windows but those inside mainwindow must allways fill all the space in it.
    That all sounds just like 3 dockwidgets, but I havent been able to find a way to give them the attributes to do that? There is allways a space somewhere between them, that they do not autofill. I'm thinking some sort of layout as well but...

    How would i do that?

    thanks

  2. #2
    Join Date
    May 2015
    Posts
    22
    Qt products
    Qt5
    Platforms
    Windows

    Cool Re: DockWidgets with no centralWidget

    You can remove the centralWidget by using
    Qt Code:
    1. setCentralWidget(0);
    To copy to clipboard, switch view to plain text mode 
    in your MainWindow constructor

  3. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: DockWidgets with no centralWidget

    You can remove the centralWidget
    @thibs: That almost certainly won't work (as I have tried to explain in your other posts around this same topic of QMainWindow and QDockWidget). If you use QMainWindow, you are expected to follow the Qt protocol for using that class. It means dock widgets are added to the QMainWindow, not as standalone objects, and you must have a central widget. Otherwise, you will likely get undesirable behavior as QMainWindow tries to deal with an incorrect usage.

    @drave: You should look at using QMainWindow with QMdiArea as the central widget. With QMdiArea, you can tile the QMdiSubWindow instances that wrap your child widgets so they cover the entire area as you desire.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. centralWidget always in center
    By xyfix in forum Qt Programming
    Replies: 3
    Last Post: 29th September 2009, 16:13
  2. DockWidgets problem
    By faldzip in forum Qt Programming
    Replies: 5
    Last Post: 30th January 2009, 20:37
  3. Closable dockwidgets
    By Kal in forum Qt Programming
    Replies: 0
    Last Post: 24th October 2008, 21:32
  4. DockWidgets and layout
    By sandeepvl in forum Qt Programming
    Replies: 2
    Last Post: 21st May 2008, 07:31
  5. Handle DockWidgets
    By jwintz in forum Qt Programming
    Replies: 2
    Last Post: 8th June 2006, 15:55

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.