Scroll area not scrolling
Solved
General and Desktop
-
On the UI side, using QtCreator, I have a QScrollArea and I use this code to put a widget in it.
void ServiceAppLayout::setSideBarWidget(QWidget *widget) { ui->sideBarScrollArea->setWidget(widget); }
This works fine, as the widget appears as expected, but if the widget is oversized, the scroll area doesn't offer scroll bars. What am I missing? How do I get the scroll bars to appear when needed?
-
which platform ? Did you try with simple example like follows ? Does it work ?
MainWindow w; w.resize(600,600); QScrollArea area; area.setWidget(&w); area.show();
-
Ok, I figured it out, it had nothing to do with my code, or the scroll area. The widget that is handed to the scroll area has to have a layout defined, and all the visual elements need to be in that layout. This I discovered by accident this morning.