Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
ScrollAreaWidgetContents not available when scroll area declared in code
aurora last edited by
I used scrollArea widget before, that time i created it in designer and to add the widgets into it i did as below
But now i wanted to create one more scroll area programattically(without designer)
I declared as below...
QScrollArea *sarea=new QScrollArea;
And when i tried to put inside it, program was crashing.
Here i didnt get option to use scrollAreaWidgetContents, as it was available in designer....
Please tell me what wrong here...
RazrFalcon last edited by
Hi. It's because QScrollArea didn't have layout by default. You must set it by yourself.
@QScrollArea *sarea = new QScrollArea();
QVBoxLayout *layout = new QVBoxLayout;
So, program is crashed because you trying to use uncreated pointer.