Skip to content

Commit

Permalink
Report.report_table: Fix view's headers to be bold
Browse files Browse the repository at this point in the history
  • Loading branch information
nikicc committed Oct 10, 2017
1 parent bee63b7 commit aa50fb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
4 changes: 4 additions & 0 deletions Orange/canvas/report/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
padding: 2px 6px 2px 6px;
}

th {
font-weight: bold;
}

@media screen {
td, th {
white-space: nowrap;
Expand Down
8 changes: 5 additions & 3 deletions Orange/canvas/report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,10 @@ def data(role=Qt.DisplayRole,
orientation, role)
return model.data(model.index(row, col), role)

in_header = row is None or col is None

selected = (view.selectionModel().isSelected(model.index(row, col))
if view and row is not None and col is not None else False)
if view and not in_header else False)

fgcolor = data(Qt.ForegroundRole)
fgcolor = (QBrush(fgcolor).color().name()
Expand All @@ -241,7 +243,7 @@ def data(role=Qt.DisplayRole,
bgcolor = 'transparent'

font = data(Qt.FontRole)
weight = 'bold' if font and font.bold() else 'normal'
weight = 'bold' if (font and font.bold()) or in_header else 'normal'

alignment = data(Qt.TextAlignmentRole) or Qt.AlignLeft
halign = ('left' if alignment & Qt.AlignLeft else
Expand All @@ -257,7 +259,7 @@ def data(role=Qt.DisplayRole,
'font-weight:{weight};'
'text-align:{halign};'
'vertical-align:{valign};">{text}</{tag}>'.format(
tag='th' if row is None or col is None else 'td',
tag='th' if in_header else 'td',
border='1px solid black' if selected else '0',
text=data() or '', weight=weight, fgcolor=fgcolor,
bgcolor=bgcolor, halign=halign, valign=valign))
Expand Down

0 comments on commit aa50fb3

Please sign in to comment.