#ifndef PLAYLISTITEMDELEGATE_H
#define PLAYLISTITEMDELEGATE_H
-#include <QtGui>
-#if QT_VERSION >= 0x050000
#include <QtWidgets>
-#endif
-class PlaylistItemDelegate : public QStyledItemDelegate {
+class PlaylistView;
+class PlaylistItemDelegate : public QStyledItemDelegate {
Q_OBJECT
public:
- PlaylistItemDelegate(QObject* parent, bool downloadInfo = false);
+ PlaylistItemDelegate(QObject *parent, bool downloadInfo = false);
~PlaylistItemDelegate();
- QSize sizeHint( const QStyleOptionViewItem&, const QModelIndex& ) const;
- void paint( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const;
+ QSize sizeHint(const QStyleOptionViewItem &, const QModelIndex &) const;
+ void
+ paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const;
QRect downloadButtonRect(const QRect &line) const;
- QRect authorRect(const QModelIndex& index) const;
+ QRect authorRect(const QModelIndex &index) const;
+
+ static const int thumbWidth;
+ static const int thumbHeight;
private:
void createPlayIcon();
- void paintBody( QPainter*, const QStyleOptionViewItem&, const QModelIndex& ) const;
- void paintDownloadInfo( QPainter* painter,
- const QStyleOptionViewItem& option,
- const QModelIndex& index ) const;
-
- // active track painting
- void paintActiveOverlay(QPainter *painter, const QRect &line) const;
-
- // Paints the video duration
+ void paintBody(QPainter *, const QStyleOptionViewItem &, const QModelIndex &) const;
+ void paintDownloadInfo(QPainter *painter,
+ const QStyleOptionViewItem &option,
+ const QModelIndex &index) const;
+ void paintActiveOverlay(QPainter *painter,
+ const QStyleOptionViewItem &option,
+ const QRect &line) const;
void drawTime(QPainter *painter, const QString &time, const QRect &line) const;
- static const int THUMB_WIDTH;
- static const int THUMB_HEIGHT;
- static const int PADDING;
+ static const int padding;
QPixmap playIcon;
- QFont boldFont;
QFont smallerFont;
QFont smallerBoldFont;
mutable QRect lastAuthorRect;
mutable QHash<int, QRect> authorRects;
+
+ PlaylistView *listView;
};
#endif