[Development] QPalette::Mid neglected?

Rafael Roquetto rafael.roquetto at kdab.com
Fri Jan 17 11:43:57 CET 2014


Hello Martin,

Good to hear that. I am looking forward to seeing this upstream. Do you have
the bug report number so I can also follow it?

Also, I appreciate that you attached your patch.

Thanks for the feedback.

Kind regards,
Rafael

On Thu, Jan 16, 2014 at 10:23:21PM +0100, Martin Koller wrote:
> On Wednesday 15 January 2014 18:16:12 Rafael Roquetto wrote:
> > Hello everyone,
> > 
> > I noticed that one program that I run displays a lot of black squares when it
> > shouldn't - I traced the problem down to the fact that, at least on this env
> > - KDE4 + Qt5 dev branch HEAD - QPalette::mid() returns QBrush(QColor(ARGB 1,
> >   0, 0, 0) , SolidPattern ), or black.
> > 
> > It seems that nowhere in the Qt source code the value of QPalette::Mid is being
> > set, apart from QWindowsTheme. In my case, the relevant class is QKdeTheme,
> > which does set a value for QPalette::Mid but only for the QPalette::Disabled
> > ColorGroup. Therefore, for the Active color group the value is defaulting to
> > black.
> > 
> > Is this intended behavior or should this be fixed? For more context, see
> > QKdeThemePrivate::readKdeSystemPalette() inside qgenericunixthemes.cpp.
> 
> What a coincidence - I just reported this as a bug to digia (we have commercial support)
> and I already provided a fix for this. They said they will push this to gerrit.
> 
> If you'd like to have a look at my solution, see attached patch.
> 
> -- 
> Best regards/Schöne Grüße
> 
> Martin
> A: Because it breaks the logical sequence of discussion
> Q: Why is top posting bad?
> 
> ()  ascii ribbon campaign - against html e-mail 
> /\  www.asciiribbon.org   - against proprietary attachments
> 
> Geschenkideen, Accessoires, Seifen, Kulinarisches: www.bibibest.at

> diff --git a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
> index ee295af..f44d53a 100644
> --- a/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
> +++ b/src/platformsupport/themes/genericunix/qgenericunixthemes.cpp
> @@ -317,19 +317,23 @@ void QKdeThemePrivate::readKdeSystemPalette(const QSettings &kdeSettings, QPalet
>      const QBrush buttonBrushDark = QBrush(button.darker(v > 128 ? 200 : 50));
>      const QBrush buttonBrushDark150 = QBrush(button.darker(v > 128 ? 150 : 75));
>      const QBrush buttonBrushLight150 = QBrush(button.lighter(v > 128 ? 150 : 75));
> +    const QBrush buttonBrushLight = QBrush(button.lighter(v > 128 ? 200 : 50));
>  
>      pal->setBrush(QPalette::Disabled, QPalette::WindowText, buttonBrushDark);
>      pal->setBrush(QPalette::Disabled, QPalette::ButtonText, buttonBrushDark);
>      pal->setBrush(QPalette::Disabled, QPalette::Button, buttonBrush);
> -    pal->setBrush(QPalette::Disabled, QPalette::Light, buttonBrushLight150);
> -    pal->setBrush(QPalette::Disabled, QPalette::Dark, buttonBrushDark);
> -    pal->setBrush(QPalette::Disabled, QPalette::Mid, buttonBrushDark150);
>      pal->setBrush(QPalette::Disabled, QPalette::Text, buttonBrushDark);
>      pal->setBrush(QPalette::Disabled, QPalette::BrightText, whiteBrush);
>      pal->setBrush(QPalette::Disabled, QPalette::Base, buttonBrush);
>      pal->setBrush(QPalette::Disabled, QPalette::Window, buttonBrush);
>      pal->setBrush(QPalette::Disabled, QPalette::Highlight, buttonBrushDark150);
>      pal->setBrush(QPalette::Disabled, QPalette::HighlightedText, buttonBrushLight150);
> +
> +    // set calculated colors for all groups
> +    pal->setBrush(QPalette::Light, buttonBrushLight);
> +    pal->setBrush(QPalette::Midlight, buttonBrushLight150);
> +    pal->setBrush(QPalette::Mid, buttonBrushDark150);
> +    pal->setBrush(QPalette::Dark, buttonBrushDark);
>  }
>  
>  /*!

> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development


-- 
Rafael Roquetto | rafael.roquetto at kdab.com | Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 4861 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140117/181809d1/attachment.bin>


More information about the Development mailing list