82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/syskit/gui/runtime_state.rb', line 82
def paint(painter, option, index)
painter.save
if (option.state & Qt::Style::State_Selected) != 0
painter.fill_rect(option.rect, option.palette.highlight)
painter.brush = option.palette.highlighted_text
end
main = index.data.toString
doc = index.data(Qt::UserRole).to_string || ''
text_bounds = Qt::Rect.new
fm = option.font_metrics
painter.draw_text(
Qt::Rect.new(option.rect.x + OUTER_MARGIN, option.rect.y + OUTER_MARGIN, option.rect.width - 2 * OUTER_MARGIN, fm.height),
Qt::AlignLeft, main, text_bounds)
font = painter.font
font.italic = true
painter.font = font
painter.draw_text(
Qt::Rect.new(option.rect.x + OUTER_MARGIN, text_bounds.bottom + INTERLINE, option.rect.width - 2 * OUTER_MARGIN, fm.height),
Qt::AlignLeft, doc, text_bounds)
ensure
painter.restore
end
|