*! Clean up code and make drags between normal groups work.

This commit is contained in:
Konstantin Isakov 2009-05-18 11:58:19 +00:00
parent 1e4a643d08
commit 189e22497b

View file

@ -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() );
@ -351,29 +351,9 @@ 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;
}
QListView::dropEvent( event );
if ( sourceList && sourceList->model.sourceModel() && ( sourceList != this ) )
if ( sourceList != this )
{
model.filterDuplicates();
}