digiKam
Digikam::ItemViewDelegate Class Referenceabstract
+ Inheritance diagram for Digikam::ItemViewDelegate:

Signals

void gridSizeChanged (const QSize &newSize)
 
void hideNotification ()
 
void requestNotification (const QModelIndex &index, const QString &message)
 
void visualChange ()
 

Public Member Functions

bool acceptsActivation (const QPoint &pos, const QRect &visualRect, const QModelIndex &index, QRect *activationRect=nullptr) const override
 
bool acceptsToolTip (const QPoint &pos, const QRect &visualRect, const QModelIndex &index, QRect *tooltipRect=nullptr) const override
 
QSize gridSize () const override
 
virtual QRect imageInformationRect () const
 
void installOverlay (ItemDelegateOverlay *overlay)
 
 ItemViewDelegate (QObject *const parent=nullptr)
 
void mouseMoved (QMouseEvent *e, const QRect &visualRect, const QModelIndex &index) override
 
QList< ItemDelegateOverlay * > overlays () const
 
virtual QPixmap pixmapForDrag (const QStyleOptionViewItem &option, const QList< QModelIndex > &indexes) const =0
 
virtual QRect pixmapRect () const
 
virtual QRect ratingRect () const
 
QRect rect () const
 
void removeAllOverlays ()
 
void removeOverlay (ItemDelegateOverlay *overlay)
 
void setAllOverlaysActive (bool active)
 
void setDefaultViewOptions (const QStyleOptionViewItem &option) override
 
void setRatingEdited (const QModelIndex &index)
 
void setSpacing (int spacing) override
 
void setThumbnailSize (const ThumbnailSize &thumbSize) override
 
void setViewOnAllOverlays (QAbstractItemView *view)
 
QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
int spacing () const
 
ThumbnailSize thumbnailSize () const
 
 ~ItemViewDelegate () override
 

Static Public Member Functions

static QString dateToString (const QDateTime &datetime)
 
static QPixmap makeDragPixmap (const QStyleOptionViewItem &option, const QList< QModelIndex > &indexes, const QPixmap &suggestedPixmap=QPixmap())
 
static QString squeezedText (const QFontMetrics &fm, int width, const QString &text)
 

Protected Slots

void overlayDestroyed (QObject *o) override
 
void slotSetupChanged ()
 
void slotThemeChanged ()
 

Protected Member Functions

QAbstractItemDelegate * asDelegate () override
 Returns the delegate, typically, the derived class. More...
 
virtual void clearCaches ()
 
void drawAspectRatio (QPainter *p, const QRect &dimsRect, const QSize &dims) const
 
void drawColorLabelRect (QPainter *p, const QStyleOptionViewItem &option, bool isSelected, int colorId) const
 
void drawComments (QPainter *p, const QRect &commentsRect, const QString &comments) const
 
void drawCreationDate (QPainter *p, const QRect &dateRect, const QDateTime &date) const
 
void drawFileSize (QPainter *p, const QRect &r, qlonglong bytes) const
 
void drawFocusRect (QPainter *p, const QStyleOptionViewItem &option, bool isSelected) const
 
void drawGeolocationIndicator (QPainter *p, const QRect &r) const
 
void drawGroupIndicator (QPainter *p, const QRect &r, int numberOfGroupedImages, bool open) const
 
void drawImageFormat (QPainter *p, const QRect &r, const QString &f, bool drawTop) const
 
void drawImageSize (QPainter *p, const QRect &dimsRect, const QSize &dims) const
 
void drawModificationDate (QPainter *p, const QRect &dateRect, const QDateTime &date) const
 
void drawMouseOverRect (QPainter *p, const QStyleOptionViewItem &option) const
 
void drawName (QPainter *p, const QRect &nameRect, const QString &name) const
 
virtual void drawOverlays (QPainter *p, const QStyleOptionViewItem &option, const QModelIndex &index) const
 
void drawPanelSideIcon (QPainter *p, bool left, bool right) const
 
void drawPickLabelIcon (QPainter *p, const QRect &r, int pickLabel) const
 
void drawRating (QPainter *p, const QModelIndex &index, const QRect &ratingRect, int rating, bool isSelected) const
 
void drawSpecialInfo (QPainter *p, const QRect &r, const QString &text) const
 
