mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-07 00:15:48 -04:00
added change signal to clipboard
This commit is contained in:
parent
250df51994
commit
0a3313d317
@ -171,6 +171,7 @@ SET (QGIS_APP_MOC_HDRS
|
||||
qgsattributetabledialog.h
|
||||
qgsbookmarks.h
|
||||
qgsbrowserdockwidget.h
|
||||
qgsclipboard.h
|
||||
qgsconfigureshortcutsdialog.h
|
||||
qgscustomization.h
|
||||
qgscustomprojectiondialog.h
|
||||
|
@ -573,6 +573,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent,
|
||||
mLogDock->hide();
|
||||
|
||||
mInternalClipboard = new QgsClipboard; // create clipboard
|
||||
connect( mInternalClipboard, SIGNAL( changed() ), this, SLOT( clipboardChanged() ) );
|
||||
mQgisInterface = new QgisAppInterface( this ); // create the interfce
|
||||
|
||||
#ifdef Q_WS_MAC
|
||||
@ -5483,7 +5484,6 @@ void QgisApp::editCut( QgsMapLayer * layerContainingSelection )
|
||||
selectionVectorLayer->beginEditCommand( tr( "Features cut" ) );
|
||||
selectionVectorLayer->deleteSelectedFeatures();
|
||||
selectionVectorLayer->endEditCommand();
|
||||
activateDeactivateLayerRelatedActions( activeLayer() );
|
||||
}
|
||||
|
||||
void QgisApp::editCopy( QgsMapLayer * layerContainingSelection )
|
||||
@ -5499,9 +5499,12 @@ void QgisApp::editCopy( QgsMapLayer * layerContainingSelection )
|
||||
|
||||
// Test for feature support in this layer
|
||||
clipboard()->replaceWithCopyOf( selectionVectorLayer );
|
||||
activateDeactivateLayerRelatedActions( activeLayer() );
|
||||
}
|
||||
|
||||
void QgisApp::clipboardChanged()
|
||||
{
|
||||
activateDeactivateLayerRelatedActions( activeLayer() );
|
||||
}
|
||||
|
||||
void QgisApp::editPaste( QgsMapLayer *destinationLayer )
|
||||
{
|
||||
|
@ -1129,6 +1129,8 @@ class QgisApp : public QMainWindow, private Ui::MainWindow
|
||||
void osmImportDialog();
|
||||
void osmExportDialog();
|
||||
|
||||
void clipboardChanged();
|
||||
|
||||
signals:
|
||||
/** emitted when a key is pressed and we want non widget sublasses to be able
|
||||
to pick up on this (e.g. maplayer) */
|
||||
|
@ -18,6 +18,7 @@
|
||||
#include <fstream>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QObject>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QClipboard>
|
||||
@ -33,7 +34,8 @@
|
||||
#include "qgsvectorlayer.h"
|
||||
|
||||
QgsClipboard::QgsClipboard()
|
||||
: mFeatureClipboard()
|
||||
: QObject()
|
||||
, mFeatureClipboard()
|
||||
, mFeatureFields()
|
||||
{
|
||||
}
|
||||
@ -55,6 +57,7 @@ void QgsClipboard::replaceWithCopyOf( QgsVectorLayer *src )
|
||||
QgsDebugMsg( "replaced QGis clipboard." );
|
||||
|
||||
setSystemClipboard();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QgsClipboard::replaceWithCopyOf( QgsFeatureStore & featureStore )
|
||||
@ -64,6 +67,7 @@ void QgsClipboard::replaceWithCopyOf( QgsFeatureStore & featureStore )
|
||||
mFeatureClipboard = featureStore.features();
|
||||
mCRS = featureStore.crs();
|
||||
setSystemClipboard();
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QgsClipboard::setSystemClipboard()
|
||||
@ -149,6 +153,7 @@ void QgsClipboard::clear()
|
||||
mFeatureClipboard.clear();
|
||||
|
||||
QgsDebugMsg( "cleared clipboard." );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
void QgsClipboard::insert( QgsFeature& feature )
|
||||
@ -156,6 +161,7 @@ void QgsClipboard::insert( QgsFeature& feature )
|
||||
mFeatureClipboard.push_back( feature );
|
||||
|
||||
QgsDebugMsg( "inserted " + feature.geometry()->exportToWkt() );
|
||||
emit changed();
|
||||
}
|
||||
|
||||
bool QgsClipboard::empty()
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
#include <QList>
|
||||
#include <QMap>
|
||||
#include <QObject>
|
||||
|
||||
#include "qgsfield.h"
|
||||
#include "qgsfeature.h"
|
||||
@ -49,8 +50,9 @@ class QgsVectorLayer;
|
||||
*/
|
||||
#define QGSCLIPBOARD_STYLE_MIME "application/qgis.style"
|
||||
|
||||
class QgsClipboard
|
||||
class QgsClipboard : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
/**
|
||||
* Constructor for the clipboard.
|
||||
@ -139,6 +141,10 @@ class QgsClipboard
|
||||
*/
|
||||
const QgsFields &fields() { return mFeatureFields; }
|
||||
|
||||
signals:
|
||||
/** Emited when content changed */
|
||||
void changed();
|
||||
|
||||
private:
|
||||
/*
|
||||
* Set system clipboard from previously set features.
|
||||
|
Loading…
x
Reference in New Issue
Block a user