0

When I create a new QDockWidget

  myWidget = new MyDockWidget(this);
  MyMainWindow::instance()->addDockWidget(Qt::RightDockWidgetArea, mSettings);

I can see it in the middle of the screen. After that I can notice it is placed docked to the right. I'm running under debugger so understandably things are slow. Nevertheless end users might run on overbooked machines etc. Could I create the window docked already or hide it until it actually gets docked?

In constructor I have setupUi(this); for my MyDockWidget with following settings:

MyDockWidget->setFloating(true);
MyDockWidget->setFeatures(QDockWidget::AllDockWidgetFeatures);
MyDockWidget->setAllowedAreas(Qt::RightDockWidgetArea);

So why it appears on center on start? How to fix this?

P.S. If I set dock widget parent to main window it appears undocked - why? What is correct parent? My current parent is mdi window.

Aleksey Kontsevich
  • 4,671
  • 4
  • 46
  • 101

2 Answers2

0

Removed all features, left default like in Dock Widgets Example, and set parent to main window - works fine now.

P.S. Set features DockWidgetFloatable | DockWidgetMovable manually, then same in Designer - works also - some weird bug. Solved.

Aleksey Kontsevich
  • 4,671
  • 4
  • 46
  • 101
0

You can just use MyDockWidget->setVisible(false); after you've set all its features.

Garjy
  • 467
  • 5
  • 12