1

I am a beginner in Qt and I want to make three QDockWidgets appear on the screen in the left, right and bottom. Here's the code :

.h file

QDockWidget *dock1 = new QDockWidget("Left dock");
QDockWidget *dock2 = new QDockWidget("Right dock");
QDockWidget *dock3 = new QDockWidget("Bottom dock");

.cpp file

dock1->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
dock2->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
dock3->setAllowedAreas(Qt::BottomDockWidgetArea);

this->addDockWidget(Qt::LeftDockWidgetArea, dock1);
this->addDockWidget(Qt::RightDockWidgetArea, dock2);
this->addDockWidget(Qt::BottomDockWidgetArea, dock3);

This is all I added to the files (I didn't include the whole file because most of them are just default code). And this is what I get :

What I got

Is this normal ? And for some reason I can't resize the docks using the handle bar between the bottom and two upper docks. This is what I thought was gonna happen :

enter image description here

Forget the red line. But in my mind, I thought it's gonna look more like the latter picture (With the white panel attached to it and resizable between 3rd and the other docks).

It this behaviour normal. Or did I mess something up. Somebody please help me.

Btw : When creating the project p, I had "generate form" disabled. Wonder if that affects anything.

Hung Truong
  • 401
  • 1
  • 3
  • 12
  • 1
    Does your `QMainWindow` have a [central widget](http://doc.qt.io/qt-5/qmainwindow.html#setCentralWidget)? If not then try adding one. – G.M. Apr 24 '17 at 14:50

0 Answers0