MCPcopy Create free account
hub / github.com/NatronGitHub/Natron / paint

Method paint

Gui/MultiInstancePanel.cpp:338–427  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

336}
337
338void
339TableItemDelegate::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 }

Callers

nothing calls this directly

Calls 15

itemMethod · 0.80
getKnobForItemMethod · 0.80
getAnimationLevelMethod · 0.80
getInterpolatedColorMethod · 0.80
getCurrentSettingsMethod · 0.80
getKeyframeColorMethod · 0.80
getTextColorMethod · 0.80
isValidMethod · 0.45
flagsMethod · 0.45
setColorMethod · 0.45
xMethod · 0.45
yMethod · 0.45

Tested by

no test coverage detected