| 336 | } |
| 337 | |
| 338 | void |
| 339 | TableItemDelegate::paint(QPainter * painter, |
| 340 | const QStyleOptionViewItem & option, |
| 341 | const QModelIndex & index) const |
| 342 | { |
| 343 | assert( index.isValid() ); |
| 344 | if ( !index.isValid() ) { |
| 345 | QStyledItemDelegate::paint(painter, option, index); |
| 346 | |
| 347 | return; |
| 348 | } |
| 349 | |
| 350 | TableModel* model = dynamic_cast<TableModel*>( _view->model() ); |
| 351 | assert(model); |
| 352 | if (!model) { |
| 353 | // coverity[dead_error_line] |
| 354 | QStyledItemDelegate::paint(painter, option, index); |
| 355 | |
| 356 | return; |
| 357 | } |
| 358 | TableItem* item = model->item(index); |
| 359 | assert(item); |
| 360 | if (!item) { |
| 361 | // coverity[dead_error_line] |
| 362 | QStyledItemDelegate::paint(painter, option, index); |
| 363 | |
| 364 | return; |
| 365 | } |
| 366 | |
| 367 | // get the proper subrect from the style |
| 368 | QStyle *style = QApplication::style(); |
| 369 | QRect geom = style->subElementRect(QStyle::SE_ItemViewItemText, &option); |
| 370 | int dim; |
| 371 | AnimationLevelEnum level = eAnimationLevelNone; |
| 372 | KnobIPtr knob = _panel->getKnobForItem(item, &dim); |
| 373 | if (knob) { |
| 374 | level = knob->getAnimationLevel(dim); |
| 375 | } |
| 376 | |
| 377 | bool fillRect = true; |
| 378 | QBrush brush; |
| 379 | if (option.state & QStyle::State_Selected) { |
| 380 | brush = option.palette.highlight(); |
| 381 | } else if (level == eAnimationLevelInterpolatedValue) { |
| 382 | double r, g, b; |
| 383 | appPTR->getCurrentSettings()->getInterpolatedColor(&r, &g, &b); |
| 384 | QColor col; |
| 385 | col.setRgbF(r, g, b); |
| 386 | brush = col; |
| 387 | } else if (level == eAnimationLevelOnKeyframe) { |
| 388 | double r, g, b; |
| 389 | appPTR->getCurrentSettings()->getKeyframeColor(&r, &g, &b); |
| 390 | QColor col; |
| 391 | col.setRgbF(r, g, b); |
| 392 | brush = col; |
| 393 | } else { |
| 394 | fillRect = false; |
| 395 | } |
nothing calls this directly
no test coverage detected