Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, August 2007
QWidget and scrolling


Message 1 in thread

Hi again,

I have a custom widget in which I draw an QImage in the paintEvent method 
(done so to have a good performance)

No I need to scroll this QWidget, but I don't know how to do this.
I have added the h/v Scrollbars and connected the signals.
But when calling scroll(dx, dy) in my widget it does nothing and I don't 
know what to do in the paintEvent to get my QImage scrolled.

Hope you can help me.

Regards,
Patrick 


--
 [ signature omitted ] 

Message 2 in thread

On mandag den 6. August 2007, Patrick Feistel wrote:
> Hi again,
>
> I have a custom widget in which I draw an QImage in the paintEvent method
> (done so to have a good performance)
>
> No I need to scroll this QWidget, but I don't know how to do this.
> I have added the h/v Scrollbars and connected the signals.
> But when calling scroll(dx, dy) in my widget it does nothing and I don't
> know what to do in the paintEvent to get my QImage scrolled.

Basic rule: Never instantiate QScrollBar yourself. There are exceptions to 
this rule, of course. But it's surprisingly correct.

Use QScrollArea.

Bo.

-- 
 [ signature omitted ] 

Message 3 in thread

Hi,

But I made a GUI with Qt Designer and I can't add a QScrollArea in Qt 
Designer...

Regards, Patrick

"Bo Thorsen" <bo@xxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag 
news:200708061548.49639.bo@xxxxxxxxxxxxxxxxxxxxxxxx
> On mandag den 6. August 2007, Patrick Feistel wrote:
>> Hi again,
>>
>> I have a custom widget in which I draw an QImage in the paintEvent method
>> (done so to have a good performance)
>>
>> No I need to scroll this QWidget, but I don't know how to do this.
>> I have added the h/v Scrollbars and connected the signals.
>> But when calling scroll(dx, dy) in my widget it does nothing and I don't
>> know what to do in the paintEvent to get my QImage scrolled.
>
> Basic rule: Never instantiate QScrollBar yourself. There are exceptions to
> this rule, of course. But it's surprisingly correct.
>
> Use QScrollArea.
>
> Bo.
>
> -- 
>
> Thorsen Consulting ApS - Qt consulting services
> http://www.thorsen-consulting.dk
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/ 


--
 [ signature omitted ] 

Message 4 in thread

On mandag den 6. August 2007, Patrick Feistel wrote:
> Hi,
>
> But I made a GUI with Qt Designer and I can't add a QScrollArea in Qt
> Designer...

Almost correct. So you have two options: Code that part of the user interface 
manually, or hack the designer file. The second option is done by putting a 
QWidget as the placeholder where you would place the QScrollArea. Then you 
use a text editor to replace the QWidget class with QScrollArea.

I really don't understand why QScrollArea isn't supported directly in 
designer.

Bo.

> "Bo Thorsen" <bo@xxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
> news:200708061548.49639.bo@xxxxxxxxxxxxxxxxxxxxxxxx
>
> > On mandag den 6. August 2007, Patrick Feistel wrote:
> >> Hi again,
> >>
> >> I have a custom widget in which I draw an QImage in the paintEvent
> >> method (done so to have a good performance)
> >>
> >> No I need to scroll this QWidget, but I don't know how to do this.
> >> I have added the h/v Scrollbars and connected the signals.
> >> But when calling scroll(dx, dy) in my widget it does nothing and I don't
> >> know what to do in the paintEvent to get my QImage scrolled.
> >
> > Basic rule: Never instantiate QScrollBar yourself. There are exceptions
> > to this rule, of course. But it's surprisingly correct.
> >
> > Use QScrollArea.
> >
> > Bo.
> >
> > --
> >
> > Thorsen Consulting ApS - Qt consulting services
> > http://www.thorsen-consulting.dk
> >
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> > "unsubscribe" in the subject or the body.
> > List archive and information: http://lists.trolltech.com/qt-interest/
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body. List archive and information:
> http://lists.trolltech.com/qt-interest/



-- 
 [ signature omitted ] 

Message 5 in thread