void drawTags (QPainter *p, const QRect &r, const QString &tagsString, bool isSelected) const
 
QRect drawThumbnail (QPainter *p, const QRect &thumbRect, const QPixmap &background, const QPixmap &thumbnail, bool isGrouped) const
 
void drawTitle (QPainter *p, const QRect &titleRect, const QString &title) const
 
virtual void invalidatePaintingCache ()
 
 ItemViewDelegate (ItemViewDelegatePrivate &dd, QObject *const parent)
 
void prepareBackground ()
 
void prepareFonts ()
 
void prepareMetrics (int maxWidth)
 
void prepareRatingPixmaps (bool composeOverBackground=true)
 
QPixmap ratingPixmap (int rating, bool selected) const
 
QString squeezedTextCached (QPainter *const p, int width, const QString &text) const
 
QPixmap thumbnailBorderPixmap (const QSize &pixSize, bool isGrouped=false) const
 
virtual void updateSizeRectsAndPixmaps ()=0
 

Protected Attributes

ItemViewDelegatePrivate *const d_ptr
 
QList< ItemDelegateOverlay * > m_overlays
 

Constructor & Destructor Documentation

◆ ItemViewDelegate() [1/2]

Digikam::ItemViewDelegate::ItemViewDelegate ( QObject *const  parent = nullptr)
explicit

◆ ~ItemViewDelegate()

Digikam::ItemViewDelegate::~ItemViewDelegate ( )
override

◆ ItemViewDelegate() [2/2]

Digikam::ItemViewDelegate::ItemViewDelegate ( ItemViewDelegatePrivate dd,
QObject *const  parent 
)
protected

Member Function Documentation

◆ acceptsActivation()

bool Digikam::ItemViewDelegate::acceptsActivation ( const QPoint &  pos,
const QRect &  visualRect,
const QModelIndex &  index,
QRect *  activationRect = nullptr 
) const
overridevirtual

◆ acceptsToolTip()

bool Digikam::ItemViewDelegate::acceptsToolTip ( const QPoint &  pos,
const QRect &  visualRect,
const QModelIndex &  index,
QRect *  tooltipRect = nullptr 
) const
overridevirtual

These methods take four parameters: The position on viewport, the rect on viewport, the index, and optionally a parameter into which, if the return value is true, a rectangle can be written for which the return value will be true as well.

Implements Digikam::DItemDelegate.

◆ asDelegate()

QAbstractItemDelegate * Digikam::ItemViewDelegate::asDelegate ( )
overrideprotectedvirtual

Returns the delegate, typically, the derived class.

Implements Digikam::ItemDelegateOverlayContainer.

◆ clearCaches()

◆ dateToString()

QString Digikam::DItemDelegate::dateToString ( const QDateTime &  datetime)
staticinherited

◆ drawAspectRatio()

void Digikam::ItemViewDelegate::drawAspectRatio ( QPainter *  p,
const QRect &  dimsRect,
const QSize &  dims 
) const
protected

◆ drawColorLabelRect()

void Digikam::ItemViewDelegate::drawColorLabelRect ( QPainter *  p,
const QStyleOptionViewItem &  option,
bool  isSelected,
int  colorId 
) const
protected

◆ drawComments()

void Digikam::ItemViewDelegate::drawComments ( QPainter *  p,
const QRect &  commentsRect,
const QString &  comments 
) const
protected

◆ drawCreationDate()

void Digikam::ItemViewDelegate::drawCreationDate ( QPainter *  p,
const QRect &  dateRect,
const QDateTime &  date 
) const
protected

◆ drawFileSize()

void Digikam::ItemViewDelegate::drawFileSize ( QPainter *  p,
const QRect &  r,
qlonglong  bytes 
) const
protected

◆ drawFocusRect()

void Digikam::ItemViewDelegate::drawFocusRect ( QPainter *  p,
const QStyleOptionViewItem &  option,
bool  isSelected 
) const
protected

◆ drawGeolocationIndicator()

void Digikam::ItemViewDelegate::drawGeolocationIndicator ( QPainter *  p,
const QRect &  r 
) const
protected

◆ drawGroupIndicator()

void Digikam::ItemViewDelegate::drawGroupIndicator ( QPainter *  p,
const QRect &  r,
int  numberOfGroupedImages,
bool  open 
) const
protected

◆ drawImageFormat()

