Skip to content

Class ClipboardManager

ClassList > ClipboardManager

More...

  • #include <clipboardmanager.h>

Inherits the following classes: QObject

Public Properties

Type Name
property bool holdsFeature

Public Signals

Type Name
signal void holdsFeatureChanged

Public Functions

Type Name
ClipboardManager (QObject * parent=nullptr)
Q_INVOKABLE void copyFeatureToClipboard (const QgsFeature & feature, bool includeGeometry=false)
Q_INVOKABLE void copyFeatureToClipboard (QgsVectorLayer * layer, QgsFeatureId fid, bool includeGeometry=false, bool isCutOperation=false)
bool holdsFeature () const
Q_INVOKABLE QgsFeature pasteFeatureFromClipboard ()
Q_INVOKABLE bool pasteFeatureFromClipboardIntoLayer (QgsVectorLayer * layer)
~ClipboardManager ()

Detailed Description

This class handles clipboard operations.

Public Properties Documentation

property holdsFeature [1/2]

bool ClipboardManager::holdsFeature;

Public Signals Documentation

signal holdsFeatureChanged

void ClipboardManager::holdsFeatureChanged;

Public Functions Documentation

function ClipboardManager

explicit ClipboardManager::ClipboardManager (
    QObject * parent=nullptr
) 

function copyFeatureToClipboard [1/2]

Q_INVOKABLE void ClipboardManager::copyFeatureToClipboard (
    const QgsFeature & feature,
    bool includeGeometry=false
) 

Copies a feature into the system's clipboard in both plain text as well as HTML.

Parameters:

  • feature the feature from which the attributes will be copied into memory
  • includeGeometry set to TRUE when a WKT string representation of the geometry should be included

function copyFeatureToClipboard [2/2]

Q_INVOKABLE void ClipboardManager::copyFeatureToClipboard (
    QgsVectorLayer * layer,
    QgsFeatureId fid,
    bool includeGeometry=false,
    bool isCutOperation=false
) 

Copies a feature into the system's clipboard in both plain text as well as HTML.

Parameters:

  • layer the vector layer associated to the feature
  • fid the id of the feature
  • includeGeometry set to TRUE when a WKT string representation of the geometry should be included
  • isCutOperation set to TRUE if this is a cut operation. In that case, when pasting into a different layer, the feature will be deleted from the original layer.

function holdsFeature [2/2]

inline bool ClipboardManager::holdsFeature () const

function pasteFeatureFromClipboard

Q_INVOKABLE QgsFeature ClipboardManager::pasteFeatureFromClipboard () 

Returns a feature with attributes and geometry matching clipboard values when a feature has been copied into the clipboard.


function pasteFeatureFromClipboardIntoLayer

Q_INVOKABLE bool ClipboardManager::pasteFeatureFromClipboardIntoLayer (
    QgsVectorLayer * layer
) 

Pastes the copied feature from the clipboard into the given editable layer. The feature is made compatible with the layer before being inserted. If the feature was previously cut and the destination layer differs from the source, the feature will be deleted from the original layer after paste.

Parameters:

  • layer destination vector layer

Returns:

TRUE if insertion was successful


function ~ClipboardManager

inline ClipboardManager::~ClipboardManager () 


The documentation for this class was generated from the following file src/core/clipboardmanager.h