Bug 283572

Summary: Unreadable text on tooltips in KDE 4.7 [patch]
Product: [Applications] digikam Reporter: nucleo <nucleo>
Component: Usability-ThemesAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: caulier.gilles, cfeck, jrussell_88, j_kolberg11, photographer505-bug, rdieter
Priority: NOR    
Version: 2.2.0   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In: 2.4.0
Sentry Crash Report:
Attachments: Digikam 2.1.1 with
white text on black background
unreadable tooltips in libreoffice
patch to use QPalette::ToolTipText in place of QPalette::Text where appropriate

Description nucleo 2011-10-07 22:34:38 UTC
Created attachment 64324 [details]
Digikam 2.1.1 with 

Version:           2.1.1 (using KDE 4.7.1) 
OS:                Linux

Text on tooltips is unreadable in KDE 4.7 with Oxygen colors.

Reproducible: Always

Steps to Reproduce:
Enable tooltips for images in albums.

Actual Results:  
Black text in black tooltips is invisible.

Expected Results:  
Text should be visible.

The same problem in Digikam 2.2.0.

No such problem with Oxygen colors in KDE 4.6.
Comment 1 caulier.gilles 2011-10-08 11:18:47 UTC
All color in digiKam are relevant of KDE color scheme set in KDE control center.

Look into Settings/themes menu entry

Gilles Caulier
Comment 2 nucleo 2011-10-08 11:35:00 UTC
Created attachment 64335 [details]
white text on black background

