Bug report #16327

"Edit Create Options" dialogue doesn't handle whitespace correctly

Added by Mira Ressel over 7 years ago. Updated over 7 years ago.

Status:Closed
Priority:Low
Assignee:-
Category:GUI
Affected QGIS version:2.18.4 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:24237

Description

In the "Settings -> Options -> GDAL -> Edit Create Options" dialogue, it is possible to create new profiles with GDAL parameters. The names of the predefined profiles contain spaces (e.g. "No Compression"), but when one creates a new profile with a space-containing name, QGIS splits the name into words and creates a separate profile for every word. None of those profiles contains any settings.

Of course, this doesn't cause any usability issues (as long as the profile title doesn't contain whitespace, everything works fine), but it is nevertheless weird behaviour which should be avoided.

I assume this bug is caused by the split() function call in QgsRasterFormatSaveOptionsWidget::profiles() (src/gui/qgsrasterformatsaveoptionswidget.cpp).

Associated revisions

Revision b9bd66d2
Added by Alexander Bruy over 7 years ago

store profiles as QStringList to avoid issues with spaces (fix #16327)

Revision 38ed0e5c
Added by Alexander Bruy over 7 years ago

Merge pull request #4568 from alexbruy/gdal-profiles

store profiles as QStringList to avoid issues with spaces (fix #16327)

History

#1 Updated by Giovanni Manghi over 7 years ago

  • Category set to GUI

Can't find a better category other than GUI...

#2 Updated by Ismail Sunni over 7 years ago

I tried to fix this issue. The problem lies on how QGIS stores list of profiles. It store as concatenation of all profiles with space. That's why it needs split function to get each of them.
The reason there is `No compression` is QGIS has a hard coded code to treat those default profiles. It stores in special way (e.g z_gtiff_1big for `No Compression`). Thus, it will be read properly and showed properly in the combo box because of the hard coded.

Short solution, do not use `space`. Long term solution, need to update how QGIS store the list of profiles. For example, replacing `space` with underscore before store it the the QSettings. But it will be a problem if we use `underscore` as the profile name. Or similar string manipulation (replacing space with double space).

#3 Updated by Giovanni Manghi over 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#4 Updated by Alexander Bruy over 7 years ago

  • Description updated (diff)
  • Pull Request or Patch supplied changed from No to Yes

#5 Updated by Alexander Bruy over 7 years ago

  • Status changed from Open to In Progress

#6 Updated by Alexander Bruy over 7 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Closed

Also available in: Atom PDF