MCPcopy Create free account
hub / github.com/Vector35/debugger / paint

Method paint

ui/registerswidget.cpp:326–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324
325
326void DebugRegistersItemDelegate::paint(
327 QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& idx) const
328{
329 painter->setFont(m_font);
330
331 bool selected = (option.state & QStyle::State_Selected) != 0;
332 if (selected)
333 painter->setBrush(getThemeColor(SelectionColor));
334 else
335 painter->setBrush(option.backgroundBrush);
336
337 painter->setPen(Qt::NoPen);
338
339 QRect textRect = option.rect;
340 textRect.setBottom(textRect.top() + m_charHeight + 2);
341 painter->drawRect(textRect);
342
343 auto data = idx.data(Qt::DisplayRole);
344 switch (idx.column())
345 {
346 case DebugRegistersListModel::NameColumn:
347 case DebugRegistersListModel::ValueColumn:
348 case DebugRegistersListModel::HintColumn:
349 {
350 auto tokenPair = data.toList();
351 if (tokenPair.size() == 0)
352 break;
353 painter->setPen(QColor((QRgb)tokenPair[0].toInt()));
354 painter->drawText(textRect, tokenPair[1].toString());
355 break;
356 }
357 default:
358 break;
359 }
360}
361
362
363void DebugRegistersItemDelegate::updateFonts()

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected