Honor alpha for SH_Table_GridLineColor

Make sure to honor the alpha channel for the color returned by
SH_Table_GridLineColor.

Fixes: QTBUG-74909
Change-Id: If9688329e5e2ab41833dfeb7e6292fdfcbf63aa1
Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
Christian Ehrlicher 2019-10-21 21:23:08 +02:00
parent 14bb413309
commit 41702d8455
7 changed files with 7 additions and 7 deletions

View File

@ -2873,7 +2873,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = false;
break;
case SH_Table_GridLineColor:
ret = int(qt_mac_toQColor(NSColor.gridColor).rgb());
ret = int(qt_mac_toQColor(NSColor.gridColor).rgba());
break;
default:
ret = QCommonStyle::styleHint(sh, opt, w, hret);

View File

@ -2110,7 +2110,7 @@ int QWindowsVistaStyle::styleHint(StyleHint hint, const QStyleOption *option, co
break;
case SH_Table_GridLineColor:
if (option)
ret = int(option->palette.color(QPalette::Base).darker(118).rgb());
ret = int(option->palette.color(QPalette::Base).darker(118).rgba());
else
ret = -1;
break;

View File

@ -2589,7 +2589,7 @@ int JavaStyle::styleHint(StyleHint hint, const QStyleOption *option,
switch (hint) {
case SH_Table_GridLineColor: {
ret = static_cast<int>(option->palette.color(QPalette::Mid).rgb());
ret = static_cast<int>(option->palette.color(QPalette::Mid).rgba());
break;
}
case QStyle::SH_Menu_Scrollable:

View File

@ -1431,7 +1431,7 @@ void QTableView::paintEvent(QPaintEvent *event)
const bool showGrid = d->showGrid;
const int gridSize = showGrid ? 1 : 0;
const int gridHint = style()->styleHint(QStyle::SH_Table_GridLineColor, &option, this);
const QColor gridColor = static_cast<QRgb>(gridHint);
const QColor gridColor = QColor::fromRgba(static_cast<QRgb>(gridHint));
const QPen gridPen = QPen(gridColor, 0, d->gridStyle);
const QHeaderView *verticalHeader = d->verticalHeader;
const QHeaderView *horizontalHeader = d->horizontalHeader;

View File

@ -5143,7 +5143,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
case SH_Table_GridLineColor:
if (opt)
ret = opt->palette.color(QPalette::Mid).rgb();
ret = opt->palette.color(QPalette::Mid).rgba();
else
ret = -1;
break;

View File

@ -3733,7 +3733,7 @@ int QFusionStyle::styleHint(StyleHint hint, const QStyleOption *option, const QW
return 0;
case SH_Table_GridLineColor:
return option ? option->palette.window().color().darker(120).rgb() : 0;
return option ? option->palette.window().color().darker(120).rgba() : 0;
case SH_MessageBox_TextInteractionFlags:
return Qt::TextSelectableByMouse | Qt::LinksAccessibleByMouse;

View File

@ -1835,7 +1835,7 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SH_LineEdit_PasswordMaskDelay Determines the delay before visible character is masked
with password character, in milliseconds. This enum value was added in Qt 5.4.
\value SH_Table_GridLineColor The RGB value of the grid for a table.
\value SH_Table_GridLineColor The RGBA value of the grid for a table.
\value SH_UnderlineShortcut Whether shortcuts are underlined.