1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-06 06:07:37 +02:00

TemporaryPage types can be handled without forcing the class

This commit is contained in:
Uwe L. Korn
2014-06-18 17:42:55 +01:00
parent a50050ce49
commit 2a9ef2cad6

View File

@@ -723,10 +723,7 @@ SourceDelegate::paint( QPainter* painter, const QStyleOptionViewItem& option, co
} }
else if ( type == SourcesModel::TemporaryPage ) else if ( type == SourcesModel::TemporaryPage )
{ {
TemporaryPageItem* gpi = qobject_cast< TemporaryPageItem* >( item ); if ( opt.state & QStyle::State_MouseOver )
Q_ASSERT( gpi );
if ( gpi && opt.state & QStyle::State_MouseOver )
{ {
int padding = 3; int padding = 3;
m_iconHeight = ( opt.rect.height() - 2 * padding ); m_iconHeight = ( opt.rect.height() - 2 * padding );
@@ -852,7 +849,7 @@ SourceDelegate::editorEvent( QEvent* event, QAbstractItemModel* model, const QSt
SourcesModel::RowType type = static_cast< SourcesModel::RowType >( index.data( SourcesModel::SourceTreeItemTypeRole ).toInt() ); SourcesModel::RowType type = static_cast< SourcesModel::RowType >( index.data( SourcesModel::SourceTreeItemTypeRole ).toInt() );
if ( type == SourcesModel::TemporaryPage ) if ( type == SourcesModel::TemporaryPage )
{ {
TemporaryPageItem* gpi = qobject_cast< TemporaryPageItem* >( index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >() ); SourceTreeItem* gpi = index.data( SourcesModel::SourceTreeItemRole ).value< SourceTreeItem* >();
Q_ASSERT( gpi ); Q_ASSERT( gpi );
QMouseEvent* ev = static_cast< QMouseEvent* >( event ); QMouseEvent* ev = static_cast< QMouseEvent* >( event );