Bug 69121 - display in main window not refreshed when scrollbar disappears
Summary: display in main window not refreshed when scrollbar disappears
Status: RESOLVED FIXED
Alias: None
Product: kopete
Classification: Applications
Component: Main Application (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Kopete Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-11-27 06:03 UTC by Amit Shah
Modified: 2004-02-12 19:11 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Amit Shah 2003-11-27 06:03:36 UTC
Version:           0.7.93 (using KDE 3.1.93 (3.2 beta 1), compiled sources)
Compiler:          gcc version 3.3.2 (Debian)
OS:          Linux (i686) release 2.6.0-test10

1. Sort contacts by their online/offline status
2. Fold the 'offline contacts' folder
3. Expand it...
4. Scroll to the top of the window so that you see the online contacts and some offline contacts, make sure to resize the window height so that you get a vertical scroll bar
5. Fold the offline contacts folder, so that the scroll bar vanishes
6. Contacts which have big names (almost span till the horizontal width of the window) are garbled.
Comment 1 Jason Keirstead 2003-11-27 13:36:16 UTC
Subject: Re: [Kopete-devel]  New: display in main window not refreshed when scrollbar disappears

On November 27, 2003 1:03 am, Amit Shah wrote:
> 4. Scroll to the top of the window so that you see the online contacts and
> some offline contacts, make sure to resize the window height so that you
> get a vertical scroll bar
 5. Fold the offline contacts folder, so that the
> scroll bar vanishes 6. Contacts which have big names (almost span till the
> horizontal width of the window) are garbled.

You guys think this is a KListView bug or is it  due to our custom widget 
painting not being refreshed?

Comment 2 Martijn Klingens 2003-11-27 13:51:37 UTC
Subject: Re: [Kopete-devel]  display in main window not refreshed when scrollbar disappears

On Thursday 27 November 2003 13:36, Jason Keirstead wrote:
> You guys think this is a KListView bug or is it  due to our custom widget 
> painting not being refreshed?

Both are possible. One would need to dive deep in the Qt sources to figure out 
the order of events here, and I'm not sure Qt is at fault.

BTW, there's also the possibility that QScrollView is wrong here, which is the 
list view's base class.

Comment 3 Will Stephenson 2003-11-27 14:01:22 UTC
Subject: Re: [Kopete-devel]  display in main window not refreshed when scrollbar disappears

On Thursday 27 November 2003 12:36, Jason Keirstead wrote:
> You guys think this is a KListView bug or is it  due to our custom widget
> painting not being refreshed?

I'd say it's our painting.  Maybe our use of the KSqueezedTextLabel that draws 
squished MC names is wrong somewhere.  

The list is being redrawn when the offline contacts are folded at 5. because 
the contact icons are drawn in the correct position for the full width of the 
list where the scrollbar used to be, and I can see part of the wider MC names 
adjacent to the contact icons, but the narrower MC name used when the 
scrollbar is present is drawn on top.

Will

Comment 4 Olivier Goffart 2003-11-27 14:41:05 UTC
Another way to reproduce it is to show/hide offline user,

seems to be a QT bug, because the KopeteMetaContactLVI::painCell IS called, but only a part of the cell is drawn by QT.

(maybe we should tell QT that it needs to redraw the whole cell, and not only the new showed part)


Comment 5 Martijn Klingens 2003-11-27 15:05:03 UTC
Subject: Re: [Kopete-devel]  display in main window not refreshed when scrollbar disappears

On Thursday 27 November 2003 14:41, Olivier Goffart wrote:
> seems to be a QT bug, because the KopeteMetaContactLVI::painCell IS called,
> but only a part of the cell is drawn by QT.

That's not a bug, it's an optimization :)

> (maybe we should tell QT that it needs to redraw the whole cell, and not
> only the new showed part)

Yes, it's a Kopete bug then. We should explicitly tell the listview to do a 
full repaint when the view port's size changes. Now if I only knew which 
signal is the most appropriate for that...

Comment 6 Jason Keirstead 2004-01-06 04:00:41 UTC
I can't reproduce this bug in current CVS. Has it been fixed?
Comment 7 Olivier Goffart 2004-01-06 09:20:48 UTC
> I can't reproduce this bug in current CVS. Has it been fixed? 

What version of QT are you using ? 

(i still can reproduce it, it's with QT 3.2.x)
Comment 8 Matt Rogers 2004-01-28 14:31:38 UTC
no, it hasn't been fixed, and i looked into this a bit more, and it's definately a QT problem, but i'm not sure how to fix it yet. 
Comment 9 Matt Rogers 2004-02-04 05:05:36 UTC
or, could we call QListView::triggerUpdate() at the end of our drawing code?
Comment 10 Richard Smith 2004-02-12 17:45:11 UTC
From the QListView constructor's documentation:

Performance is boosted by modifying the widget flags f so that only part of the QListViewItem children is redrawn. This may be unsuitable for custom QListViewItem classes, in which case WStaticContents and WNoAutoErase should be cleared.

I've tried that. It doesn't seem to make any difference.
Comment 11 Richard Smith 2004-02-12 18:39:33 UTC
Got a fix here.
Comment 12 Richard Smith 2004-02-12 19:11:22 UTC
CVS commit by lilachaze: 

Make sure listview items aren't mispainted when the scrollbar appears /
disappears. Work around a Qt bug preventing same.
CCMAIL: 69121@bugs.kde.org


  M +8 -0      kopetecontactlistview.cpp   1.73


--- kdenetwork/kopete/kopete/contactlist/kopetecontactlistview.cpp  #1.72:1.73
@@ -309,4 +309,12 @@ KopeteContactListView::KopeteContactList
         setDropHighlighter( true );
         setSelectionMode( QListView::Extended );
+
+        clearWFlags( WStaticContents | WNoAutoErase );
+
+        // clear the appropriate flags from the viewport - qt docs say we have to mask
+        // these flags out of the QListView to make weirdly painted list items work, but
+        // that doesn't do the job. this does.
+        class MyWidget : public QWidget { public: QWidget::clearWFlags; };
+        static_cast<MyWidget*>( viewport() )->clearWFlags( WStaticContents | WNoAutoErase );
 }
 


Comment 13 Richard Smith 2004-02-12 19:11:43 UTC
CVS commit by lilachaze: 

Make sure listview items aren't mispainted when the scrollbar appears /
disappears. Work around a Qt bug preventing same. [BACKPORT]
CCMAIL: 69121-done@bugs.kde.org


  M +8 -0      kopetecontactlistview.cpp   1.63.2.3


--- kdenetwork/kopete/kopete/contactlist/kopetecontactlistview.cpp  #1.63.2.2:1.63.2.3
@@ -285,4 +285,12 @@ KopeteContactListView::KopeteContactList
         setDropHighlighter( true );
         setSelectionMode( QListView::Extended );
+
+        clearWFlags( WStaticContents | WNoAutoErase );
+
+        // clear the appropriate flags from the viewport - qt docs say we have to mask
+        // these flags out of the QListView to make weirdly painted list items work, but
+        // that doesn't do the job. this does.
+        class MyWidget : public QWidget { public: QWidget::clearWFlags; };
+        static_cast<MyWidget*>( viewport() )->clearWFlags( WStaticContents | WNoAutoErase );
 }