tags:

views:

49

answers:

1

I wanted to know how can I add a scroll bar to a QMainWindow, when this QMainWindow contains just one central widget, which is bigger than the QMainWindow size .. So that the scroll bar can be used to see different parts of this central widget .. A tutorial would be really beneficial for me at this point ..

+4  A: 

Set the central widget of your QMainWindow to a QScrollArea and then set the widget of that new QScrollArea to the widget that was previously your central widget.

Remember to set the "widget resizable" property of QScrollArea to true.

ianmac45
Alright I just tried this .. works sort of .. the original widget is displaying, but the scrollbars don't appear even when the size of the originally central widget exceeds the size of the QMainWindow ..
Ahmad
@Ahmad try using setHorizontalScrollBarPolicy() and setVerticalScrollBarPolicy() on your QScrollArea.
Casey