| 201 | |
| 202 | |
| 203 | void DebugModulesItemDelegate::paint( |
| 204 | QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& idx) const |
| 205 | { |
| 206 | painter->setFont(m_font); |
| 207 | |
| 208 | bool selected = (option.state & QStyle::State_Selected) != 0; |
| 209 | if (selected) |
| 210 | painter->setBrush(getThemeColor(SelectionColor)); |
| 211 | else |
| 212 | painter->setBrush(option.backgroundBrush); |
| 213 | |
| 214 | painter->setPen(Qt::NoPen); |
| 215 | painter->setFont(m_font); |
| 216 | |
| 217 | QRect textRect = option.rect; |
| 218 | textRect.setBottom(textRect.top() + m_charHeight + 2); |
| 219 | painter->drawRect(textRect); |
| 220 | |
| 221 | auto data = idx.data(Qt::DisplayRole); |
| 222 | switch (idx.column()) |
| 223 | { |
| 224 | case DebugModulesListModel::AddressColumn: |
| 225 | painter->setPen(getThemeColor(AddressColor).rgba()); |
| 226 | painter->drawText(textRect, data.toString()); |
| 227 | break; |
| 228 | case DebugModulesListModel::EndAddressColumn: |
| 229 | painter->setPen(getThemeColor(AddressColor).rgba()); |
| 230 | painter->drawText(textRect, data.toString()); |
| 231 | break; |
| 232 | case DebugModulesListModel::SizeColumn: |
| 233 | painter->setPen(getThemeColor(NumberColor).rgba()); |
| 234 | painter->drawText(textRect, data.toString()); |
| 235 | break; |
| 236 | case DebugModulesListModel::NameColumn: |
| 237 | case DebugModulesListModel::PathColumn: |
| 238 | { |
| 239 | painter->setPen(option.palette.color(QPalette::WindowText).rgba()); |
| 240 | painter->drawText(textRect, data.toString()); |
| 241 | break; |
| 242 | } |
| 243 | default: |
| 244 | break; |
| 245 | } |
| 246 | } |
| 247 | |
| 248 | |
| 249 | void DebugModulesItemDelegate::updateFonts() |