Bug 290536 - selection marker and filename disappear in certain styles
Summary: selection marker and filename disappear in certain styles
Status: RESOLVED FIXED
Alias: None
Product: dolphin
Classification: Applications
Component: view-engine: general (show other bugs)
Version: 16.12.2
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: Peter Penz
URL:
Keywords:
: 290722 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-01-03 21:53 UTC by Jonathan Marten
Modified: 2012-01-14 10:31 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.8.0


Attachments
Screen shot - Oxygen style (14.36 KB, image/png)
2012-01-03 21:57 UTC, Jonathan Marten
Details
Screen shot - Phase style (11.94 KB, image/png)
2012-01-03 21:57 UTC, Jonathan Marten
Details
Screen shot - Cleanlooks style (11.89 KB, image/png)
2012-01-03 21:58 UTC, Jonathan Marten
Details
Proposed patch (640 bytes, patch)
2012-01-05 16:31 UTC, Christoph Feck
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Marten 2012-01-03 21:53:09 UTC
Version:           unspecified (using Devel) 
OS:                Linux

When using certain widget styles (but not changing any other settings), the marking of selected files is sometimes incorrect.  With some of them the file name disappears when the focus is moved there (via the arrow keys) or when the file is selected (via Ctrl-LMB click), with others no selection marker (highlighted background) is shown.

These are the results obtained with all of the styles included as standard in current trunk (with kdeartwork).  File manager started with the command "konqueror --style STYLE ~" or "dolphin --style STYLE ~", the results are identical whether konqueror or dolphin is used.  Files are selected by Ctrl-LMB clicking on them.

Style         Selection    Focus     Filename shown when
              highlight?   frame?    focussed or selected?

CDE             no           no        no
Cleanlooks      no           no        no                  (see screenshot 3)
MS Windows 9x   no           no        no
Motif           no           no        no
Oxygen          yes          yes       yes                 (see screenshot 1)
Phase           no           yes       no                  (see screenshot 2)
Plastique       no           no        no

It appears that Oxygen is the only style that is correct.

All other application GUI elements are correct as would be expected for the style.


Reproducible: Always

Steps to Reproduce:
Run Konqueror or Dolphin as a file manager with the style selected.


Actual Results:  
Display of focussed and/or selected files is incorrect as above.


Expected Results:  
Focus frame, selection highlight and file name should be shown.


Configured colours: black text on white background, selection colour green.
Icon theme: Oxygen.
"Show selection marker" is turned off.

This problem has been present for at least a month in master branch (kdelibs 4.7 and recently 4.8), maybe longer.
Comment 1 Jonathan Marten 2012-01-03 21:57:10 UTC
Created attachment 67414 [details]
Screen shot - Oxygen style
Comment 2 Jonathan Marten 2012-01-03 21:57:39 UTC
Created attachment 67415 [details]
Screen shot - Phase style
Comment 3 Jonathan Marten 2012-01-03 21:58:03 UTC
Created attachment 67416 [details]
Screen shot - Cleanlooks style
Comment 4 Jonathan Marten 2012-01-05 14:37:41 UTC
For the focus rectangle not being shown, it may be that Dolphin is abusing the Qt style system.  KItemListWidget::paint() creates

QStyleOptionViewItemV4 viewItemOption;

and uses it in

style()->drawPrimitive(QStyle::PE_FrameFocusRect, &viewItemOption, painter, widget);

But in qcommonstyle and qwindowsstyle (which all of the problem styles inherit), there is code such as:

case PE_FrameFocusRect:
  if (const QStyleOptionFocusRect *fropt = qstyleoption_cast<const QStyleOptionFocusRect *>(opt)) {
// draw the element
}
// otherwise do nothing

The qstyleoption_cast will fail because the option is expected to be a QStyleOptionFocusRect, not a QStyleOptionViewItem.  So nothing gets drawn. Oxygen does not check the type of the option passed to it and so works as intended.
Comment 5 Christoph Feck 2012-01-05 16:31:06 UTC
Created attachment 67485 [details]
Proposed patch

