PDA

View Full Version : Scrollbar in the container



anju123
16th July 2008, 06:59
Hi,
Well going forward with this requirement,in all the reference material also I could find was a situation where there was only single widget and the scroll bar was applied to whole window, my requirement is a little different , I need scroll bar for only half of the visible area, for e.g. my window is divided in to 2 panels and I want a scroll bar only in the right hand side panel, provided the text in the panel is large. I am trying by using a widget for right hand panel and then applying QScrollArea, but no luck so far. Can anybody please help me ?

Thanks
Anju

aamer4yu
16th July 2008, 07:25
I am trying by using a widget for right hand panel and then applying QScrollArea, but no luck so far.

What widget are u using ? Most of the display widgets have scrollbars added automatically when needed. Whats ur case, and why do you need to explicitly apply QScrollArea ??

anju123
17th July 2008, 05:18
I am using a widget as a container for many QPushbuttons and I need scrollbars because the number of buttons can increase dynamically

aamer4yu
17th July 2008, 05:43
Am not sure if thats possible in a straight way. I can think of 3 ways to accomplish the same -

1) Use chevrons, the small inverted arrows which show a menu to choose from. You might see them in Word or some other application

2) Use QListview and implement your own items to behave like a pusbutton. Or in simple case just change the cursor on hover event and make the list item work as a link/button. Be sure u use IConView for the list :)

3) In Qt 4.4 you can add widgets to QGraphicsView. This might help your case if you are bent on using QPushButton :D. QGraphicsView is derived from QAbstractScrollArea, so it will have scrollbars as u need them.

4) Make your own scrollbar for your widget. But why reinvent the wheel :D

anju123
18th July 2008, 06:16
well, I still do not think that problem is so complex , so as to think of these alternate ways, It was a simple problem of putting a scroll bar, which according to the QT literature should be simple enough and using the examples, I could apply the scrollbar on the whole window as such, I think I am missing a very crucial link in this problem, but never mind thanks for your ideas aamer

Regards
anju

prasanth.nvs
18th July 2008, 12:46
Hi
You cant put Scroll bar Untill u use proper layout.
So u set layout after u set the scrollbars.

aamer4yu
21st July 2008, 07:44
Might be , this thread (http://www.qtcentre.org/forum/f-newbie-4/t-qvlayoutbox-doesnt-expand-as-widgets-are-added-14937.html) helps you :)