Hi,
I'd like to make a 'quiz' and I assumed I should add the long list of questions and radiobutton answers into a QScrollArea so they could all be seeen by the user. I'm having trouble to populate the scrollarea procedurally. In the Designer, I've been able to add mock-up questions to the scrollarea, but I can't even remove these mock-ups using my C++ code. I assume that if I can delete these children, I will know how to add content too.
I tried iterating over the "children of the scrollbar's widget's layout" (it hurts a little to say that). Here is my code to do that, which has a bad side-effect; the children render in a different place instead of just being deleted. I'd like to know the right way to delete the content of a scrollarea, thanks for any tips!
Qt Code:
if( scrollarea_content ) { //what is this? scrollarea_content->children(); if( scrollarea_layout ) { QLayoutItem *child; while ((child = scrollarea_layout->takeAt(0)) != 0) { delete child; } } }To copy to clipboard, switch view to plain text mode
Bookmarks