Right, the focus frame should use QStyleOptionFocusRect. The other bug is that dolphin does not set "icon" and "text" in the viewItemOption, so that the style does not render the backgrounds for those items. Attached patch fixes that.
Comment 6 Peter Penz 2012-01-05 18:18:21 UTC
*** Bug 290722 has been marked as a duplicate of this bug. ***
Comment 7 Peter Penz 2012-01-05 19:15:08 UTC
Git commit 0a5a29a5e981446002f0f61b33dfd30c8c0a179a by Peter Penz.
Committed on 05/01/2012 at 20:13.
Pushed by ppenz into branch 'KDE/4.8'.

Fix style-issues in items when not using Oxygen

Thanks to Jonathan Marten and Christoph Feck for the analyses
and the patch.

Still open: The focus frame in cleanlooks is not drawn.

M  +8    -8    dolphin/src/kitemviews/kitemlistwidget.cpp

http://commits.kde.org/kde-baseapps/0a5a29a5e981446002f0f61b33dfd30c8c0a179a
Comment 8 Peter Penz 2012-01-05 19:18:37 UTC
Git commit af93bc46bcc63a48ae67db8f651283eb671a0d46 by Peter Penz.
Committed on 05/01/2012 at 20:13.
Pushed by ppenz into branch 'master'.

Fix style-issues in items when not using Oxygen

Thanks to Jonathan Marten and Christoph Feck for the analyses
and the patch.

Still open: The focus frame in cleanlooks is not drawn.

M  +8    -8    dolphin/src/kitemviews/kitemlistwidget.cpp

http://commits.kde.org/kde-baseapps/af93bc46bcc63a48ae67db8f651283eb671a0d46
Comment 9 Peter Penz 2012-01-05 19:22:26 UTC
Thanks Jonathan and Christoph for your hints. It seems to work quite well now, except that in Cleanlooks no focus frame is visible. I tried a few things but did not succeed yet - probably you have a further hint what might be missing, but I currently will continue with fixing other issues for the 2.0 release (I think the current state of this issue is acceptable). Also I could not test the Phase style which I don't have installed.
Comment 10 Christoph Feck 2012-01-05 21:31:17 UTC
focusRectOption.state |= State_KeyboardFocusChange;

The idea is that the focus frame should only be visible when the user is actually using the keyboard to change the focus, so when clicking on an item, there is no need to indicate where you are, because you "see where you clicked". I guess the behaviour of the GNOME platform is to supress the focus frame for this case, and Qt respects this behavior in the Cleanlooks style.

So if you want to respect that behavior, too, you would only add that flag to the option.state, if the focus was changed by keyboard (for example, if you tabbed into the view), but I guess it simplest and sufficient to always set it.
Comment 11 Peter Penz 2012-01-05 22:01:25 UTC
Ah, thanks Christoph :-) Will take care for this on the weekend. I'd say as long as the default KDE style does not care about the keyboard state I'll use the simple approach at is unrealistic that I've enough time to check possible issues that are related to the keyboard focus.
Comment 12 Peter Penz 2012-01-14 10:30:55 UTC
Git commit 9362ba151ecfd849f15661df68a9a995809619bd by Peter Penz.
Committed on 14/01/2012 at 11:29.
Pushed by ppenz into branch 'KDE/4.8'.

Fix current-item indicator in combination with the cleanlooks style

Thanks to Christoph Feck for the hint.
FIXED-IN: 4.8.0

M  +1    -1    dolphin/src/kitemviews/kitemlistwidget.cpp

http://commits.kde.org/kde-baseapps/9362ba151ecfd849f15661df68a9a995809619bd
Comment 13 Peter Penz 2012-01-14 10:31:25 UTC
Git commit cc2f06882c9ddc587f792088a0e4503d1f17f10f by Peter Penz.
Committed on 14/01/2012 at 11:29.
Pushed by ppenz into branch 'master'.

Fix current-item indicator in combination with the cleanlooks style

Thanks to Christoph Feck for the hint.
FIXED-IN: 4.8.0

M  +1    -1    dolphin/src/kitemviews/kitemlistwidget.cpp

http://commits.kde.org/kde-baseapps/cc2f06882c9ddc587f792088a0e4503d1f17f10f