void TreeModel::removeIndex( const QModelIndex& index ) { if ( index.column() > 0 ) return; TreeModelItem* item = itemFromIndex( index ); if ( item ) { DownloadManager::instance()->removeJob( item->job() ); emit beginRemoveRows( index.parent(), index.row(), index.row() ); delete item; emit endRemoveRows(); } }
bool TreeModel::hasChildren( const QModelIndex& parent ) const { // qDebug() << Q_FUNC_INFO; if ( !parent.isValid() ) return true; TreeModelItem* parentItem = itemFromIndex( parent ); if ( !parentItem ) return false; if ( parent.isValid() && parent.parent().isValid() ) return false; return parentItem->job()->tracks().count() > 0; }