diff --git a/src/groups_widgets.cc b/src/groups_widgets.cc index 885ca9c0..58c68743 100644 --- a/src/groups_widgets.cc +++ b/src/groups_widgets.cc @@ -134,19 +134,19 @@ QVariant DictListModel::data( QModelIndex const & index, int role ) const // return true; //} -bool DictListModel::removeRows( int row, int count, - const QModelIndex & parent ) -{ - if ( isSource ) - return false; - - beginRemoveRows( parent, row, row + count - 1 ); - dictionaries.erase( dictionaries.begin() + row, - dictionaries.begin() + row + count ); - endRemoveRows(); - - return true; -} +//bool DictListModel::removeRows( int row, int count, +// const QModelIndex & parent ) +//{ +// if ( isSource ) +// return false; +// +// beginRemoveRows( parent, row, row + count - 1 ); +// dictionaries.erase( dictionaries.begin() + row, +// dictionaries.begin() + row + count ); +// endRemoveRows(); +// +// return true; +//} bool DictListModel::setData( QModelIndex const & index, const QVariant & value, int role ) @@ -301,13 +301,27 @@ void DictListWidget::dropEvent ( QDropEvent * event ) { DictListWidget * sourceList = dynamic_cast< DictListWidget* > ( event->source() ); - if ( sourceList && sourceList->model.sourceModel() ) + if ( sourceList == this ) { - model.addSelectedUniqueFromModel( sourceList->selectionModel() ); + event->accept(); return; } - QListView::dropEvent( event ); + if ( sourceList && sourceList->model.sourceModel() ) + { + model.addSelectedUniqueFromModel( sourceList->selectionModel() ); + event->ignore(); + return; + } + + if ( sourceList && model.sourceModel() ) + { + sourceList->model.removeSelectedRows( sourceList->selectionModel() ); + event->ignore(); + return; + } + + //QListView::dropEvent( event ); } // DictGroupsWidget diff --git a/src/groups_widgets.hh b/src/groups_widgets.hh index 6dbabb1d..23d40af7 100644 --- a/src/groups_widgets.hh +++ b/src/groups_widgets.hh @@ -41,7 +41,7 @@ public: int rowCount( QModelIndex const & parent ) const; QVariant data( QModelIndex const & index, int role ) const; //bool insertRows( int row, int count, const QModelIndex & parent ); - bool removeRows( int row, int count, const QModelIndex & parent ); + //bool removeRows( int row, int count, const QModelIndex & parent ); bool setData( QModelIndex const & index, const QVariant & value, int role ); Qt::DropActions supportedDropActions() const;