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

List:       kde-devel
Subject:    Re: KSqueezedTextLabel in QTableView
From:       Stéphane_MANKOWSKI <stephane () mankowski ! fr>
Date:       2011-07-30 19:47:53
Message-ID: 201107302147.54045.stephane () mankowski ! fr
[Download RAW message or body]

Hi,

Such a shame! The solution is so simple !
Thank you very much.

Le Samedi 30 Juillet 2011 21:38:03, Christoph Feck a écrit :
> Does QAbstractItemView::setTextElideMode() help?
> 
> On Saturday 30 July 2011 12:14:17 Stéphane MANKOWSKI wrote:
> > Hi,
> > 
> > In Skrooge, we are using QTableView.
> > Sometimes, when the column is resized manually by the end user, we
> > are not able to see the end of the strings.
> > 
> > We would like to display string as KSqueezedTextLabel is able to
> > do. Here is a picture explaining the expected result.
> > 
> > 
> > I tried to add a QItemDelegate to my QTableView and to implement
> > paint function like this (Don't laugh!):
> > 
> > void SKGSplitTableDelegate::paint(QPainter *painter, const
> > QStyleOptionViewItem &option, const QModelIndex &index) const
> > {
> > 
> >     painter->save();
> >     KSqueezedTextLabel editor;
> >     editor.setText(index.model()->data(index,
> > 
> > Qt::UserRole).toString()); editor.setGeometry(option.rect);
> > 
> >     editor.render(painter);
> >     painter->restore();
> > 
> > }
> > 
> > But it doesn't work; the table is empty, so my paint function is
> > called but doesn't give the expected result.
> > 
> > Do you know how to do ?
> > Do you have an example of code ?
> > 
> > Thank you.
> > Regards,
> > Stéphane MANKOWSKI
 
>> 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