digiKam
Digikam::DigikamItemDelegate Class Reference
+ Inheritance diagram for Digikam::DigikamItemDelegate:

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
 
QRect actualPixmapRect (const QModelIndex &index) const
 
int calculatethumbSizeToFit (int ws)
 
ItemCategoryDrawercategoryDrawer () const
 
QRect commentsRect () const
 
QRect coordinatesIndicatorRect () const
 
 DigikamItemDelegate (ItemCategorizedView *parent)
 
QSize gridSize () const override
 
QRect groupIndicatorRect () const
 
QRect imageInformationRect () const override
 
void installOverlay (ItemDelegateOverlay *overlay)
 
void mouseMoved (QMouseEvent *e, const QRect &visualRect, const QModelIndex &index) override
 
QList< ItemDelegateOverlay * > overlays () const
 
void paint (QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
QPixmap pixmapForDrag (const QStyleOptionViewItem &option, const QList< QModelIndex > &indexes) const override
 
QRect pixmapRect () const override
 
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 setView (ItemCategorizedView *view)
 
void setViewOnAllOverlays (QAbstractItemView *view)
 
QSize sizeHint (const QStyleOptionViewItem &option, const QModelIndex &index) const override
 
int spacing () const
 
QRect tagsRect () const
 
ThumbnailSize thumbnailSize () const
 
 ~DigikamItemDelegate () 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 QPixmap retrieveThumbnailPixmap (const QModelIndex &index, int thumbnailSize)
 
static QString squeezedText (const QFontMetrics &fm, int width, const QString &text)
 

Protected Slots

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

Protected Member Functions

QAbstractItemDelegate * asDelegate () override
 Returns the delegate, typically, the derived class. More...
 
void clearCaches () override
 
virtual void clearModelDataCaches ()
 
 DigikamItemDelegate (DigikamItemDelegatePrivate &dd, ItemCategorizedView *parent)
 
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
 
void invalidatePaintingCache () override
 
bool onActualPixmapRect (const QPoint &pos, const QRect &visualRect, const QModelIndex &index, QRect *actualRect) const
 
void prepareBackground ()
 
void prepareFonts ()
 
void prepareMetrics (int maxWidth)
 
void prepareRatingPixmaps (bool composeOverBackground=true)
 
QPixmap ratingPixmap (int rating, bool selected) const
 
void setModel (QAbstractItemModel *model)
 
QString squeezedTextCached (QPainter *const p, int width, const QString &text) const
 
QPixmap thumbnailBorderPixmap (const QSize &pixSize, bool isGrouped=false) const
 
virtual QPixmap thumbnailPixmap (const QModelIndex &index) const
 
void updateActualPixmapRect (const QModelIndex &index, const QRect &rect)
 
virtual void updateContentWidth ()
 
void updateRects () override
 
void updateSizeRectsAndPixmaps () override
 

Protected Attributes

ItemViewDelegatePrivate *const d_ptr
 
QList< ItemDelegateOverlay * > m_overlays
 

Constructor & Destructor Documentation

◆ DigikamItemDelegate() [1/2]

Digikam::DigikamItemDelegate::DigikamItemDelegate ( ItemCategorizedView parent)
explicit

◆ ~DigikamItemDelegate()

Digikam::DigikamItemDelegate::~DigikamItemDelegate ( )
override

◆ DigikamItemDelegate() [2/2]

Digikam::DigikamItemDelegate::DigikamItemDelegate ( DigikamItemDelegatePrivate dd,
ItemCategorizedView parent 
)
protected

Member Function Documentation

◆ acceptsActivation()

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

◆ acceptsToolTip()

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

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.

References Digikam::ItemDelegate::onActualPixmapRect().

◆ actualPixmapRect()

QRect Digikam::ItemDelegate::actualPixmapRect ( const QModelIndex &  index) const
inherited

◆ asDelegate()

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

Returns the delegate, typically, the derived class.

Implements Digikam::ItemDelegateOverlayContainer.

◆ calculatethumbSizeToFit()

◆ categoryDrawer()

ItemCategoryDrawer * Digikam::ItemDelegate::categoryDrawer ( ) const
inherited

◆ clearCaches()

void Digikam::ItemDelegate::clearCaches ( )
overrideprotectedvirtualinherited

◆ clearModelDataCaches()

void Digikam::ItemDelegate::clearModelDataCaches ( )
protectedvirtualinherited

Reimplement to clear caches based on model indexes (hash on row number etc.) Change signals are listened to this is called whenever such properties become invalid.

Reimplemented in Digikam::ItemFaceDelegate.

Referenced by Digikam::ItemFaceDelegate::clearModelDataCaches(), Digikam::ItemDelegate::modelChanged(), and Digikam::ItemDelegate::modelContentsChanged().

◆ commentsRect()

QRect Digikam::ItemDelegate::commentsRect ( ) const
inherited

◆ coordinatesIndicatorRect()

QRect Digikam::ItemDelegate::coordinatesIndicatorRect ( ) const
inherited

◆ dateToString()

◆ drawAspectRatio()

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

◆ drawColorLabelRect()

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

◆ drawComments()

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

◆ drawCreationDate()

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

◆ drawFileSize()

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

◆ drawFocusRect()

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

◆ drawGeolocationIndicator()

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

◆ drawGroupIndicator()

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

◆ drawImageFormat()

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

◆ drawImageSize()

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

◆ drawModificationDate()

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

◆ drawMouseOverRect()

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

◆ drawName()

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

◆ 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
protectedinherited

◆ drawPickLabelIcon()

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

◆ drawRating()

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

◆ drawSpecialInfo()

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

◆ drawTags()

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

◆ drawThumbnail()

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

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
protectedinherited

◆ gridSize()

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

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

Implements Digikam::DItemDelegate.

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

◆ gridSizeChanged

◆ groupIndicatorRect()

QRect Digikam::ItemDelegate::groupIndicatorRect ( ) const
inherited

◆ hideNotification

void Digikam::ItemViewDelegate::hideNotification ( )
signalinherited

◆ imageInformationRect()

QRect Digikam::ItemDelegate::imageInformationRect ( ) const
overridevirtualinherited

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 from Digikam::ItemViewDelegate.

◆ installOverlay()

◆ invalidatePaintingCache()

void Digikam::ItemDelegate::invalidatePaintingCache ( )
overrideprotectedvirtualinherited

◆ makeDragPixmap()

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

◆ modelChanged

void Digikam::ItemDelegate::modelChanged ( )
protectedslotinherited

◆ modelContentsChanged

void Digikam::ItemDelegate::modelContentsChanged ( )
protectedslotinherited

◆ mouseMoved()

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

◆ onActualPixmapRect()

bool Digikam::ItemDelegate::onActualPixmapRect ( const QPoint &  pos,
const QRect &  visualRect,
const QModelIndex &  index,
QRect *  actualRect 
) const
protectedinherited

◆ overlayDestroyed

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

◆ overlays()

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

◆ paint()

void Digikam::ItemDelegate::paint ( QPainter *  painter,
const QStyleOptionViewItem &  option,
const QModelIndex &  index 
) const
overrideinherited

References Digikam::ItemDelegate::actualPixmapRect(), Digikam::ItemInfo::colorLabel(), Digikam::ItemInfo::comment(), Digikam::ItemInfo::currentReferenceImage(), Digikam::ItemInfo::dateTime(), Digikam::ItemInfo::dimensions(), Digikam::ItemViewDelegate::drawAspectRatio(), Digikam::ItemViewDelegate::drawColorLabelRect(), Digikam::ItemViewDelegate::drawComments(), Digikam::ItemViewDelegate::drawCreationDate(), Digikam::ItemViewDelegate::drawFileSize(), Digikam::ItemViewDelegate::drawFocusRect(), Digikam::ItemViewDelegate::drawGeolocationIndicator(), Digikam::ItemViewDelegate::drawGroupIndicator(), Digikam::ItemViewDelegate::drawImageFormat(), Digikam::ItemViewDelegate::drawImageSize(), Digikam::ItemViewDelegate::drawModificationDate(), Digikam::ItemViewDelegate::drawMouseOverRect(), Digikam::ItemViewDelegate::drawName(), Digikam::ItemDelegateOverlayContainer::drawOverlays(), Digikam::ItemViewDelegate::drawPanelSideIcon(), Digikam::ItemViewDelegate::drawPickLabelIcon(), Digikam::ItemViewDelegate::drawRating(), Digikam::ItemViewDelegate::drawSpecialInfo(), Digikam::ItemViewDelegate::drawTags(), Digikam::ItemViewDelegate::drawThumbnail(), Digikam::ItemViewDelegate::drawTitle(), Digikam::ItemInfo::fileSize(), Digikam::ItemInfo::format(), Digikam::ApplicationSettings::getDrawFramesToGrouped(), Digikam::ItemFilterModel::GroupIsOpenRole, Digikam::ItemInfo::hasCoordinates(), Digikam::ItemInfo::hasGroupedImages(), Digikam::ItemInfo::id(), Digikam::AlbumManager::instance(), Digikam::ApplicationSettings::instance(), Digikam::ItemInfo::isNull(), Digikam::ItemModel::LTLeftPanelRole, Digikam::ItemModel::LTRightPanelRole, Digikam::ItemInfo::modDateTime(), Digikam::ItemInfo::name(), Digikam::ItemInfo::numberOfGroupedImages(), Digikam::ItemInfo::pickLabel(), Digikam::ItemInfo::rating(), Digikam::ItemModel::retrieveItemInfo(), Digikam::ItemInfo::tagIds(), Digikam::AlbumManager::tagNames(), Digikam::ItemDelegate::thumbnailPixmap(), Digikam::ItemInfo::title(), and Digikam::ItemDelegate::updateActualPixmapRect().

◆ pixmapForDrag()

QPixmap Digikam::ItemDelegate::pixmapForDrag ( const QStyleOptionViewItem &  option,
const QList< QModelIndex > &  indexes 
) const
overridevirtualinherited

◆ pixmapRect()

QRect Digikam::ItemDelegate::pixmapRect ( ) const
overridevirtualinherited

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

Reimplemented from Digikam::ItemViewDelegate.

◆ prepareBackground()

void Digikam::ItemViewDelegate::prepareBackground ( )
protectedinherited

◆ prepareFonts()

void Digikam::ItemViewDelegate::prepareFonts ( )
protectedinherited

◆ prepareMetrics()

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

◆ prepareRatingPixmaps()

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

◆ ratingPixmap()

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

Returns the relevant pixmap from the cached rating pixmaps.

Referenced by Digikam::ItemViewDelegate::drawRating().

◆ ratingRect()

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

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

Referenced by Digikam::ItemViewDelegate::drawRating().

◆ rect()

◆ removeAllOverlays()

◆ removeOverlay()

◆ requestNotification

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

◆ retrieveThumbnailPixmap()

QPixmap Digikam::ItemDelegate::retrieveThumbnailPixmap ( const QModelIndex &  index,
int  thumbnailSize 
)
staticinherited

Retrieve the thumbnail pixmap in given size for the ItemModel::ThumbnailRole for the given index from the given index, which must adhere to ItemThumbnailModel semantics.

References Digikam::ItemModel::ThumbnailRole, and Digikam::ItemViewDelegate::thumbnailSize().

Referenced by Digikam::VersionsDelegate::initStyleOption(), and Digikam::ItemDelegate::thumbnailPixmap().

◆ setAllOverlaysActive()

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

◆ setDefaultViewOptions()

void Digikam::ItemDelegate::setDefaultViewOptions ( const QStyleOptionViewItem &  option)
overridevirtualinherited

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.

Reimplemented in Digikam::ItemThumbnailDelegate.

References Digikam::ItemViewDelegate::setDefaultViewOptions().

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

◆ setModel()

void Digikam::ItemDelegate::setModel ( QAbstractItemModel *  model)
protectedinherited

◆ setRatingEdited()

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

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

◆ setSpacing()

void Digikam::ItemDelegate::setSpacing ( int  spacing)
overridevirtualinherited

◆ setThumbnailSize()

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

You must set these options from the view

Implements Digikam::DItemDelegate.

References Digikam::ItemViewDelegate::invalidatePaintingCache().

◆ setView()

◆ setViewOnAllOverlays()

◆ sizeHint()

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

◆ slotSetupChanged

void Digikam::ItemViewDelegate::slotSetupChanged ( )
protectedslotinherited

◆ slotThemeChanged

void Digikam::ItemViewDelegate::slotThemeChanged ( )
protectedslotinherited

◆ 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

◆ tagsRect()

QRect Digikam::ItemDelegate::tagsRect ( ) const
inherited

◆ thumbnailBorderPixmap()

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

◆ thumbnailPixmap()

QPixmap Digikam::ItemDelegate::thumbnailPixmap ( const QModelIndex &  index) const
protectedvirtualinherited

◆ thumbnailSize()

ThumbnailSize Digikam::ItemViewDelegate::thumbnailSize ( ) const
inherited

◆ updateActualPixmapRect()

void Digikam::ItemDelegate::updateActualPixmapRect ( const QModelIndex &  index,
const QRect &  rect 
)
protectedinherited

◆ updateContentWidth()

void Digikam::ItemDelegate::updateContentWidth ( )
protectedvirtualinherited

Reimplement this to set contentWidth. This is the maximum width of all content rectangles, typically excluding margins on both sides.

Reimplemented in Digikam::ItemThumbnailDelegate.

Referenced by Digikam::ItemThumbnailDelegate::updateContentWidth(), and Digikam::ItemDelegate::updateSizeRectsAndPixmaps().

◆ updateRects()

◆ updateSizeRectsAndPixmaps()

◆ visualChange

Member Data Documentation

◆ d_ptr

ItemViewDelegatePrivate* const Digikam::ItemViewDelegate::d_ptr
protectedinherited

◆ m_overlays


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