QMainWindow defines four areas where widgets can be docked.
Is it possible to define my own dockareas?
It should be a component like QFrame that i can place anywere and dock widgets to it.
Printable View
QMainWindow defines four areas where widgets can be docked.
Is it possible to define my own dockareas?
It should be a component like QFrame that i can place anywere and dock widgets to it.
Qt4.3 having 8 dock areas(included corner), but you can dock more than 8.
like you can dock multiple widget in left side, in left1 & left2.
With left1 & left2 etc. i could manage the layout i wanted. I could fix the position of windows that should not be moved.
But there is now another problem: How can set the size and position of docked windows?
This problem was discussed several time in this forum. But there was no solution that really satisfy.
From Delphi i know the element TPanel. It has the property DockSite. If it is set to true you can dock other TPanel to it if the other TPanel has the property DragKind=dkDock.
With TPanel i can do what ever i can do with QFrame.
But I think there is no (easy) way to implement something like TPanel.
you can set the size and position of dockwidget using
DockWidgetArea and sizeHint.
I set the size and position of docked windows by using DockWidgetArea and sizeHint.
but sometime you have to change the sizeHint of other widget to fix size of first widget.
How are you using sizeHint?
Here is some code that displays 2 QDockWidget. Docker1 should be displayed at position 100,100 and should have the size 100x200. This works fine.
But i can't set the width of Docker2 to 100.
Code:
{ ui.setupUi(this); Docker1->setObjectName("Docker1"); frame1->setLayout(la1); la1->addWidget(lw1); la1->addWidget(pb1); Docker1->setWidget(frame1); addDockWidget(Qt::RightDockWidgetArea,Docker1); Docker1->setFloating(true); Docker1->setGeometry(100,100,100,200); // -------------------------------------------- Docker2->setObjectName("Docker2"); frame2->setLayout(la2); la2->addWidget(lw2); la2->addWidget(pb2); Docker2->setWidget(frame2); addDockWidget(Qt::LeftDockWidgetArea,Docker2); Docker2->setFloating(false); // Docker2 should be displayed with a width of 100 Docker2->setGeometry(10,10,100,100); // does not work Docker2->setMinimumWidth(100); // does not work }
Hi,
here is the code for you.
Code:
DockerDockWidget *Docker2 = new DockerDockWidget(this); ... { public: private: QSize szHint, minSzHint; }; { } { return szHint; } { return minSzHint; }
This works good for Qt 4.2.3 . It does not work for Qt 4.3.0. Trolltech told me that there is still a task (tasktracker #168726).