1

My App uses a QMdiArea is instantiated in a QMainWindow. Its child windows are QScrollArea. Each of them have QDockWidget as child, instantiated upon creation of the QScrollArea. The QDockWidget are set as floatable. In multi GPU and multi screen systems, they do not first show up in the same screen. How can I set them floatable and appear in the same screen as the QMdiArea, since QDockWidget do not have the "setScreen" property?

Here is how I set things up within the QMainWindow:

mdiArea = new QMdiArea;
setCentralWidget(mdiArea);

// ImScrollArea inherits a QScrollArea. 
ImScrollArea* dropImScrollArea = new ImScrollArea(urlList); 
QMdiSubWindow *newSubWindow = new QMdiSubWindow;
newSubWindow->setWidget(dropImScrollArea);
newSubWindow->setAttribute(Qt::WA_DeleteOnClose);

mdiArea->addSubWindow(newSubWindow);
newSubWindow->show();

addDockWidget(Qt::BottomDockWidgetArea, dropImScrollArea->getDock());
dropImScrollArea->getDock()->setFloating(true);
dropImScrollArea->getDock()->show();   

The QDockWidget within the QScrollArea is defined as:

dock = new QDockWidget(windowTitle, this);
dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
dock->setFeatures(QDockWidget::DockWidgetMovable);
dock->setFeatures(QDockWidget::DockWidgetFloatable);
dock->setAllowedAreas(Qt::BottomDockWidgetArea |      Qt::RightDockWidgetArea);
Wall-E
  • 623
  • 5
  • 17

0 Answers0