Bug report #16327
"Edit Create Options" dialogue doesn't handle whitespace correctly
|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|
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).
#2 Updated by Ismail Sunni over 4 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).