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

List:       kde-core-devel
Subject:    Re: Bug in KListViewItem::paintCell
From:       David Faure <david () mandrakesoft ! com>
Date:       2001-06-15 19:02:41
[Download RAW message or body]

On Friday 15 June 2001 21:52, Antonio Larrosa Jiménez wrote:

> Hello,
> 
> Could someone please have a look to KListViewItem::paintCell ?
> I'd say the problem I reported some days ago in this list seems to be 
> there. It uses :
> 
>   const QPixmap *pm = listView()->viewport()->backgroundPixmap();
>   if (pm && !pm->isNull())
>         _cg.setBrush(QColorGroup::Base, QBrush(backgroundColor(), *pm));
> 
> and I'd say that that's why it only paints the beginning of the background 
> pixmap in each listview item (unless QColorGroup does some magic to get 
> the offset from the contents instead of from the viewport which doesn't 
> seem to work).

QColorGroup does no such magic, it's only a container for colors :)

What you want is usually something like
    QPainter p( viewport() );
    p.translate( -contentsX(), -contentsY() );
    p.setBrushOrigin( -contentsX(), -contentsY() );

(Well, maybe only the last line in the case of paintCell()).

-- 
Per his initials, God was simply a "Good Oop Developer".
-- Richard Bos

David FAURE, david@mandrakesoft.com, faure@kde.org
http://perso.mandrakesoft.com/~david/, http://www.konqueror.org/
KDE, Making The Future of Computing Available Today

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

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