-/*
-void expand()
-{
- QWidget *w = new QWidget;
- QVBoxLayout *layout = new QVBoxLayout;
- layout->addWidget( new KColorButton(w));
- w->setLayout( layout );
- extendItem(w,
-}
-*/
-
-void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
-{
- if (index.column() == 1)
- {
- const bool hover = option.state & (QStyle::State_Selected|QStyle::State_MouseOver|QStyle::State_HasFocus);
- QRect r1 = option.rect;
- painter->save();
- if (hover) {
- painter->setPen(option.palette.color(QPalette::HighlightedText));
- QColor backgroundColor = option.palette.color(QPalette::Highlight);
- painter->setBrush(QBrush(backgroundColor));
- painter->fillRect(r1, QBrush(backgroundColor));
+ */
+ void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const {
+ if (index.column() == 1) {
+ QRect r1 = option.rect;
+ painter->save();
+ if (option.state & (QStyle::State_Selected)) {
+ painter->setPen(option.palette.color(QPalette::HighlightedText));
+ painter->fillRect(r1, option.palette.highlight());
+ }
+ QFont font = painter->font();
+ font.setBold(true);
+ painter->setFont(font);
+ int mid = (int)((r1.height() / 2));
+ r1.setBottom(r1.y() + mid);
+ QRect r2 = option.rect;
+ r2.setTop(r2.y() + mid);
+ painter->drawText(r1, Qt::AlignLeft | Qt::AlignBottom , index.data().toString());
+ //painter->setPen(Qt::green);
+ font.setBold(false);
+ painter->setFont(font);
+ QString subText = index.data(DurationRole).toString();
+ int usage = index.data(UsageRole).toInt();
+ if (usage != 0) subText.append(QString(" (%1)").arg(usage));
+ painter->setPen(option.palette.color(QPalette::Mid));
+ painter->drawText(r2, Qt::AlignLeft | Qt::AlignVCenter , subText);
+ painter->restore();
+ } else if (index.column() == 3 && KdenliveSettings::activate_nepomuk()) {
+ if (index.data().toString().isEmpty()) {
+ QItemDelegate::paint(painter, option, index);
+ return;
+ }
+ QRect r1 = option.rect;
+ if (option.state & (QStyle::State_Selected)) {
+ painter->fillRect(r1, option.palette.highlight());
+ }
+ KRatingPainter::paintRating(painter, r1, Qt::AlignCenter, index.data().toInt());
+ } else {
+ QItemDelegate::paint(painter, option, index);
+ }