Results 1 to 3 of 3

Thread: Is it possible to put three QDockwidgets side by side?

  1. #1
    Join Date
    Sep 2011
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Is it possible to put three QDockwidgets side by side?

    I have an QMainWindow that has no central widget. Based on suggestions here I've setDockNestingEnable(true) and set the dock widgets to allow Qt::AllDockWidgetAreas. For the most part this is working as desired. However, I'd like to line my dock widgets up 3 across.

    i.e.

    DockWidgetA DockWidgetB DockWidgetC

    Is this possible?

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Is it possible to put three QDockwidgets side by side?

    Yes, it's even the default behaviour (at least on Linux). What is the problem?

    Qt Code:
    1. #include <QtGui>
    2. #include <QDebug>
    3.  
    4. class MainWindow: public QMainWindow {
    5. Q_OBJECT
    6. public:
    7. MainWindow(QWidget *p = 0): QMainWindow(p) {
    8. setGeometry(0, 0, 640, 480);
    9.  
    10. setDockNestingEnabled(true);
    11. QDockWidget *dock1 = new QDockWidget(tr("Dock 1"), this);
    12. dock1->setAllowedAreas(Qt::AllDockWidgetAreas);
    13. QDockWidget *dock2 = new QDockWidget(tr("Dock 2"), this);
    14. dock2->setAllowedAreas(Qt::AllDockWidgetAreas);
    15. QDockWidget *dock3 = new QDockWidget(tr("Dock 3"), this);
    16. dock3->setAllowedAreas(Qt::AllDockWidgetAreas);
    17. addDockWidget(Qt::TopDockWidgetArea, dock1);
    18. addDockWidget(Qt::TopDockWidgetArea, dock2);
    19. addDockWidget(Qt::TopDockWidgetArea, dock3);
    20. // No central widget
    21. }
    22. public slots:
    23. private:
    24. };
    25.  
    26. int main(int argc, char *argv[])
    27. {
    28. QApplication app(argc, argv);
    29.  
    30. MainWindow m;
    31. m.show();
    32. return app.exec();
    33. }
    34. #include "main.moc"
    To copy to clipboard, switch view to plain text mode 

  3. #3
    Join Date
    Sep 2011
    Posts
    14
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Is it possible to put three QDockwidgets side by side?

    Thank you,

    I missed one of the setAllowedAreas calls.

Similar Threads

  1. DockWidget side by side
    By Donner in forum Newbie
    Replies: 1
    Last Post: 1st February 2013, 10:25
  2. Manifest / Side by Side configuration.
    By hickscorp in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2010, 05:22
  3. side-by-side configuration is incorrect
    By trueqt in forum Qt Programming
    Replies: 1
    Last Post: 28th August 2009, 00:35
  4. Stack two QMenuBars instead of side by side?
    By killerwookie99 in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2008, 06:27
  5. Replies: 5
    Last Post: 15th February 2008, 02:54

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
  •  
Qt is a trademark of The Qt Company.