Skip to content
Permalink
Browse files

Merge pull request #2592 from alexbruy/layertree-drag-n-drop

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 82c9a5ad3cb382aee647379313db2e09c170b53d
@@ -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
@@ -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 );

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



///@cond PRIVATE

CustomLayerOrderModel::CustomLayerOrderModel( QgsLayerTreeMapCanvasBridge* bridge, QObject* parent )
@@ -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
@@ -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 ) ) );

0 comments on commit 82c9a5a

Please sign in to comment.
You can’t perform that action at this time.