Hi again,
when displaying my widget in a QScrollArea it is impossible for me to hold 
my needed framerat of 14 Frames/sec.
When just displaying my widget and drawing the QImage (I got this as QImage 
so I don't need to convert to QPixmap) with the size 808x750px in paintEvent 
I have a Framerate of 14.3 Frames/sec.
With QScrollArea I got 10.5 Frames/sec.

Is there another possibility to scroll/optimize?

Regards,
Patrick

"Bo Thorsen" <bo@xxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag 
news:200708061555.26226.bo@xxxxxxxxxxxxxxxxxxxxxxxx
> On mandag den 6. August 2007, Patrick Feistel wrote:
>> Hi,
>>
>> But I made a GUI with Qt Designer and I can't add a QScrollArea in Qt
>> Designer...
>
> Almost correct. So you have two options: Code that part of the user 
> interface
> manually, or hack the designer file. The second option is done by putting 
> a
> QWidget as the placeholder where you would place the QScrollArea. Then you
> use a text editor to replace the QWidget class with QScrollArea.
>
> I really don't understand why QScrollArea isn't supported directly in
> designer.
>
> Bo.
>
>> "Bo Thorsen" <bo@xxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
>> news:200708061548.49639.bo@xxxxxxxxxxxxxxxxxxxxxxxx
>>
>> > On mandag den 6. August 2007, Patrick Feistel wrote:
>> >> Hi again,
>> >>
>> >> I have a custom widget in which I draw an QImage in the paintEvent
>> >> method (done so to have a good performance)
>> >>
>> >> No I need to scroll this QWidget, but I don't know how to do this.
>> >> I have added the h/v Scrollbars and connected the signals.
>> >> But when calling scroll(dx, dy) in my widget it does nothing and I 
>> >> don't
>> >> know what to do in the paintEvent to get my QImage scrolled.
>> >
>> > Basic rule: Never instantiate QScrollBar yourself. There are exceptions
>> > to this rule, of course. But it's surprisingly correct.
>> >
>> > Use QScrollArea.
>> >
>> > Bo.
>> >
>> > --
>> >
>> > Thorsen Consulting ApS - Qt consulting services
>> > http://www.thorsen-consulting.dk
>> >
>> > --
>> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>> > "unsubscribe" in the subject or the body.
>> > List archive and information: http://lists.trolltech.com/qt-interest/
>>
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>> "unsubscribe" in the subject or the body. List archive and information:
>> http://lists.trolltech.com/qt-interest/
>
>
>
> -- 
>
> Thorsen Consulting ApS - Qt consulting services
> http://www.thorsen-consulting.dk
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/ 


--
 [ signature omitted ] 

Message 6 in thread

Set the autoFillBackground property of your widget (assuming that your 
images don't have any non-opaque pixels), and try setting the 
WA_PaintOnScreen attribute to circumvent the backingstore (assuming that 
you don't want your images to shine through any widget that might be 
created on top of your image).


Volker

"Patrick Feistel" <Feistel@xxxxxxxxxx> wrote in message 
news:f97ad6$dmn$1@xxxxxxxxxxxxxxxxxxxxx
> Hi again,
> when displaying my widget in a QScrollArea it is impossible for me to 
> hold my needed framerat of 14 Frames/sec.
> When just displaying my widget and drawing the QImage (I got this as 
> QImage so I don't need to convert to QPixmap) with the size 808x750px in 
> paintEvent I have a Framerate of 14.3 Frames/sec.
> With QScrollArea I got 10.5 Frames/sec.
>
> Is there another possibility to scroll/optimize?
>
> Regards,
> Patrick
>
> "Bo Thorsen" <bo@xxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag 
> news:200708061555.26226.bo@xxxxxxxxxxxxxxxxxxxxxxxx
>> On mandag den 6. August 2007, Patrick Feistel wrote:
>>> Hi,
>>>
>>> But I made a GUI with Qt Designer and I can't add a QScrollArea in Qt
>>> Designer...
>>
>> Almost correct. So you have two options: Code that part of the user 
>> interface
>> manually, or hack the designer file. The second option is done by 
>> putting a
>> QWidget as the placeholder where you would place the QScrollArea. Then 
>> you
>> use a text editor to replace the QWidget class with QScrollArea.
>>
>> I really don't understand why QScrollArea isn't supported directly in
>> designer.
>>
>> Bo.
>>
>>> "Bo Thorsen" <bo@xxxxxxxxxxxxxxxxxxxxx> schrieb im Newsbeitrag
>>> news:200708061548.49639.bo@xxxxxxxxxxxxxxxxxxxxxxxx
>>>
>>> > On mandag den 6. August 2007, Patrick Feistel wrote:
>>> >> Hi again,
>>> >>
>>> >> I have a custom widget in which I draw an QImage in the paintEvent
>>> >> method (done so to have a good performance)
>>> >>
>>> >> No I need to scroll this QWidget, but I don't know how to do this.
>>> >> I have added the h/v Scrollbars and connected the signals.
>>> >> But when calling scroll(dx, dy) in my widget it does nothing and I 
>>> >> don't
>>> >> know what to do in the paintEvent to get my QImage scrolled.
>>> >
>>> > Basic rule: Never instantiate QScrollBar yourself. There are 
>>> > exceptions
>>> > to this rule, of course. But it's surprisingly correct.
>>> >
>>> > Use QScrollArea.
>>> >
>>> > Bo.
>>> >
>>> > --
>>> >
>>> > Thorsen Consulting ApS - Qt consulting services
>>> > http://www.thorsen-consulting.dk
>>> >
>>> > --
>>> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx 
>>> > with
>>> > "unsubscribe" in the subject or the body.
>>> > List archive and information: 
>>> > http://lists.trolltech.com/qt-interest/
>>>
>>> --
>>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
>>> "unsubscribe" in the subject or the body. List archive and 
>>> information:
>>> http://lists.trolltech.com/qt-interest/
>>
>>
>>
>> -- 
>>
>> Thorsen Consulting ApS - Qt consulting services
>> http://www.thorsen-consulting.dk
>>
>> --
>> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with 
>> "unsubscribe" in the subject or the body.
>> List archive and information: http://lists.trolltech.com/qt-interest/
>
> 


--
 [ signature omitted ] 

Message 7 in thread

> But I made a GUI with Qt Designer and I can't add a QScrollArea in Qt 
> Designer...

With Qt4.3 you can add a QScrollArea in Qt Designer. It is located at 
the bottom under "Containers".

-- 
 [ signature omitted ] 

Message 8 in thread

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
Bjoern Erik Nilsen a &eacute;crit&nbsp;:
<blockquote cite="mid46B72B80.5050204@xxxxxxxxxxxxx" type="cite"><br>
  <blockquote type="cite">But I made a GUI with Qt Designer and I can't
add a QScrollArea in Qt Designer...
    <br>
  </blockquote>
  <br>
With Qt4.3 you can add a QScrollArea in Qt Designer. It is located at
the bottom under "Containers".
  <br>
  <br>
</blockquote>
?????<br>
here screenshot of designer Qt4.3.0 installed on my pc (windows)<br>
don't see a qscrollarea in containers.<br>
<br>
Another thing.... I don't see the new QColumnView in the model/View doc.<br>
for example, in <a
 href="http://doc.trolltech.com/4.3/model-view-view.html";>view classes</a>
page, I don't see this view listed.<br>
maybe I did'nt search in the right place?<br>
<br>
<img alt="" src="cid:part1.04080903.09020801@xxxxxx"; height="526"
 width="266"><br>
<br>
</body>
</html>

JPEG image

JPEG image


Message 9 in thread

veronique.lefrere@xxxxxx wrote:
> Bjoern Erik Nilsen a écrit :
>>
>>> But I made a GUI with Qt Designer and I can't add a QScrollArea in Qt 
>>> Designer...
>>
>> With Qt4.3 you can add a QScrollArea in Qt Designer. It is located at 
>> the bottom under "Containers".
>>
> ?????
> here screenshot of designer Qt4.3.0 installed on my pc (windows)
> don't see a qscrollarea in containers.
> 

I guess he meant 4.4. You can find it in the Qt 4.4 snapshots.

Girish

--
 [ signature omitted ] 

Message 10 in thread

On mandag den 6. August 2007, Bo Thorsen wrote:
> On mandag den 6. August 2007, Patrick Feistel wrote:
> > Hi again,
> >
> > I have a custom widget in which I draw an QImage in the paintEvent method
> > (done so to have a good performance)

BTW, it's impossible to get good performance drawing QImage. If in any way 
possible, draw using QPixmap instead. The QPainter will do QImage->QPixmap 
conversion before drawing anyway.

Bo.

-- 
 [ signature omitted ]