1
0
mirror of https://github.com/tomahawk-player/tomahawk.git synced 2025-08-05 05:37:29 +02: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> === /* === This file is part of Tomahawk Player - <http://tomahawk-player.org> ===
* *
* Copyright 2010-2011, Christian Muehlhaeuser <muesli@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 * Tomahawk is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * 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 ) 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() ); SourcesModel::RowType type = static_cast< SourcesModel::RowType >( index.data( SourcesModel::SourceTreeItemTypeRole ).toInt() );
if ( type == SourcesModel::TemporaryPage ) 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 ); QRect r ( o.rect.right() - padding - m_iconHeight, padding + o.rect.y(), m_iconHeight, m_iconHeight );
if ( r.contains( ev->pos() ) ) if ( r.contains( ev->pos() ) )
{
if ( event->type() == QEvent::MouseButtonRelease )
gpi->removeFromList(); gpi->removeFromList();
return true;
}
} }
else if ( type == SourcesModel::Collection ) else if ( type == SourcesModel::Collection )
{ {