MCPcopy Create free account
hub / github.com/Codeya-IDE/deepin-ide / drawBackground

Method drawBackground

src/plugins/binarytools/models/toolitemdelegate.cpp:100–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void ToolItemDelegate::drawBackground(QPainter *painter, const QStyleOptionViewItem &option) const
101{
102 painter->save();
103 if (option.state.testFlag(QStyle::State_Selected)) {
104 QColor bgColor = option.palette.color(QPalette::Normal, QPalette::Highlight);
105 painter->setBrush(bgColor);
106 painter->setPen(Qt::NoPen);
107 painter->drawRoundedRect(option.rect, 6, 6);
108 } else if (option.state.testFlag(QStyle::State_MouseOver)) {
109#ifdef DTKWIDGET_CLASS_DPaletteHelper
110 DPalette palette = DPaletteHelper::instance()->palette(option.widget);
111#else
112 DPalette palette = DGuiApplicationHelper::instance()->applicationPalette();
113#endif
114 painter->setBrush(palette.brush(DPalette::ItemBackground));
115 painter->setPen(Qt::NoPen);
116 painter->drawRoundedRect(option.rect, 6, 6);
117 }
118 painter->restore();
119}
120
121void ToolItemDelegate::drawToolItem(QPainter *painter,
122 const QStyleOptionViewItem &option,

Callers

nothing calls this directly

Calls 3

restoreMethod · 0.80
saveMethod · 0.45
colorMethod · 0.45

Tested by

no test coverage detected