For my Qt application, I have used dock widgets, but enabling too many dockwidgets causes them to flow out of the screen at the bottom. How do I add a scrollbar to the whole dockwidget area?
Here's an example:

Code of a dock widget :
QDockWidget *imageDock = new QDockWidget(i18n("Image"), this);
imageDock->setObjectName("ImageDock");
ImageChooserWidget *imageChooserWidget = new ImageChooserWidget(this);
imageDock->setWidget(imageChooserWidget);
addDockWidget(Qt::RightDockWidgetArea, imageDock);
m_dockWidgets.append(imageDock);
actionCollection()->addAction("show_image_dock", imageDock->toggleViewAction());
imageDock->setVisible(false);
connect(m_vocabularyView, SIGNAL(translationChanged(KEduVocExpression*, int)),
imageChooserWidget, SLOT(setTranslation(KEduVocExpression*, int)));
Also I have this before hand:
setCorner(Qt::TopLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::BottomLeftCorner, Qt::LeftDockWidgetArea);
setCorner(Qt::TopRightCorner, Qt::RightDockWidgetArea);
setCorner(Qt::BottomRightCorner, Qt::RightDockWidgetArea);
Create a QScrollArea, put it into the dock widget and put your contents into the scroll area. You may need to call scrollArea->setWidgetResizable(true) to make it to resize your contents properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With