[Qt-interest] Pls,take a look... implementing scrollbars

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Fri Dec 19 00:46:04 CET 2008


Avishek wrote:

> I have attached the code below,please check it out and let me 
> know of the mistakes in it and what changes to make.(Have 
> sent a screenshot too,pls see it for the result)....working on Qt3.3
> Thanks in advance.
> 
>  #include<qscrollview.h>
> #include<qlabel.h>
> 
> 
> void Form1::showscrol()
> {
>         QScrollView* sv = new QScrollView(this);
> 
>          sv->setVScrollBarMode(QScrollView::AlwaysOn);
>          sv->setHScrollBarMode(QScrollView::AlwaysOn);
>          sv->setGeometry(100,80,300,200);
>          textLabel1->setGeometry(100,80,300,200);
> 
>          
> textLabel1->setPaletteBackgroundPixmap(QPixmap("/root/Albums/N
> EW/DSC01059.JPG"));
>          sv->addChild(textLabel1,100,80);
>          sv->show();
> }

Hi Avishek, 

I'm confused - if 3.3 is working, then which version are you getting the
error on? 

If Qt 4, QScrollView doesn't have addChild.  Try using
sv->setWidget(textLabel1). 

Hope that helps, 

Tony Rietwyk.




More information about the Qt-interest-old mailing list