mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-21 16:29:43 +01:00
* PlaylistLargeItemDelegate now properly inherits from standard PlaylistItemDelegate.
This commit is contained in:
parent
11a7510daf
commit
0dca8c2abd
@ -44,7 +44,7 @@ using namespace Tomahawk;
|
||||
|
||||
|
||||
PlaylistLargeItemDelegate::PlaylistLargeItemDelegate( DisplayMode mode, TrackView* parent, PlayableProxyModel* proxy )
|
||||
: QStyledItemDelegate( (QObject*)parent )
|
||||
: PlaylistItemDelegate( parent, proxy )
|
||||
, m_view( parent )
|
||||
, m_model( proxy )
|
||||
, m_mode( mode )
|
||||
@ -58,9 +58,8 @@ PlaylistLargeItemDelegate::PlaylistLargeItemDelegate( DisplayMode mode, TrackVie
|
||||
m_bottomOption = QTextOption( Qt::AlignBottom );
|
||||
m_bottomOption.setWrapMode( QTextOption::NoWrap );
|
||||
|
||||
connect( proxy, SIGNAL( modelReset() ), this, SLOT( modelChanged() ) );
|
||||
if ( PlaylistView* plView = qobject_cast< PlaylistView* >( parent ) )
|
||||
connect( plView, SIGNAL( modelChanged() ), this, SLOT( modelChanged() ) );
|
||||
connect( proxy, SIGNAL( modelReset() ), SLOT( modelChanged() ) );
|
||||
connect( parent, SIGNAL( modelChanged() ), SLOT( modelChanged() ) );
|
||||
}
|
||||
|
||||
|
||||
@ -79,25 +78,6 @@ PlaylistLargeItemDelegate::sizeHint( const QStyleOptionViewItem& option, const Q
|
||||
}
|
||||
|
||||
|
||||
QWidget*
|
||||
PlaylistLargeItemDelegate::createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
Q_UNUSED( parent );
|
||||
Q_UNUSED( option );
|
||||
Q_UNUSED( index );
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistLargeItemDelegate::prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item ) const
|
||||
{
|
||||
initStyleOption( option, index );
|
||||
|
||||
TomahawkUtils::prepareStyleOption( option, index, item );
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
PlaylistLargeItemDelegate::drawRichText( QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect, int flags, QTextDocument& text ) const
|
||||
{
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <QTextDocument>
|
||||
#include <QTextOption>
|
||||
|
||||
#include "PlaylistItemDelegate.h"
|
||||
#include "DllMacro.h"
|
||||
#include "Typedefs.h"
|
||||
|
||||
@ -30,12 +31,11 @@ namespace Tomahawk {
|
||||
class PixmapDelegateFader;
|
||||
}
|
||||
|
||||
class TrackModel;
|
||||
class PlayableItem;
|
||||
class PlayableProxyModel;
|
||||
class TrackView;
|
||||
|
||||
class DLLEXPORT PlaylistLargeItemDelegate : public QStyledItemDelegate
|
||||
class DLLEXPORT PlaylistLargeItemDelegate : public PlaylistItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
@ -45,20 +45,16 @@ public:
|
||||
|
||||
PlaylistLargeItemDelegate( DisplayMode mode, TrackView* parent = 0, PlayableProxyModel* proxy = 0 );
|
||||
|
||||
virtual QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
|
||||
protected:
|
||||
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
QWidget* createEditor( QWidget* parent, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
|
||||
signals:
|
||||
void updateIndex( const QModelIndex& idx );
|
||||
|
||||
private slots:
|
||||
void modelChanged();
|
||||
void doUpdateIndex( const QPersistentModelIndex& idx );
|
||||
void modelChanged();
|
||||
|
||||
private:
|
||||
void prepareStyleOption( QStyleOptionViewItemV4* option, const QModelIndex& index, PlayableItem* item ) const;
|
||||
void drawRichText( QPainter* painter, const QStyleOptionViewItem& option, const QRect& rect, int flags, QTextDocument& text ) const;
|
||||
|
||||
QTextOption m_topOption;
|
||||
|
Loading…
x
Reference in New Issue
Block a user