Re: Subclassing QScrollView
Have you see your picture?
Re: Subclassing QScrollView
ya, I can see the Picture and it is always at top-left of viewport.
Re: Subclassing QScrollView
try resizeContents(yourpictureWidth,yourpictureHeight)
1 Attachment(s)
Re: Subclassing QScrollView
should I reimplement resizecontents() ?
And is my code of drawcontents sufficient?
I also attaching my ImageView.
Re: Subclassing QScrollView
Quote:
Originally Posted by sumsin
ya, I can see the Picture and it is always at top-left of viewport.
its ok becouse you draw it there;)
Re: Subclassing QScrollView
no need to reimplement it.
Just call the slot (not inside drawContents but somewhere before drawContents gets called).
I think the code inside drawContents will suffice.
Re: Subclassing QScrollView
but drawContents called automatically.
plz guide me...:confused:
Re: Subclassing QScrollView
Quote:
Originally Posted by sumsin
should I reimplement resizecontents() ?
And is my code of drawcontents sufficient?
I also attaching my ImageView.
why?
what actually you want to do ?
Re: Subclassing QScrollView
How about setting the image on a QLabel and placing the label inside the scroll view?
Re: Subclassing QScrollView
I actually want that at startup my widget opens in a default size and if the size of the image is larger than the size of viewport then it should show the scrollbars.
And when I resize the widget manually it should manage itself so that every time the image try to be in center.
Re: Subclassing QScrollView
Quote:
but drawContents called automatically.
yes. So call resizeContents in function where you get your pixmap.
Re: Subclassing QScrollView
Quote:
Originally Posted by munna
try resizeContents(yourpictureWidth,yourpictureHeight)
it must help you!
Re: Subclassing QScrollView
thanks
my scroll-bars now appear.
One thing when I send the arguments in resizecontents as mypicwidth and mypicheight, but it not seem that the widget size match these arguments.
Widget size is lesser.
And how i put the image in center.
Should I apply some transformation in drawcontents function but I am not exactly understanding the means of clipx, clipy, clipw and cliph.