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