1 #include "apicalldelegate.h"
3 #include "apitracecall.h"
10 ApiCallDelegate::ApiCallDelegate(QWidget *parent)
11 : QStyledItemDelegate(parent)
15 void ApiCallDelegate::paint(QPainter *painter,
16 const QStyleOptionViewItem &option,
17 const QModelIndex &index) const
19 ApiTraceCall *call = index.data().value<ApiTraceCall*>();
21 QStaticText text = call->staticText();
22 //text.setTextWidth(option.rect.width());
23 QStyledItemDelegate::paint(painter, option, index);
24 painter->drawStaticText(option.rect.topLeft(), text);
26 ApiTraceFrame *frame = index.data().value<ApiTraceFrame*>();
28 QStaticText text = frame->staticText();
29 //text.setTextWidth(option.rect.width());
30 QStyledItemDelegate::paint(painter, option, index);
31 painter->drawStaticText(option.rect.topLeft(), text);
33 QStyledItemDelegate::paint(painter, option, index);
38 QSize ApiCallDelegate::sizeHint(const QStyleOptionViewItem &option,
39 const QModelIndex &index) const
41 ApiTraceCall *call = index.data().value<ApiTraceCall*>();
43 QStaticText text = call->staticText();
44 //text.setTextWidth(option.rect.width());
45 return text.size().toSize();
47 ApiTraceFrame *frame = index.data().value<ApiTraceFrame*>();
49 QStaticText text = frame->staticText();
50 //text.setTextWidth(option.rect.width());
51 return text.size().toSize();
54 return QStyledItemDelegate::sizeHint(option, index);
58 #include "apicalldelegate.moc"