Skip to content

Commit e996094

Browse files
committed
Report.report_table: Fix view's headers to be bold
1 parent bee63b7 commit e996094

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

Orange/canvas/report/report.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -227,8 +227,10 @@ def data(role=Qt.DisplayRole,
227227
orientation, role)
228228
return model.data(model.index(row, col), role)
229229

230+
in_header = row is None or col is None
231+
230232
selected = (view.selectionModel().isSelected(model.index(row, col))
231-
if view and row is not None and col is not None else False)
233+
if view and not in_header else False)
232234

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

243245
font = data(Qt.FontRole)
244-
weight = 'bold' if font and font.bold() else 'normal'
246+
weight = 'bold' if (font and font.bold()) or in_header else 'normal'
245247

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

0 commit comments

Comments
 (0)