Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Fix pasting features to new layer doesn't paste fields
- Loading branch information
Showing
with
24 additions
and
1 deletion.
-
+20
−0
src/app/qgsclipboard.cpp
-
+4
−1
src/app/qgsclipboard.h
|
@@ -148,6 +148,12 @@ QString QgsClipboard::generateClipboardText() const |
|
|
|
|
|
void QgsClipboard::setSystemClipboard() |
|
|
{ |
|
|
// avoid overwriting internal clipboard - note that on Windows, the call to QClipboard::setText |
|
|
// below doesn't immediately trigger QClipboard::dataChanged, and accordingly the call to |
|
|
// systemClipboardChanged() is delayed. So by setting mIgnoreNextSystemClipboardChange we indicate |
|
|
// that just the next call to systemClipboardChanged() should be ignored |
|
|
mIgnoreNextSystemClipboardChange = true; |
|
|
|
|
|
QString textCopy = generateClipboardText(); |
|
|
|
|
|
QClipboard *cb = QApplication::clipboard(); |
|
@@ -323,8 +329,22 @@ QByteArray QgsClipboard::data( const QString &mimeType ) const |
|
|
return QApplication::clipboard()->mimeData()->data( mimeType ); |
|
|
} |
|
|
|
|
|
QgsFields QgsClipboard::fields() const |
|
|
{ |
|
|
if ( !mUseSystemClipboard ) |
|
|
return mFeatureFields; |
|
|
else |
|
|
return retrieveFields(); |
|
|
} |
|
|
|
|
|
void QgsClipboard::systemClipboardChanged() |
|
|
{ |
|
|
if ( mIgnoreNextSystemClipboardChange ) |
|
|
{ |
|
|
mIgnoreNextSystemClipboardChange = false; |
|
|
return; |
|
|
} |
|
|
|
|
|
mUseSystemClipboard = true; |
|
|
emit changed(); |
|
|
} |
|
@@ -132,7 +132,7 @@ class APP_EXPORT QgsClipboard : public QObject |
|
|
/** |
|
|
* Source fields |
|
|
*/ |
|
|
QgsFields fields() const { return !mUseSystemClipboard ? mFeatureFields : retrieveFields(); } |
|
|
QgsFields fields() const; |
|
|
|
|
|
private slots: |
|
|
|
|
@@ -180,6 +180,9 @@ class APP_EXPORT QgsClipboard : public QObject |
|
|
QgsCoordinateReferenceSystem mCRS; |
|
|
QPointer<QgsVectorLayer> mSrcLayer; |
|
|
|
|
|
//! True if next system clipboard change should be ignored |
|
|
bool mIgnoreNextSystemClipboardChange = false; |
|
|
|
|
|
//! True when the data from the system clipboard should be read |
|
|
bool mUseSystemClipboard = false; |
|
|
|
|
|