Skip to content
Permalink
Browse files

Expose through iface methods to copy/paste features between given layers

That is, no need to load layers into the layer tree nor make them active.
  • Loading branch information
gacarrillor committed Nov 9, 2017
1 parent 75c41f5 commit 9aa1f2166897d08876153e0e760eaaad0fdf470b
Showing with 32 additions and 0 deletions.
  1. +10 −0 python/gui/qgisinterface.sip
  2. +10 −0 src/app/qgisappinterface.cpp
  3. +6 −0 src/app/qgisappinterface.h
  4. +6 −0 src/gui/qgisinterface.h
@@ -767,6 +767,16 @@ Start a blank project
:rtype: bool
%End

virtual void copyFeatures( QgsMapLayer * ) = 0;
%Docstring
Copy selected features from the layer to clipboard
%End

virtual void pasteFeatures( QgsMapLayer * ) = 0;
%Docstring
Paste features from clipboard to the layer
%End

virtual int addToolBarIcon( QAction *qAction ) = 0;
%Docstring
Add an icon to the plugins toolbar
@@ -186,6 +186,16 @@ bool QgisAppInterface::setActiveLayer( QgsMapLayer *layer )
return qgis->setActiveLayer( layer );
}

void QgisAppInterface::copyFeatures( QgsMapLayer *layer )
{
return qgis->editCopy( layer );
}

void QgisAppInterface::pasteFeatures( QgsMapLayer *layer )
{
return qgis->editPaste( layer );
}

void QgisAppInterface::addPluginToMenu( const QString &name, QAction *action )
{
qgis->addPluginToMenu( name, action );
@@ -96,6 +96,12 @@ class APP_EXPORT QgisAppInterface : public QgisInterface
//! set the active layer (layer selected in the legend)
bool setActiveLayer( QgsMapLayer *layer ) override;

//! Copy selected features from the layer to clipboard
virtual void copyFeatures( QgsMapLayer *layer ) override;

//! Paste features from clipboard to the layer
virtual void pasteFeatures( QgsMapLayer *layer ) override;

//! Add an icon to the plugins toolbar
int addToolBarIcon( QAction *qAction ) override;

@@ -422,6 +422,12 @@ class GUI_EXPORT QgisInterface : public QObject
*/
virtual bool setActiveLayer( QgsMapLayer * ) = 0;

//! Copy selected features from the layer to clipboard
virtual void copyFeatures( QgsMapLayer * ) = 0;

//! Paste features from clipboard to the layer
virtual void pasteFeatures( QgsMapLayer * ) = 0;

//! Add an icon to the plugins toolbar
virtual int addToolBarIcon( QAction *qAction ) = 0;

0 comments on commit 9aa1f21

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