(In reply to comment #1)
> All color in digiKam are relevant of KDE color scheme set in KDE control center.

There is default theme in Settings/themes (Oxygen).
But KDE applications such as systemsettings have tooltips with readable text (white on black background).
Comment 3 caulier.gilles 2011-10-08 11:40:49 UTC
Which KDE color theme you use exactly ? Oxygen ? Because it work fine here. Do you use a KDE global theme too, which assign also some colors to application?

Gilles Caulier
Comment 4 nucleo 2011-10-08 11:46:19 UTC
This is LiveCD with default settings in KDE 4.7.1.
Oxygen colors and Air desktop theme used there.
Comment 5 caulier.gilles 2011-10-08 13:17:10 UTC
Same for me here, and no problem... KDE 4.6.5.

Gilles Caulier
Comment 6 nucleo 2011-10-08 13:18:22 UTC
This problem appears in KDE 4.7, no such problem in 4.6.
Comment 7 Rex Dieter 2011-10-08 16:52:30 UTC
I can confirm (using digikam-2.1.1),
settings->themes->oxygen
makes popups (very close to) unreadble on kde-4.7.x.

pretty much any other theme works better (oxygen cold, for example).
Comment 8 Rex Dieter 2011-10-08 16:53:12 UTC
when I get a chance, I'll try to diff the kde-4.6 vs kde-4.7 oxygen color scheme
Comment 9 Marcel Wiesweg 2011-10-08 17:45:44 UTC
Please note there is no real custom drawing involved:

    {
        QStylePainter p(this);
        QStyleOptionFrame opt;
        opt.init(this);
        p.drawPrimitive(QStyle::PE_PanelTipLabel, opt);
    }

    QLabel::paintEvent(e);

code is mostly copied from Qt (we render some details ourselves, and the relevant Qt code is not public)
Comment 10 Rex Dieter 2011-11-21 21:06:39 UTC
OK, did some digging, and kde-4.7's Oxygen.colors changed a bit here,
https://projects.kde.org/projects/kde/kde-workspace/repository/revisions/602a3c2c9e0cb2a32184139adfd2fa1dcf712aeb

In particular, the [Colors:Tooltip] section's BackgroundNormal changed dramatically.  Poking oxygen folks to find out what's up with that.
Comment 11 Rex Dieter 2011-11-21 21:07:32 UTC
reassigning to oxygen for real this time, for feedback on comment #10
Comment 12 Rex Dieter 2011-11-21 21:24:08 UTC
As a matter of fact, perhaps the [Colors:Tooltip] BackgroundNormal and ForegroundNormal values were inadvertently swapped?  

swapping them back does indeed make things look much better again for me.
Comment 13 Christoph Feck 2011-11-21 21:26:45 UTC
Applications should render QPalette::ToolTipText on QPalette::ToolTipBase if they only support QPalette. Applications that support KColorScheme can use the additional roles valid for the tool tip's background. I see no bug in Oxygen themes.
Comment 14 nucleo 2011-11-21 21:38:16 UTC
Created attachment 65916 [details]
unreadable tooltips in libreoffice

The same problem with tooltips in Libreoffice with libreoffice-kde installed.
Comment 15 Rex Dieter 2011-11-21 21:38:46 UTC
Fair nuf, back to digikam then to implement the suggestion.
Comment 16 Christoph Feck 2011-11-21 21:47:44 UTC
nucleo, please report to libreoffice-kde developers (that's probably a distribution specific add-on). If they respect the KDE/Qt colors, they should respect all of them, not only the background.
Comment 17 Rex Dieter 2011-11-21 21:48:32 UTC
Heh, I even see a call in digikam's ditemtooltip.cpp with a commented out:
//setForegroundRole(QPalette:ToolTipText);
Comment 18 Christoph Feck 2011-11-21 21:51:08 UTC
You can also use http://opendesktop.org/content/show.php?content=90034 to check for hard coded black colors or wrong color role usage in applications. The tool tips with that theme have a light yellow background, but should also have a dark yellow (brown) text, not a black or blue one.
Comment 19 Hugo Pereira Da Costa 2011-11-21 22:41:27 UTC
So
Libreoffice issue is libreoffice bug (specific to -kde)
Digikam issue is digikam bug (right ?)
So closing as downstream.
Comment 20 nucleo 2011-11-21 22:46:02 UTC
But why closing bug against digikam without actual fix in digikam?
Comment 21 Christoph Feck 2011-11-21 22:58:39 UTC
Reopen, because it is still valid for digikam.
Comment 22 Hugo Pereira Da Costa 2011-11-21 22:59:35 UTC
sorry :) I thought it was reassigned to oxygen in the process :)
Been too quick at closing.
Comment 23 Rex Dieter 2011-11-22 01:25:08 UTC
Darn, per comment #17, uncommented the 
setForegroundRole(QPalette:ToolTipText);
call in libs/widgets/common/ditemtooltip.cpp , and rebuilt digikam, but it didnt seem to help any. :(
Comment 24 Christoph Feck 2011-11-22 08:50:52 UTC
Rex, can you check if changing QPalette::Text to QPalette::ToolTipText in the DToolTipStyleSheet constructor (same file) helps? (Only in the last four cases, because the first case correctly sets a background color, too.)
Comment 25 Christoph Feck 2011-11-22 08:52:57 UTC
DItemToolTip::renderArrows() also uses QPalette::Text, but not sure on which background they are rendered.
Comment 26 Rex Dieter 2011-11-22 13:22:22 UTC
preliminary results: win!  thanks!

I'll do a wee bit more testing, and post a patch shortly.
Comment 27 caulier.gilles 2011-11-22 13:27:40 UTC
Thanks in advance Rex

Gilles Caulier
Comment 28 Rex Dieter 2011-11-22 13:31:50 UTC
Created attachment 65930 [details]
patch to use QPalette::ToolTipText in place of QPalette::Text where appropriate

Here's a minimal patch that seems to fix all problems for me, tested under various color schemes on kde 4.7
Comment 29 caulier.gilles 2011-11-22 16:22:04 UTC
Git commit 007759d0a1d80d11c17a3cc005d80c803d0e9dfa by Gilles Caulier.
Committed on 22/11/2011 at 17:20.
Pushed by cgilles into branch 'master'.

apply patch #65930 from Rex Dieter
BUGS: 283572
BUGS: 265554

M  +4    -4    libs/widgets/common/ditemtooltip.cpp

http://commits.kde.org/digikam/007759d0a1d80d11c17a3cc005d80c803d0e9dfa
Comment 30 caulier.gilles 2012-02-01 07:34:02 UTC
*** Bug 292902 has been marked as a duplicate of this bug. ***
Comment 31 Rex Dieter 2012-04-24 13:48:22 UTC
*** Bug 281108 has been marked as a duplicate of this bug. ***
Comment 32 Rex Dieter 2012-04-24 13:48:54 UTC
*** Bug 298717 has been marked as a duplicate of this bug. ***