From 189e22497b9a51d495804088613ccd928b9f4e68 Mon Sep 17 00:00:00 2001 From: Konstantin Isakov Date: Mon, 18 May 2009 11:58:19 +0000 Subject: [PATCH] *! Clean up code and make drags between normal groups work. --- src/groups_widgets.cc | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/src/groups_widgets.cc b/src/groups_widgets.cc index eca0bacd..1dcf7a68 100644 --- a/src/groups_widgets.cc +++ b/src/groups_widgets.cc @@ -251,7 +251,7 @@ void DictListModel::addSelectedUniqueFromModel( QItemSelectionModel * source ) QVector< std::string > list; QVector< std::string > dicts; - for ( int i = 0; i < dictionaries.size(); i++ ) + for ( unsigned i = 0; i < dictionaries.size(); i++ ) dicts.append( dictionaries.at( i )->getId() ); for ( int i = 0; i < rows.count(); i++ ) @@ -265,7 +265,7 @@ void DictListModel::addSelectedUniqueFromModel( QItemSelectionModel * source ) if ( list.empty() ) return; - for ( int i = 0; i < allDicts->size(); i++ ) + for ( unsigned i = 0; i < allDicts->size(); i++ ) { for ( int j = 0; j < list.size(); j++ ) { @@ -291,7 +291,7 @@ void DictListModel::filterDuplicates() QSet< QString > ids; bool doReset = false; - for ( int i = 0; i < dictionaries.size(); i++ ) + for ( unsigned i = 0; i < dictionaries.size(); i++ ) { QString id = QString::fromStdString( dictionaries.at( i )->getId() ); @@ -349,31 +349,11 @@ std::vector< sptr< Dictionary::Class > > const & void DictListWidget::dropEvent ( QDropEvent * event ) { - DictListWidget * sourceList = dynamic_cast< DictListWidget* > ( event->source() ); - -// if ( sourceList == this ) -// { -// event->accept(); -// return; -// } -// -// if ( sourceList && sourceList->model.sourceModel() ) -// { -// model.addSelectedUniqueFromModel( sourceList->selectionModel() ); -// event->ignore(); -// return; -// } - - if ( sourceList && !( sourceList->model.sourceModel() ) && ( sourceList != this ) ) - { - sourceList->model.removeSelectedRows( sourceList->selectionModel() ); - event->ignore(); - return; - } + DictListWidget * sourceList = dynamic_cast< DictListWidget * > ( event->source() ); QListView::dropEvent( event ); - if ( sourceList && sourceList->model.sourceModel() && ( sourceList != this ) ) + if ( sourceList != this ) { model.filterDuplicates(); }