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

Author
Matthieu Bachelier

Constructor & Destructor Documentation

MiamItemDelegate::MiamItemDelegate ( QSortFilterProxyModel *  proxy)
explicit

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
protected
void MiamItemDelegate::drawTrack ( QPainter *  painter,
QStyleOptionViewItem &  option,
TrackItem track 
) const
protectedvirtual
void MiamItemDelegate::paintRect ( QPainter *  painter,
const QStyleOptionViewItem &  option 
) const
protected
void MiamItemDelegate::paintText ( QPainter *  p,
const QStyleOptionViewItem &  opt,
const QRect &  rectText,
const QString &  text,
const QStandardItem *  item 
) const
protected

Check if color needs to be inverted then paint text.

Member Data Documentation

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

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: