PDA

View Full Version : scrollbar not working in Q3ScrollView...



sh123
12th February 2009, 09:13
I am using QT 4.4.3 .In Q3ScrollView scrollbars will automatically come if contents size is greater than the viewable area.But this didn't happen.so I used sv->setVScrollBarMode(Q3ScrollView::AlwaysOn); as follows:


Q3ScrollView* sv = new Q3ScrollView(this);
sv->setGeometry(0,0,110,600);
sv->setVScrollBarMode(Q3ScrollView::AlwaysOn);
QWidget *widget = new QWidget(sv->viewport());
QVBoxLayout *layout = new QVBoxLayout(widget);

QLabel* child1 = new QLabel("CHILD", widget);

child1->setPixmap(QPixmap(":/trolltech/examples/graphicsview/portedcanvas/img1.png"));
child1->setGeometry(2,2,90,620);

After doing this the scrollbar appeared but scrolling was not happening.The scrollbar appeared as shown in the image below: