51
ItemViewImageDelegate(DCategorizedView *parent);
51
ItemViewImageDelegate(DCategorizedView* parent);
52
52
~ItemViewImageDelegate();
54
virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex & index) const;
54
virtual QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const;
55
55
virtual QSize gridSize() const;
57
57
ThumbnailSize thumbnailSize() const;
61
61
virtual void setSpacing(int spacing);
62
62
virtual void setDefaultViewOptions(const QStyleOptionViewItem& option);
63
63
virtual bool acceptsToolTip(const QPoint& pos, const QRect& visualRect,
64
const QModelIndex& index, QRect *tooltipRect = 0) const;
64
const QModelIndex& index, QRect* tooltipRect = 0) const;
65
65
virtual bool acceptsActivation(const QPoint& pos, const QRect& visualRect,
66
const QModelIndex& index, QRect *activationRect = 0) const;
66
const QModelIndex& index, QRect* activationRect = 0) const;
68
68
QRect rect() const;
70
70
/** Can be used to temporarily disable drawing of the rating.
71
71
* Call with QModelIndex() afterwards. */
72
void setRatingEdited(const QModelIndex &index);
72
void setRatingEdited(const QModelIndex& index);
73
73
/** Returns the rectangle where the rating is drawn,
74
74
* or a null rectangle if not supported. */
75
75
virtual QRect ratingRect() const;
77
77
/** Support for overlays. To be called by the item view only. */
78
void installOverlay(ImageDelegateOverlay *overlay);
79
void removeOverlay(ImageDelegateOverlay *overlay);
78
void installOverlay(ImageDelegateOverlay* overlay);
79
void removeOverlay(ImageDelegateOverlay* overlay);
80
80
void setAllOverlaysActive(bool active);
81
81
void removeAllOverlays();
82
void mouseMoved(QMouseEvent *e, const QRect& visualRect, const QModelIndex& index);
82
void mouseMoved(QMouseEvent* e, const QRect& visualRect, const QModelIndex& index);
91
91
/// Use the tool methods for painting in subclasses
92
QRect drawThumbnail(QPainter *p, const QRect& thumbRect, const QPixmap& background, const QPixmap& thumbnail) const;
93
void drawRating(QPainter *p, const QModelIndex& index, const QRect& ratingRect, int rating, bool isSelected) const;
94
void drawName(QPainter *p,const QRect& nameRect, const QString& name) const;
95
void drawComments(QPainter *p, const QRect& commentsRect, const QString& comments) const;
96
void drawCreationDate(QPainter *p, const QRect& dateRect, const QDateTime& date) const;
97
void drawModificationDate(QPainter *p, const QRect& dateRect, const QDateTime& date) const;
98
void drawImageSize(QPainter *p, const QRect& dimsRect, const QSize& dims) const;
99
void drawFileSize(QPainter *p, const QRect& r, int bytes) const;
100
void drawTags(QPainter *p, const QRect& r, const QString& tagsString, bool isSelected) const;
101
void drawFocusRect(QPainter *p, const QStyleOptionViewItem& option, bool isSelected) const;
102
void drawMouseOverRect(QPainter *p, const QStyleOptionViewItem& option) const;
103
void drawDelegates(QPainter *p, const QStyleOptionViewItem& option, const QModelIndex& index) const;
92
QRect drawThumbnail(QPainter* p, const QRect& thumbRect, const QPixmap& background, const QPixmap& thumbnail) const;
93
void drawRating(QPainter* p, const QModelIndex& index, const QRect& ratingRect, int rating, bool isSelected) const;
94
void drawName(QPainter* p,const QRect& nameRect, const QString& name) const;
95
void drawComments(QPainter* p, const QRect& commentsRect, const QString& comments) const;
96
void drawCreationDate(QPainter* p, const QRect& dateRect, const QDateTime& date) const;
97
void drawModificationDate(QPainter* p, const QRect& dateRect, const QDateTime& date) const;
98
void drawImageSize(QPainter* p, const QRect& dimsRect, const QSize& dims) const;
99
void drawFileSize(QPainter* p, const QRect& r, int bytes) const;
100
void drawTags(QPainter* p, const QRect& r, const QString& tagsString, bool isSelected) const;
101
void drawFocusRect(QPainter* p, const QStyleOptionViewItem& option, bool isSelected) const;
102
void drawMouseOverRect(QPainter* p, const QStyleOptionViewItem& option) const;
103
void drawDelegates(QPainter* p, const QStyleOptionViewItem& option, const QModelIndex& index) const;
104
104
void prepareFonts();
105
105
void prepareMetrics(int maxWidth);
106
106
void prepareBackground();
113
113
/// Returns the relevant pixmap from the cached rating pixmaps
114
114
QPixmap ratingPixmap(int rating, bool selected) const;
116
ItemViewImageDelegatePrivate *const d_ptr;
117
ItemViewImageDelegate(ItemViewImageDelegatePrivate &dd, DCategorizedView *parent);
116
ItemViewImageDelegatePrivate* const d_ptr;
117
ItemViewImageDelegate(ItemViewImageDelegatePrivate& dd, DCategorizedView* parent);
121
121
Q_DECLARE_PRIVATE(ItemViewImageDelegate)