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

Qt-interest Archive, September 2007
How to put a header into a QScrollViewArea?


Message 1 in thread

I have my own QWidget representing a week view calendar. I putted  
this widget into a QScrollViewArea and I want to have an header which  
still on the top of the scrollview even when the user scroll. Is it a  
clean way to do that?

I use Qt 4.2.2.

Thanks in advance.
____________________________________________________________

   Johnny Mariethoz
   IDIAP,  P.O. Box 592, CH-1920 Martigny, Switzerland
   voice: +41 27 721 77 44,  fax: +41 27 721 77 12
   Johnny.Mariethoz@xxxxxxxx: http://www.idiap.ch/~marietho
   UKCH le groupe           : http://www.ukch.net
   Stephane Borgeaud Band   : http://www.stephaneborgeaud.ch
____________________________________________________________


--
 [ signature omitted ] 

Message 2 in thread

Put a vertical layout in the widget, then add your header widget (fixed
height) at top and the scroll view at the bottom.

The simple rule is, don't try to put everything in one widget. Break it up
into logical pieces and use layouts.

Keith
**Please do not reply to me, reply to the list.**

On 09-03-2007 12:53 PM, "Johnny Mariethoz" wrote:

> I have my own QWidget representing a week view calendar. I putted
> this widget into a QScrollViewArea and I want to have an header which
> still on the top of the scrollview even when the user scroll. Is it a
> clean way to do that?
> 
> I use Qt 4.2.2.
> 
> Thanks in advance.
> ____________________________________________________________
> 
>    Johnny Mariethoz
>    IDIAP,  P.O. Box 592, CH-1920 Martigny, Switzerland
>    voice: +41 27 721 77 44,  fax: +41 27 721 77 12
>    Johnny.Mariethoz@xxxxxxxx: http://www.idiap.ch/~marietho
>    UKCH le groupe           : http://www.ukch.net
>    Stephane Borgeaud Band   : http://www.stephaneborgeaud.ch
> ____________________________________________________________
> 
> 
> --
> 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 3 in thread

Ok,

but if I do that the width() of my header will be different of the  
width() of the QScrollArea content, no? In this case I need to find  
the width() of the scrollbar + some margin value which is probably  
different from one operating system to the other.
Am I right?

On Sep 3, 2007, at 20:19 PM, Keith Esau wrote:

> Put a vertical layout in the widget, then add your header widget  
> (fixed
> height) at top and the scroll view at the bottom.
>
> The simple rule is, don't try to put everything in one widget.  
> Break it up
> into logical pieces and use layouts.
>
> Keith
> **Please do not reply to me, reply to the list.**
>
> On 09-03-2007 12:53 PM, "Johnny Mariethoz" wrote:
>
>> I have my own QWidget representing a week view calendar. I putted
>> this widget into a QScrollViewArea and I want to have an header which
>> still on the top of the scrollview even when the user scroll. Is it a
>> clean way to do that?
>>
>> I use Qt 4.2.2.
>>
>> Thanks in advance.
>> ____________________________________________________________
>>
>>    Johnny Mariethoz
>>    IDIAP,  P.O. Box 592, CH-1920 Martigny, Switzerland
>>    voice: +41 27 721 77 44,  fax: +41 27 721 77 12
>>    Johnny.Mariethoz@xxxxxxxx: http://www.idiap.ch/~marietho
>>    UKCH le groupe           : http://www.ukch.net
>>    Stephane Borgeaud Band   : http://www.stephaneborgeaud.ch
>> ____________________________________________________________
>>
>>
>> --
>> 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/

____________________________________________________________

   Johnny Mariethoz
   IDIAP,  P.O. Box 592, CH-1920 Martigny, Switzerland
   voice: +41 27 721 77 44,  fax: +41 27 721 77 12
   Johnny.Mariethoz@xxxxxxxx: http://www.idiap.ch/~marietho
   UKCH le groupe           : http://www.ukch.net
   Stephane Borgeaud Band   : http://www.stephaneborgeaud.ch
____________________________________________________________


--
 [ signature omitted ] 

Message 4 in thread

You can get the width of the vertical scroll bar from

    QAbstractScrollArea::verticalScrollBar()->width();

I can think of several ways to fix the issue of where to start the header
widget, including using another scroll area with no scroll bars and synced
to the bottom scroll area. However, the ultimate solution is your job. :)

Keith
**Please do not reply to me, reply to the list.**


On 09-03-2007 1:32 PM, "Johnny Mariethoz" wrote:

> Ok,
> 
> but if I do that the width() of my header will be different of the
> width() of the QScrollArea content, no? In this case I need to find
> the width() of the scrollbar + some margin value which is probably
> different from one operating system to the other.
> Am I right?
> 
> On Sep 3, 2007, at 20:19 PM, Keith Esau wrote:
> 
>> Put a vertical layout in the widget, then add your header widget
>> (fixed
>> height) at top and the scroll view at the bottom.
>> 
>> The simple rule is, don't try to put everything in one widget.
>> Break it up
>> into logical pieces and use layouts.
>> 
>> Keith
>> **Please do not reply to me, reply to the list.**
>> 
>> On 09-03-2007 12:53 PM, "Johnny Mariethoz" wrote:
>> 
>>> I have my own QWidget representing a week view calendar. I putted
>>> this widget into a QScrollViewArea and I want to have an header which
>>> still on the top of the scrollview even when the user scroll. Is it a
>>> clean way to do that?
>>> 
>>> I use Qt 4.2.2.
>>> 
>>> Thanks in advance.
>>> ____________________________________________________________
>>> 
>>>    Johnny Mariethoz
>>>    IDIAP,  P.O. Box 592, CH-1920 Martigny, Switzerland
>>>    voice: +41 27 721 77 44,  fax: +41 27 721 77 12
>>>    Johnny.Mariethoz@xxxxxxxx: http://www.idiap.ch/~marietho
>>>    UKCH le groupe           : http://www.ukch.net
>>>    Stephane Borgeaud Band   : http://www.stephaneborgeaud.ch
>>> ____________________________________________________________


--
 [ signature omitted ] 

Message 5 in thread

Johnny Mariethoz wrote:

> I have my own QWidget representing a week view calendar. I putted
> this widget into a QScrollViewArea and I want to have an header which
> still on the top of the scrollview even when the user scroll. Is it a
> clean way to do that?
Since Qt itself does it as well, why don't you use the Force and read the
Source? Qt has several classes that support headers and that are derived
from QScrollArea (I can't find a QScrollViewArea in the Qt docs). However,
I think QAbstractScrollArea::setViewportMargins would be a good start. It
seems to allow to make some space between the scrolled widget and the
frame, where you may put a header. There is even a special widget for that
(QHeaderView).

Regards,

André
-- 
 [ signature omitted ]