Core: Improved theme-awareness in application menu painting

Using theme colors rather than hard-coded ones and at the same some
simplification.

This is needed for an upcoming "Flat Light" theme.

Change-Id: I8a8715a16d1b246c5228978633143eb64d371701
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
This commit is contained in:
Alessandro Portale
2016-06-17 19:00:59 +02:00
committed by Alessandro Portale
parent 6750607244
commit 3b30617758
3 changed files with 20 additions and 13 deletions

View File

@@ -64,6 +64,18 @@ QColor StyleHelper::mergedColors(const QColor &colorA, const QColor &colorB, int
return tmp;
}
QColor StyleHelper::alphaBlendedColors(const QColor &colorA, const QColor &colorB)
{
const QRgb base = colorA.rgba();
const QRgb overlay = colorB.rgba();
const qreal overlayIntensity = qAlpha(overlay) / 255.0;
return qRgba(
qMin(qRed(base) + qRound(qRed(overlay) * overlayIntensity), 0xff),
qMin(qGreen(base) + qRound(qGreen(overlay) * overlayIntensity), 0xff),
qMin(qBlue(base) + qRound(qBlue(overlay) * overlayIntensity), 0xff),
qMin(qAlpha(base) + qAlpha(overlay), 0xff));
}
qreal StyleHelper::sidebarFontSize()
{
return HostOsInfo::isMacHost() ? 10 : 7.5;