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

List:       kde-devel
Subject:    Re: KSqueezedTextLabel in QTableView
From:       Christoph Feck <christoph () maxiom ! de>
Date:       2011-07-30 19:38:03
Message-ID: 201107302138.04109.christoph () maxiom ! de
[Download RAW message or body]

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