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

Method paint

ui/stackwidget.cpp:313–347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311
312
313void DebugStackItemDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& idx) const
314{
315 painter->setFont(m_font);
316
317 bool selected = (option.state & QStyle::State_Selected) != 0;
318 if (selected)
319 painter->setBrush(getThemeColor(SelectionColor));
320 else
321 painter->setBrush(option.backgroundBrush);
322
323 painter->setPen(Qt::NoPen);
324
325 QRect textRect = option.rect;
326 textRect.setBottom(textRect.top() + m_charHeight + 2);
327 painter->drawRect(textRect);
328
329 auto data = idx.data(Qt::DisplayRole);
330 switch (idx.column())
331 {
332 case DebugStackListModel::OffsetColumn:
333 case DebugStackListModel::AddressColumn:
334 case DebugStackListModel::ValueColumn:
335 case DebugStackListModel::HintColumn:
336 {
337 auto tokenPair = data.toList();
338 if (tokenPair.size() == 0)
339 break;
340 painter->setPen(QColor((QRgb)tokenPair[0].toInt()));
341 painter->drawText(textRect, tokenPair[1].toString());
342 break;
343 }
344 default:
345 break;
346 }
347}
348
349
350void DebugStackItemDelegate::updateFonts()

Callers

nothing calls this directly

Calls 2

sizeMethod · 0.80
dataMethod · 0.45

Tested by

no test coverage detected