Hello There...
I Was Working Around With QScrollArea And I Tried To Add Two Widgets To It,But Each Time Only The Second One Appear.
Can I Have A Basic Example On How To Add Two Widgets To This Scroll Area?
Thanks In Advance...
Hello There...
I Was Working Around With QScrollArea And I Tried To Add Two Widgets To It,But Each Time Only The Second One Appear.
Can I Have A Basic Example On How To Add Two Widgets To This Scroll Area?
Thanks In Advance...
When you call QScrollArea::setWidget(), it replaces the first widget with the second one. That's why it has the prefix "set" and not "add".
Two possible routes to a solution:
1 - Add a QLayout-based layout to the scroll area, and then add your multiple widgets to the layout
2 - Derive a new class from QWidget, add a layout to that, and add your widgets to that layout. Then add the derived widget to the scroll area.
The second method is the one I would choose. It is in essence exactly the same way you would create a new dialog class, except that in this case the bsae class is QWidget, not QDialog. Once you create that new widget class, you can use Qt designer to create its UI.
Last edited by d_stranz; 24th June 2017 at 16:12.
<=== The Great Pumpkin says ===>
Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.
Bookmarks