Results 1 to 5 of 5

Thread: Programmatically Dock

  1. #1
    Join Date
    Feb 2011
    Posts
    14
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Programmatically Dock

    Hello Everybody,

    I need to programmatic-ally dock windows like this:
    DesiredDockWidgetbehavior.JPG

    But QT Designer does it like this:

    DefaultDockWidgetBehavior.jpg

    How do i programmatically do the desired behavior?

    Qt Only allows the mainWindow to call
    MainWindow->addDockWidget(static_cast<Qt:ockWidgetArea>(1), B);
    and
    MainWindow->addDockWidget(static_cast<Qt:ockWidgetArea>(1), A);

    I need to get control of how the two dock widgets are laid out.

    My Goal is to have complex layout like this:
    DesiredComplexDockWidgetbehavior.jpg

    The idea is that once the user does his thing, I need to save and recreate this layout.

    Any help is appreciated.


    --
    Regards,
    ven.
    Last edited by venkateshhegde; 13th February 2011 at 15:59. Reason: updated contents

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

    Default Re: Programmatically Dock

    Set QMainWindow::dockNestingEnabled to false to prevent nesting docks. I'm afraid your desired layout will be difficult to obtain. You need to force the size hint of the first dock to be so large that no other docs can be nested with it. Of course this will fail if user resizes the window...
    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. #3
    Join Date
    Feb 2011
    Posts
    14
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Programmatically Dock

    How is it that the User Action is yielding the result but programmatically its not possible?
    I should be able to dock different windows in a single area (Left as shown above) like this:

    ______
    __|2
    1_|___
    __|3
    __|___

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

    Default Re: Programmatically Dock

    I didn't say it was not possible. I said the dock has to have proper size. It could be that you can manipulate the value of the property I pointed you to between adding different docs, maybe you'll get your configuration this way (try disabling dock nesting before adding the second dock and enabling it back again before adding the last one).
    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.


  5. #5
    Join Date
    Feb 2011
    Posts
    14
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Programmatically Dock

    Answer Gotcha! These APIs help.. They are like Splitter Apis... I was able to get my results!!!!!
    Thaank you for the help!

    Qt Code:
    1. void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget);
    2. void addDockWidget(Qt::DockWidgetArea area, QDockWidget *dockwidget,
    3. Qt::Orientation orientation);
    4. void splitDockWidget(QDockWidget *after, QDockWidget *dockwidget,
    5. Qt::Orientation orientation);
    6. void tabifyDockWidget(QDockWidget *first, QDockWidget *second);
    7. QList<QDockWidget*> tabifiedDockWidgets(QDockWidget *dockwidget) const;
    8. void removeDockWidget(QDockWidget *dockwidget);
    9. bool restoreDockWidget(QDockWidget *dockwidget);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. How to programmatically add attachments to emails in Qt
    By Praveena pb in forum Qt Programming
    Replies: 2
    Last Post: 25th November 2010, 20:34
  2. Creating a button programmatically
    By Luc4 in forum Newbie
    Replies: 1
    Last Post: 27th January 2010, 11:30
  3. forcing dock windows to dock?
    By eric_vi in forum Qt Programming
    Replies: 3
    Last Post: 9th August 2009, 16:32
  4. Replies: 3
    Last Post: 3rd September 2008, 17:41
  5. [?] Input text programmatically
    By XuTMAH in forum Newbie
    Replies: 3
    Last Post: 24th September 2007, 17:47

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.