mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-28 03:44:07 +00:00
*! Clean up code and make drags between normal groups work.
This commit is contained in:
parent
1e4a643d08
commit
189e22497b
|
@ -251,7 +251,7 @@ void DictListModel::addSelectedUniqueFromModel( QItemSelectionModel * source )
|
||||||
|
|
||||||
QVector< std::string > list;
|
QVector< std::string > list;
|
||||||
QVector< std::string > dicts;
|
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() );
|
dicts.append( dictionaries.at( i )->getId() );
|
||||||
|
|
||||||
for ( int i = 0; i < rows.count(); i++ )
|
for ( int i = 0; i < rows.count(); i++ )
|
||||||
|
@ -265,7 +265,7 @@ void DictListModel::addSelectedUniqueFromModel( QItemSelectionModel * source )
|
||||||
if ( list.empty() )
|
if ( list.empty() )
|
||||||
return;
|
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++ )
|
for ( int j = 0; j < list.size(); j++ )
|
||||||
{
|
{
|
||||||
|
@ -291,7 +291,7 @@ void DictListModel::filterDuplicates()
|
||||||
QSet< QString > ids;
|
QSet< QString > ids;
|
||||||
bool doReset = false;
|
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() );
|
QString id = QString::fromStdString( dictionaries.at( i )->getId() );
|
||||||
|
|
||||||
|
@ -349,31 +349,11 @@ std::vector< sptr< Dictionary::Class > > const &
|
||||||
|
|
||||||
void DictListWidget::dropEvent ( QDropEvent * event )
|
void DictListWidget::dropEvent ( QDropEvent * event )
|
||||||
{
|
{
|
||||||
DictListWidget * sourceList = dynamic_cast< DictListWidget* > ( event->source() );
|
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 );
|
QListView::dropEvent( event );
|
||||||
|
|
||||||
if ( sourceList && sourceList->model.sourceModel() && ( sourceList != this ) )
|
if ( sourceList != this )
|
||||||
{
|
{
|
||||||
model.filterDuplicates();
|
model.filterDuplicates();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue