Bug report #7998
Loading of .qml style can not be cancelled
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||16848|
When loading a style from .qml in the vector properties dialog, there is no indication to the user that it is not a cancel-able action. Upon loading the style, then clicking Cancel, the canvas is not refreshed, so it appears to the user that no change has occurred, i.e. the cancel appears to have reverted the application of the .qml style.
However, on the first canvas refresh the .qml style is applied. This is because the style has been applied directly to the layer's properties, not the vector layer properties dialog's form fields, so cancelling the dialog after applying a style does not revert the application of the style. Closing the project without saving and reopening the project is the only recourse (if caught in time).
Since the current method of loading a .qml style is good, except this bug, a possible solution might be to save a temporary .qml file (in memory or on disk) of the current layer's style just before loading a new one, when using the properties dialog. Then upon cancelling the properties dialog, the original .qml style is reapplied to the layer, unless Apply has been clicked, which should clear/delete the original temporary style.
That approach is not ideal, since the layer is edited twice, when in actuality nothing has changed, but it should work.
I noticed this issue with the vector layer properties dialog. It may also be an issue with raster layer properties and when loading .sld style files.