File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -255,11 +255,22 @@ QgsFields QgsClipboard::retrieveFields() const
255
255
QgsFields f = QgsOgrUtils::stringToFields ( string, QTextCodec::codecForName ( " System" ) );
256
256
if ( f.size () < 1 )
257
257
{
258
+ if ( string.isEmpty () )
259
+ {
260
+ return f;
261
+ }
262
+
258
263
// wkt?
259
264
QStringList lines = string.split ( " \n " );
260
265
if ( lines.size () > 0 )
261
266
{
262
267
QStringList fieldNames = lines.at ( 0 ).split ( " \t " );
268
+ // wkt / text always has wkt_geom as first attribute (however values can be NULL)
269
+ if ( fieldNames.at ( 0 ) != " wkt_geom" )
270
+ {
271
+ return f;
272
+ }
273
+
263
274
for ( int i = 0 ; i < fieldNames.size (); ++i )
264
275
{
265
276
QString fieldName = fieldNames.at ( i );
Original file line number Diff line number Diff line change @@ -241,10 +241,10 @@ void TestQgisAppClipboard::pasteWkt()
241
241
QCOMPARE ( point->x (), 125.0 );
242
242
QCOMPARE ( point->y (), 10.0 );
243
243
244
- // only fields => no geom so no feature list is returned
244
+ // clipboard now supports features without geometry
245
245
mQgisApp ->clipboard ()->setText ( QStringLiteral ( " MNL 11 282 km \n MNL 11 347.80000000000001 km " ) );
246
246
features = mQgisApp ->clipboard ()->copyOf ();
247
- QCOMPARE ( features.length (), 0 );
247
+ QCOMPARE ( features.length (), 2 );
248
248
}
249
249
250
250
void TestQgisAppClipboard::pasteGeoJson ()
You can’t perform that action at this time.
0 commit comments