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
255255 QgsFields f = QgsOgrUtils::stringToFields ( string, QTextCodec::codecForName ( " System" ) );
256256 if ( f.size () < 1 )
257257 {
258+ if ( string.isEmpty () )
259+ {
260+ return f;
261+ }
262+
258263 // wkt?
259264 QStringList lines = string.split ( " \n " );
260265 if ( lines.size () > 0 )
261266 {
262267 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+
263274 for ( int i = 0 ; i < fieldNames.size (); ++i )
264275 {
265276 QString fieldName = fieldNames.at ( i );
Original file line number Diff line number Diff line change @@ -241,10 +241,10 @@ void TestQgisAppClipboard::pasteWkt()
241241 QCOMPARE ( point->x (), 125.0 );
242242 QCOMPARE ( point->y (), 10.0 );
243243
244- // only fields => no geom so no feature list is returned
244+ // clipboard now supports features without geometry
245245 mQgisApp ->clipboard ()->setText ( QStringLiteral ( " MNL 11 282 km \n MNL 11 347.80000000000001 km " ) );
246246 features = mQgisApp ->clipboard ()->copyOf ();
247- QCOMPARE ( features.length (), 0 );
247+ QCOMPARE ( features.length (), 2 );
248248}
249249
250250void TestQgisAppClipboard::pasteGeoJson ()
You can’t perform that action at this time.
0 commit comments