[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: QListView and QDockWidget initial sizes
From:       "Kelvie Wong" <kelvie () ieee ! org>
Date:       2007-11-25 23:29:16
Message-ID: 94ccbe710711251529k25b162a3ncf06c7200fc5521 () mail ! gmail ! com
[Download RAW message or body]

Er, s/Row/Column (in a list view, just pass it zero for the column
index; also it returns an int rather than a QSize).

On Nov 25, 2007 3:07 PM, Kelvie Wong <kelvie@ieee.org> wrote:
> Use QListView::sizeHintForIndex() (or sizeHintForRow(), these are
> reimplemented from QAbstractItemView).
>
> Internally Qt uses a default delegate, but it doesn't return it, to
> show that it is still the default.
>
>
> On Nov 25, 2007 8:15 AM, Will Stephenson <wstephenson@kde.org> wrote:
> > In Kopete we're now using a QListView and custom model for the chat window's
> > members list.  This is added in a QDockWidget to the chat window, which is a
> > KXmlGuiWindow.
> >
> > I have the problem now that the members list prefers to consume very large
> > slice of the chatwindow by default.  From reading the QMainWindow and
> > QDockWidget docu, I understand that the initial sizes are given by a widget's
> > sizeHint(), however, I don't see how to change this robustly.
> >
> > I tried overriding sizeHint() in our ChatMembersListView - this works if I
> > change the horizontal size returned to a set value, but this solution is
> > hackish and fragile.  Ideally I want the listview to return a size which fits
> > its contents, no more.
> >
> > I tried to return a minimal sizeHint for the view with
> >
> > ·   int width = 0
> > ·   for ( int i = 0; i < model()->rowCount(); ++i )
> > ·   {
> > ·   ·   QAbstractItemDelegate * itd = itemDelegateForRow( i );
> > ·   ·   if ( itd )
> > ·   ·   ·   width = qmax( width, itd->sizeHint( viewOptions(), model()->index(
> > i, 0 ) ) );
> >
> > and so on but itd is always 0.
> >
> > Any hints?
> >
> > Will
> > --
> > Will Stephenson
> > IRC: Bille
> >
> > >> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
> >
>
>
>
> --
> Kelvie Wong
>



-- 
Kelvie Wong
 
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic