Results 1 to 4 of 4

Thread: QDockWidget problem..

  1. #1
    Join Date
    Jul 2010
    Posts
    63
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default QDockWidget problem..

    trying to create something of this sort:
    http://www.youtube.com/watch?v=GvGLzMXiaM0

    i made a blank main window, and started adding QDockWidgets to it
    for(int i = 0; i<4; i++)
    {
    QDockWidget* qa = new QDockWidget;
    qa->setWidget(new CodeTextEdit);
    qa->setAllowedAreas(Qt::AllDockWidgetAreas);
    addDockWidget(Qt::TopDockWidgetArea, qa);
    }

    the problem is that i either get QDockWidgets that dock horizontally or vertically...
    what am i doing wrong?
    Last edited by jajdoo; 16th July 2010 at 21:09.

  2. #2
    Join Date
    Feb 2008
    Posts
    491
    Thanks
    12
    Thanked 142 Times in 135 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: QDockWidget problem..

    The code for that app is in "demos/mainwindow" or in the docs here.

    One way to do what you want to do is make a list of available dock areas and iterate through it:
    Qt Code:
    1. QList <Qt::DockWidgetArea> dockAreaList;
    2. dockAreaList << Qt::TopDockWidgetArea << Qt::RightDockWidgetArea << Qt::BottomDockWidgetArea << Qt::LeftDockWidgetArea;
    To copy to clipboard, switch view to plain text mode 

    Then in your for loop:
    Qt Code:
    1. addDockWidget(dockAreaList[i], qa);
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Jul 2010
    Posts
    63
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDockWidget problem..

    when i try the code you suggested and nest them all together, i get only horizontal or vertical when i try to separate them ..
    I'll take a look at the example.. see what i can dig up..

    is there something i need to set up to allow them to dock anywhere? (other than set allowed areas, that didn't really help)
    Last edited by jajdoo; 17th July 2010 at 07:37.

  4. #4
    Join Date
    Jul 2010
    Posts
    63
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QDockWidget problem..

    well; hacked my way there...
    used setCentralWidget so thatthey could dock all around it

Similar Threads

  1. QDockWidget pos, size problem
    By waynew in forum Qt Programming
    Replies: 4
    Last Post: 2nd March 2010, 23:02
  2. Qt 4.4 QDockWidget resize problem
    By MarkSutton in forum Qt Tools
    Replies: 2
    Last Post: 27th September 2008, 08:55
  3. Problem with QDockWidget
    By Banjo in forum Newbie
    Replies: 8
    Last Post: 26th March 2008, 22:02
  4. QDockWidget nesting problem..
    By aamer4yu in forum Qt Programming
    Replies: 6
    Last Post: 31st January 2007, 12:23
  5. Problem in restoring more than one QDockWidget
    By vratojr in forum Qt Programming
    Replies: 3
    Last Post: 13th March 2006, 13:45

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.