void Digikam::ItemViewDelegate::drawImageFormat ( QPainter *  p,
const QRect &  r,
const QString &  f,
bool  drawTop 
) const
protected

◆ drawImageSize()

void Digikam::ItemViewDelegate::drawImageSize ( QPainter *  p,
const QRect &  dimsRect,
const QSize &  dims 
) const
protected

◆ drawModificationDate()

void Digikam::ItemViewDelegate::drawModificationDate ( QPainter *  p,
const QRect &  dateRect,
const QDateTime &  date 
) const
protected

◆ drawMouseOverRect()

void Digikam::ItemViewDelegate::drawMouseOverRect ( QPainter *  p,
const QStyleOptionViewItem &  option 
) const
protected

◆ drawName()

void Digikam::ItemViewDelegate::drawName ( QPainter *  p,
const QRect &  nameRect,
const QString &  name 
) const
protected

◆ drawOverlays()

void Digikam::ItemDelegateOverlayContainer::drawOverlays ( QPainter *  p,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
protectedvirtualinherited

◆ drawPanelSideIcon()

void Digikam::ItemViewDelegate::drawPanelSideIcon ( QPainter *  p,
bool  left,
bool  right 
) const
protected

◆ drawPickLabelIcon()

void Digikam::ItemViewDelegate::drawPickLabelIcon ( QPainter *  p,
const QRect &  r,
int  pickLabel 
) const
protected

◆ drawRating()

void Digikam::ItemViewDelegate::drawRating ( QPainter *  p,
const QModelIndex &  index,
const QRect &  ratingRect,
int  rating,
bool  isSelected 
) const
protected

◆ drawSpecialInfo()

void Digikam::ItemViewDelegate::drawSpecialInfo ( QPainter *  p,
const QRect &  r,
const QString &  text 
) const
protected

◆ drawTags()

void Digikam::ItemViewDelegate::drawTags ( QPainter *  p,
const QRect &  r,
const QString &  tagsString,
bool  isSelected 
) const
protected

◆ drawThumbnail()

QRect Digikam::ItemViewDelegate::drawThumbnail ( QPainter *  p,
const QRect &  thumbRect,
const QPixmap &  background,
const QPixmap &  thumbnail,
bool  isGrouped 
) const
protected

Use the tool methods for painting in subclasses

References Digikam::DItemDelegate::thumbnailBorderPixmap().

Referenced by Digikam::ItemDelegate::paint().

◆ drawTitle()

void Digikam::ItemViewDelegate::drawTitle ( QPainter *  p,
const QRect &  titleRect,
const QString &  title 
) const
protected

◆ gridSize()

QSize Digikam::ItemViewDelegate::gridSize ( ) const
overridevirtual

Returns the gridsize to be set by the view. It's sizeHint plus spacing.

Implements Digikam::DItemDelegate.

Referenced by Digikam::ItemDelegate::calculatethumbSizeToFit().

◆ gridSizeChanged

void Digikam::DItemDelegate::gridSizeChanged ( const QSize &  newSize)
signalinherited

◆ hideNotification

void Digikam::ItemViewDelegate::hideNotification ( )
signal

◆ imageInformationRect()

QRect Digikam::ItemViewDelegate::imageInformationRect ( ) const
virtual

Returns the area where the image information is drawn, or null if empty / not supported. The image information is textual or graphical information, but not the pixmap. The ratingRect() will e.g. typically be contained in this area.

Reimplemented in Digikam::ItemDelegate.

◆ installOverlay()

◆ invalidatePaintingCache()

◆ makeDragPixmap()

QPixmap Digikam::DItemDelegate::makeDragPixmap ( const QStyleOptionViewItem &  option,
const QList< QModelIndex > &  indexes,
const QPixmap &  suggestedPixmap = QPixmap() 
)
staticinherited

◆ mouseMoved()

void Digikam::ItemViewDelegate::mouseMoved ( QMouseEvent *  e,
const QRect &  visualRect,
const QModelIndex &  index 
)
overridevirtual

◆ overlayDestroyed

void Digikam::ItemViewDelegate::overlayDestroyed ( QObject *  o)
overrideprotectedslot

◆ overlays()

QList< ItemDelegateOverlay * > Digikam::ItemDelegateOverlayContainer::overlays ( ) const
inherited

◆ pixmapForDrag()

virtual QPixmap Digikam::DItemDelegate::pixmapForDrag ( const QStyleOptionViewItem &  option,
const QList< QModelIndex > &  indexes 
) const
pure virtualinherited

◆ pixmapRect()

QRect Digikam::ItemViewDelegate::pixmapRect ( ) const
virtual

Returns the area where the pixmap is drawn, or null if not supported.

Reimplemented in Digikam::ItemDelegate.

◆ prepareBackground()

void Digikam::ItemViewDelegate::prepareBackground ( )
protected

◆ prepareFonts()

void Digikam::ItemViewDelegate::prepareFonts ( )
protected

◆ prepareMetrics()

void Digikam::ItemViewDelegate::prepareMetrics ( int  maxWidth)
protected

◆ prepareRatingPixmaps()

void Digikam::ItemViewDelegate::prepareRatingPixmaps ( bool  composeOverBackground = true)
protected

◆ ratingPixmap()

QPixmap Digikam::ItemViewDelegate::ratingPixmap ( int  rating,
bool  selected 
) const
protected

Returns the relevant pixmap from the cached rating pixmaps.

Referenced by drawRating().

◆ ratingRect()

QRect Digikam::ItemViewDelegate::ratingRect ( ) const
virtual

Returns the rectangle where the rating is drawn, or a null rectangle if not supported.

Referenced by drawRating().

◆ rect()

◆ removeAllOverlays()

◆ removeOverlay()

◆ requestNotification

void Digikam::ItemViewDelegate::requestNotification ( const QModelIndex &  index,
const QString &  message 
)
signal

◆ setAllOverlaysActive()

void Digikam::ItemDelegateOverlayContainer::setAllOverlaysActive ( bool  active)
inherited

◆ setDefaultViewOptions()

void Digikam::ItemViewDelegate::setDefaultViewOptions ( const QStyleOptionViewItem &  option)
overridevirtual

Style option with standard values to use for cached rendering. option.rect shall be the viewport rectangle. Call on resize, font change.

Implements Digikam::DItemDelegate.

References invalidatePaintingCache().

Referenced by Digikam::ItemDelegate::setDefaultViewOptions().

◆ setRatingEdited()

void Digikam::ItemViewDelegate::setRatingEdited ( const QModelIndex &  index)

Can be used to temporarily disable drawing of the rating. Call with QModelIndex() afterwards.

◆ setSpacing()

void Digikam::ItemViewDelegate::setSpacing ( int  spacing)
overridevirtual

◆ setThumbnailSize()

void Digikam::ItemViewDelegate::setThumbnailSize ( const ThumbnailSize thumbSize)
overridevirtual

You must set these options from the view

Implements Digikam::DItemDelegate.

References invalidatePaintingCache().

◆ setViewOnAllOverlays()

◆ sizeHint()

QSize Digikam::ItemViewDelegate::sizeHint ( const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
override

◆ slotSetupChanged

void Digikam::ItemViewDelegate::slotSetupChanged ( )
protectedslot

◆ slotThemeChanged

void Digikam::ItemViewDelegate::slotThemeChanged ( )
protectedslot

◆ spacing()

◆ squeezedText()

QString Digikam::DItemDelegate::squeezedText ( const QFontMetrics &  fm,
int  width,
const QString &  text 
)
staticinherited

◆ squeezedTextCached()

QString Digikam::DItemDelegate::squeezedTextCached ( QPainter *const  p,
int  width,
const QString &  text 
) const
protectedinherited

◆ thumbnailBorderPixmap()

QPixmap Digikam::DItemDelegate::thumbnailBorderPixmap ( const QSize &  pixSize,
bool  isGrouped = false 
) const
protectedinherited

◆ thumbnailSize()

ThumbnailSize Digikam::ItemViewDelegate::thumbnailSize ( ) const

◆ updateSizeRectsAndPixmaps()

virtual void Digikam::ItemViewDelegate::updateSizeRectsAndPixmaps ( )
protectedpure virtual

Implemented in Digikam::ItemDelegate.

Referenced by invalidatePaintingCache().

◆ visualChange

Member Data Documentation

◆ d_ptr

ItemViewDelegatePrivate* const Digikam::ItemViewDelegate::d_ptr
protected

Referenced by ItemViewDelegate().

◆ m_overlays


The documentation for this class was generated from the following files: