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