Miam-Player  0.8.0
A nice music player
MiamItemDelegate Class Referenceabstract

The MiamItemDelegate class is the base class for drawing music informations in a QTreeView or a QListView. More...

#include <miamitemdelegate.h>

Inheritance diagram for MiamItemDelegate:
LibraryItemDelegate UniqueLibraryItemDelegate

Public Member Functions

 MiamItemDelegate (QSortFilterProxyModel *proxy)

Protected Member Functions

virtual void drawAlbum (QPainter *painter, QStyleOptionViewItem &option, AlbumItem *item) const =0
virtual void drawArtist (QPainter *painter, QStyleOptionViewItem &option, ArtistItem *item) const =0
void drawLetter (QPainter *painter, QStyleOptionViewItem &option, SeparatorItem *item) const
virtual void drawTrack (QPainter *painter, QStyleOptionViewItem &option, TrackItem *track) const
void paintRect (QPainter *painter, const QStyleOptionViewItem &option) const
void paintText (QPainter *p, const QStyleOptionViewItem &opt, const QRect &rectText, const QString &text, const QStandardItem *item) const

Protected Attributes

QStandardItemModel * _libraryModel
QSortFilterProxyModel * _proxy
bool _showCovers
QTimer * _timer
int _coverSize

Static Protected Attributes

static qreal _iconOpacity = 1.0

Detailed Description

The MiamItemDelegate class is the base class for drawing music informations in a QTreeView or a QListView.

This class has been made pure virtual class, because we cannot render Albums or Tracks without knowing the underlying context. But we can group here

Matthieu Bachelier

Constructor & Destructor Documentation

MiamItemDelegate::MiamItemDelegate ( QSortFilterProxyModel *  proxy)

Member Function Documentation

virtual void MiamItemDelegate::drawAlbum ( QPainter *  painter,
QStyleOptionViewItem &  option,
AlbumItem item 
) const
protectedpure virtual
virtual void MiamItemDelegate::drawArtist ( QPainter *  painter,
QStyleOptionViewItem &  option,
ArtistItem item 
) const
protectedpure virtual
void MiamItemDelegate::drawLetter ( QPainter *  painter,
QStyleOptionViewItem &  option,
SeparatorItem item 
) const
void MiamItemDelegate::drawTrack ( QPainter *  painter,
QStyleOptionViewItem &  option,
TrackItem track 
) const
void MiamItemDelegate::paintRect ( QPainter *  painter,
const QStyleOptionViewItem &  option 
) const
void MiamItemDelegate::paintText ( QPainter *  p,
const QStyleOptionViewItem &  opt,
const QRect &  rectText,
const QString &  text,
const QStandardItem *  item 
) const

Check if color needs to be inverted then paint text.

Member Data Documentation

int MiamItemDelegate::_coverSize
qreal MiamItemDelegate::_iconOpacity = 1.0
QStandardItemModel* MiamItemDelegate::_libraryModel
QSortFilterProxyModel* MiamItemDelegate::_proxy
bool MiamItemDelegate::_showCovers
QTimer* MiamItemDelegate::_timer

This timer is used to animate album cover when one is scrolling. It improves reactivity of the UI by temporarily disabling painting events. When covers are becoming visible once again, they are redisplayed with a nice fading effect.

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