1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-03-20 07:49:42 +01:00

Don't select a temp item when deleting it

This commit is contained in:
Leo Franchi 2011-11-11 13:22:54 -05:00
parent 17e1003714
commit 518546b525
2 changed files with 8 additions and 2 deletions

View File

@ -1,6 +1,7 @@
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
*
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org>
* Copyright 2010-2011, Leo Franchi <lfranchi@kde.org>
*
* Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by

View File

@ -414,7 +414,7 @@ bool
SourceDelegate::editorEvent ( QEvent* event, QAbstractItemModel* model, const QStyleOptionViewItem& option, const QModelIndex& index )
{
if ( event->type() == QEvent::MouseButtonRelease )
if ( event->type() == QEvent::MouseButtonRelease || event->type() == QEvent::MouseButtonPress )
{
SourcesModel::RowType type = static_cast< SourcesModel::RowType >( index.data( SourcesModel::SourceTreeItemTypeRole ).toInt() );
if ( type == SourcesModel::TemporaryPage )
@ -429,7 +429,12 @@ SourceDelegate::editorEvent ( QEvent* event, QAbstractItemModel* model, const QS
QRect r ( o.rect.right() - padding - m_iconHeight, padding + o.rect.y(), m_iconHeight, m_iconHeight );
if ( r.contains( ev->pos() ) )
gpi->removeFromList();
{
if ( event->type() == QEvent::MouseButtonRelease )
gpi->removeFromList();
return true;
}
}
else if ( type == SourcesModel::Collection )
{