mirror of
https://github.com/tomahawk-player/tomahawk.git
synced 2025-03-23 01:09:42 +01:00
* Fixed default row-height for TreeItemDelegate.
This commit is contained in:
parent
3d210c05e5
commit
bc3824dfad
@ -45,6 +45,35 @@ TreeItemDelegate::TreeItemDelegate( TreeView* parent, TreeProxyModel* proxy )
|
||||
}
|
||||
|
||||
|
||||
QSize
|
||||
TreeItemDelegate::sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
QSize size = QStyledItemDelegate::sizeHint( option, index );
|
||||
|
||||
if ( index.isValid() )
|
||||
{
|
||||
PlayableItem* item = m_model->sourceModel()->itemFromIndex( m_model->mapToSource( index ) );
|
||||
if ( item )
|
||||
{
|
||||
if ( item->album() )
|
||||
{
|
||||
size.setHeight( option.fontMetrics.height() * 3 );
|
||||
return size;
|
||||
}
|
||||
else if ( item->query() || item->result() )
|
||||
{
|
||||
size.setHeight( option.fontMetrics.height() * 1.6 );
|
||||
return size;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// artist per default
|
||||
size.setHeight( option.fontMetrics.height() * 4 );
|
||||
return size;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
TreeItemDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const
|
||||
{
|
||||
|
@ -36,7 +36,9 @@ class DLLEXPORT TreeItemDelegate : public QStyledItemDelegate
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TreeItemDelegate( TreeView* parent = 0, TreeProxyModel* proxy = 0 );
|
||||
TreeItemDelegate( TreeView* parent, TreeProxyModel* proxy );
|
||||
|
||||
virtual QSize sizeHint( const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
|
||||
protected:
|
||||
void paint( QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index ) const;
|
||||
|
Loading…
x
Reference in New Issue
Block a user