I want a QScrollArea that contains multiple widgets but on top of each other (like a deck of cards):
scrollArea->setWidget(widget1);
scrollArea->setWidget(widget1);
To copy to clipboard, switch view to plain text mode
widget1 appears
scrollArea->setWidget(widget2);
scrollArea->setWidget(widget2);
To copy to clipboard, switch view to plain text mode
widget2 appears
scrollArea->setWidget(widget1);
scrollArea->setWidget(widget1);
To copy to clipboard, switch view to plain text mode
SEGMENTATION FAULT
QScrollArea::setWidget(QWidget*) deletes the old widget before setting a new one, thus causing a segmentation fault. I've thought about keeping one widget and switching layouts, but Qt reference says:
"
If there already is a layout manager installed on this widget, QWidget won't let you install another. You must first delete the existing layout manager (returned by layout()) before you can call setLayout() with the new layout."
meaning old layout would be deleted before setting a new one. I have my widgets stored in a QMap and I'd like to switch em during runtime. Switching layouts would work for me aswell, np. The only solution coming to my mind is copying widgets(layouts)before setWidget() call, but not sure how smart that is.
Thanks in advance
Bookmarks