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

Avishek_Sharma Avishek_Sharma at satyam.com
Thu Dec 18 11:05:00 CET 2008


Hi ,
    I created a simple form with a textlabel (textlabel1) and a dropdownbox .If you select any option from the dropdownbox,you should have a pic displayed in the textlabel and have scrollbars on the sides if picture size exceeds the textlabel's area.
The problems that I am having are:(I have attached the final output in the attached document,pls view it)

1) The scrollview shows up with the scrollbars but the picture isn't displayed anywhere.

2) If i have some text on my text label(like I have 'avishek' in the screenshot) then a small portion of the picture appears in the background of the text.


3)I tried to set the geometry of the textlabel but though it works when I comment out all the lines except textLabel1->setGeometry(100,80,300,200);
textLabel1->setPaletteBackgroundPixmap(QPixmap("/root/Albums/NEW/DSC01059.JPG"));

But, as soon as I bring the scrollview into picture,it shows the above described results(1 & 2).
I guess it might have to do something with the label being made a child of the scrollview....I don't know how to get around this problem......Please provide a solution for it,I have been trying for the last 2 days(newbie)

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/NEW/DSC01059.JPG"));
         sv->addChild(textLabel1,100,80);
         sv->show();


}


-

DISCLAIMER:
This email (including any attachments) is intended for the sole use of the intended recipient/s and may contain material that is CONFIDENTIAL AND PRIVATE COMPANY INFORMATION. Any review or reliance by others or copying or distribution or forwarding of any or all of the contents in this message is STRICTLY PROHIBITED. If you are not the intended recipient, please contact the sender by email and delete all copies; your cooperation in this regard is appreciated.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: result.png
Type: image/png
Size: 151827 bytes
Desc: result.png
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20081218/cd07b32e/attachment.png 


More information about the Qt-interest-old mailing list