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

Method paint

ui/threadframes.cpp:292–360  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

290
291
292void ThreadFramesItemDelegate::paint(
293 QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& idx) const
294{
295 bool selected = (option.state & QStyle::State_Selected) != 0;
296 if (selected)
297 painter->setBrush(getThemeColor(SelectionColor));
298 else
299 painter->setBrush(option.backgroundBrush);
300
301 painter->setPen(Qt::NoPen);
302 painter->setFont(m_font);
303
304 QRect textRect = option.rect;
305 textRect.setBottom(textRect.top() + m_charHeight + 2);
306 painter->drawRect(textRect);
307
308 auto data = idx.data(Qt::DisplayRole);
309 switch (idx.column())
310 {
311 case ThreadFrameModel::StateColumn:
312 {
313 painter->setPen(option.palette.color(QPalette::WindowText).rgba());
314 painter->drawText(textRect, data.toString());
315 break;
316 }
317 case ThreadFrameModel::ThreadColumn:
318 {
319 // make thread column bold, if this is active thread
320 FrameItem* threadItem = static_cast<FrameItem*>(idx.internalPointer());
321 if (threadItem)
322 {
323 auto currentTid = m_debugger->GetActiveThread().m_tid;
324 if (!threadItem->isFrame() && (currentTid == threadItem->tid()))
325 {
326 QFont font = m_font;
327 font.setBold(true);
328 painter->setFont(font);
329 }
330 }
331
332 painter->setPen(option.palette.color(QPalette::WindowText).rgba());
333 painter->drawText(textRect, data.toString());
334 break;
335 }
336 case ThreadFrameModel::FrameIndexColumn:
337 {
338 painter->setPen(getThemeColor(NumberColor).rgba());
339 painter->drawText(textRect, data.toString());
340 break;
341 }
342 case ThreadFrameModel::ModuleColumn:
343 case ThreadFrameModel::FunctionColumn:
344 {
345 painter->setPen(option.palette.color(QPalette::WindowText).rgba());
346 painter->drawText(textRect, data.toString());
347 break;
348 }
349 case ThreadFrameModel::PcColumn:

Callers

nothing calls this directly

Calls 4

isFrameMethod · 0.80
tidMethod · 0.80
dataMethod · 0.45
GetActiveThreadMethod · 0.45

Tested by

no test coverage detected