Skip to content

Commit

Permalink
Merge pull request #2592 from alexbruy/layertree-drag-n-drop
Browse files Browse the repository at this point in the history
add CopyAction to the list of supported drop actions in the Layer Tree
  • Loading branch information
alexbruy committed Jan 28, 2016
2 parents ecfcd31 + b66002d commit 82c9a5a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/core/layertree/qgslayertreemodel.cpp
Expand Up @@ -915,7 +915,7 @@ void QgsLayerTreeModel::recursivelyEmitDataChanged( const QModelIndex& idx )

Qt::DropActions QgsLayerTreeModel::supportedDropActions() const
{
return Qt::MoveAction;
return Qt::CopyAction | Qt::MoveAction;
}

QStringList QgsLayerTreeModel::mimeTypes() const
Expand Down
5 changes: 3 additions & 2 deletions src/gui/layertree/qgscustomlayerorderwidget.cpp
Expand Up @@ -39,8 +39,8 @@ QgsCustomLayerOrderWidget::QgsCustomLayerOrderWidget( QgsLayerTreeMapCanvasBridg
mView->setDragEnabled( true );
mView->setAcceptDrops( true );
mView->setDropIndicatorShown( true );
mView->setDragDropMode( QAbstractItemView::InternalMove );
mView->setSelectionMode( QAbstractItemView::ExtendedSelection );
mView->setDefaultDropAction( Qt::MoveAction );

mView->setModel( mModel );

Expand Down Expand Up @@ -91,6 +91,7 @@ void QgsCustomLayerOrderWidget::modelUpdated()
}



///@cond PRIVATE

CustomLayerOrderModel::CustomLayerOrderModel( QgsLayerTreeMapCanvasBridge* bridge, QObject* parent )
Expand Down Expand Up @@ -155,7 +156,7 @@ Qt::ItemFlags CustomLayerOrderModel::flags( const QModelIndex& index ) const

Qt::DropActions CustomLayerOrderModel::supportedDropActions() const
{
return Qt::MoveAction;
return Qt::CopyAction | Qt::MoveAction;
}

QStringList CustomLayerOrderModel::mimeTypes() const
Expand Down
1 change: 1 addition & 0 deletions src/gui/layertree/qgslayertreeview.cpp
Expand Up @@ -38,6 +38,7 @@ QgsLayerTreeView::QgsLayerTreeView( QWidget *parent )
setExpandsOnDoubleClick( false ); // normally used for other actions

setSelectionMode( ExtendedSelection );
setDefaultDropAction( Qt::MoveAction );

connect( this, SIGNAL( collapsed( QModelIndex ) ), this, SLOT( updateExpandedStateToNode( QModelIndex ) ) );
connect( this, SIGNAL( expanded( QModelIndex ) ), this, SLOT( updateExpandedStateToNode( QModelIndex ) ) );
Expand Down

0 comments on commit 82c9a5a

Please sign in to comment.