Bug 296782 - Drawing of QStyle::CE_Header with probably wrong clipping rectangle
Summary: Drawing of QStyle::CE_Header with probably wrong clipping rectangle
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: view-engine: general (show other bugs)
Version: 2.0
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-25 21:10 UTC by Peter Penz
Modified: 2012-04-01 14:47 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.9.0
Sentry Crash Report:


Attachments
Correct case without horizontal scrolling (31.90 KB, image/png)
2012-03-25 21:10 UTC, Peter Penz
Details
Incorrect case with horizontal scrolling (35.60 KB, image/png)
2012-03-25 21:10 UTC, Peter Penz
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Penz 2012-03-25 21:10:01 UTC
Created attachment 69891 [details]
Correct case without horizontal scrolling

Dolphin uses QGraphicsView internally for its new view-engine. When the details-view is turned on, Dolphin internally needs to implement a custom "header" for the columns and it does it in a similar way like the QWidget-based QListView from Qt by doing a

  style()->drawControl(QStyle::CE_Header, &option, painter, widget);

However when horizontally moving the content, it seems that Oxygen uses a wrong clipping rectangle (see screenshot). The issue does not occur if e.g. Plastique is used. Also manually drawing a rectangle instead works fine. So to me it looks like an issue in the Oxygen-style but probably it is Dolphin's fault because some information is not passed or something like that... Anyhow: Any feedback would be very welcome :-)

To reproduce:
- Open Dolphin
- Switch to "details view" (-> name, size and date is shown per default)
- Increase the width of the name-column so that the size- and date-column are only partly visible and a horizontal scrollbar is shown
- Scroll to the right

Expected result:
The header of size and date is drawn correctly

Actual result:
The header background stays white
Comment 1 Peter Penz 2012-03-25 21:10:33 UTC
Created attachment 69892 [details]
Incorrect case with horizontal scrolling
Comment 2 Peter Penz 2012-03-25 21:15:57 UTC
@Hugo: I forgot: The drawing is done inside kde-baseapps/dolphin/src/kitemviews/kitemlistheaderwidget.cpp in the method KItemListHeaderWidget::paintRole()

https://projects.kde.org/projects/kde/kde-baseapps/repository/revisions/master/entry/dolphin/src/kitemviews/kitemlistheaderwidget.cpp#L364

Probably you already see whether this is fine or not. Thanks!
Comment 3 Hugo Pereira Da Costa 2012-03-26 12:54:48 UTC
Hello Peter,
Interestingly, I can only reproduce the issue with kde-baseapps from trunk, and not from 3176142509e8be1100135c0a3919975f9d05ca9e
(which is the revision I had before today's update).

This with the same (latest) version of oxygen (via kde-workspace)

Is it a "known" addition to the code, or a regression ? 

Anyway, 
after looking at the code, the issue comes from the fact that the header background is not repainted when scrollbar moves (nor when the window is resized). This has no impact on styles that paint a flat background on the header (as plastique), and paint it on the entire widget, even its hidden parts.

It does impact oxygen, because we don't paint on hidden regions, in order to have the background "synchronized" with the main background
(see: http://wstaw.org/m/2012/03/26/plasma-desktopGw2691.png)

I can have a work around in oxygen (forcing the painting also on the "invisible" part, but you would still have issues such as in "http://wstaw.org/m/2012/03/26/plasma-desktopcN2691.png"
(see the desynchronized background)

This, I have no way to fix in oxygen (since I get no repaint events).
So I would prefer dolphin to call more repaint events, than oxygen adding not so correct workarounds. 
Especially since "normal" list views behave the right way ... 

Feedback welcome
Comment 4 Peter Penz 2012-03-26 13:08:36 UTC
Thanks Hugo for your feedback - please give me a little bit time to check what I can do on Dolphin side (your hints are already very useful). I'm reassigning it back to Dolphin and will let you know if I found a solution :-)
Comment 5 Hugo Pereira Da Costa 2012-03-26 13:11:23 UTC
Sounds good ! keep me posted !
Comment 6 Christoph Feck 2012-03-27 23:38:31 UTC
From what I can see, QTreeView puts its QHeaderView in the margin section (see QAbstractScrollArea::setViewportMargins). I am not sure if it is scrolled together, independently, or not at all (i.e. only repainted at a new position). Will check later.
Comment 7 Peter Penz 2012-03-31 08:38:20 UTC
@Hugo + Christoph: Just a short update - I could resolve the issue on Dolphin side but need to fix some related issues first before committing the patch. The trick was to not move the position of the header-widget itself but to just change the x-alignment of the column-headers. So now the header-widget itself won't change its position when doing a horizontal scrolling, only the content is adjusted.
Comment 8 Peter Penz 2012-04-01 14:47:22 UTC
Git commit 270e0c3e489218ae5543c72e5ec643ba2ee9de3a by Peter Penz.
Committed on 01/04/2012 at 16:42.
Pushed by ppenz into branch 'master'.

Allow showing Nepomuk metadata inside views

Metadata like image-size, rating, comments, tags, ... can be shown
now in the view (e.g. as column in the Details mode).

Still open: The rating-information needs to be shown as stars.

In the context of this feature also the following bugs have been
fixed:
- Fix visual glitches in the header of the Details mode
- Improve the minimum column width calculation to respect also
  the headling and not only the content
FIXED-IN: 4.9.0

M  +11   -9    dolphin/src/CMakeLists.txt
M  +60   -63   dolphin/src/kitemviews/kfileitemlistwidget.cpp
M  +10   -11   dolphin/src/kitemviews/kfileitemlistwidget.h
M  +35   -35   dolphin/src/kitemviews/kfileitemmodel.cpp
M  +10   -0    dolphin/src/kitemviews/kfileitemmodel.h
M  +36   -0    dolphin/src/kitemviews/kfileitemmodelrolesupdater.cpp
M  +8    -0    dolphin/src/kitemviews/kfileitemmodelrolesupdater.h
M  +20   -10   dolphin/src/kitemviews/kitemlistheaderwidget.cpp
M  +4    -0    dolphin/src/kitemviews/kitemlistheaderwidget_p.h
M  +27   -13   dolphin/src/kitemviews/kitemlistview.cpp
A  +153  -0    dolphin/src/kitemviews/knepomukrolesprovider.cpp     [License: GPL (v2+)]
A  +66   -0    dolphin/src/kitemviews/knepomukrolesprovider_p.h     [License: GPL (v2+)]
M  +24   -0    dolphin/src/settings/additionalinfodialog.cpp
M  +1    -0    dolphin/src/views/dolphinitemlistcontainer.cpp
M  +25   -2    dolphin/src/views/dolphinview.cpp
M  +21   -0    dolphin/src/views/dolphinviewactionhandler.cpp

http://commits.kde.org/kde-baseapps/270e0c3e489218ae5543c72e5ec643ba2ee9de3a