Bug report #6229

changing existing symbol or color ramp does not work in new style manager

Added by Etienne Tourigny about 8 years ago. Updated about 8 years ago.

Status:Closed
Priority:Normal
Assignee:Arunmozhi P
Category:Symbology
Affected QGIS version:master Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed
Crashes QGIS or corrupts data:No Copied to github as #:15538

Description

Title says it all - existing items (either symbol or color ramp) can be modified in the new style manager, but this is not saved, therefore lost when qgis is restarted.

related issue: 6222

style-fix.patch Magnifier (20.7 KB) Arunmozhi P, 2012-08-22 10:34 AM


Related issues

Related to QGIS Application - Bug report #6222: implement QgsStyleV2::save() Closed 2012-08-19

History

#1 Updated by Arunmozhi P about 8 years ago

  • Status info set to Working on fix
  • % Done changed from 0 to 10

#2 Updated by Arunmozhi P about 8 years ago

  • File save_symbols_colorramps.patch added
  • Pull Request or Patch supplied changed from No to Yes
  • % Done changed from 10 to 90
  • Status info changed from Working on fix to Fix in Patch

Patch added.

#3 Updated by Etienne Tourigny about 8 years ago

looks nice - I'll test it out tonight and commit. thanks

#4 Updated by Etienne Tourigny about 8 years ago

This patch doesn't work, because new symbols are not saved.

Here is what happens:

- addSymbol() adds the symbol name to the style symbol list
- saveSymbol() detects the name already present, so it creates the sql query with UPDATE - this does nothing because symbol is not yet in the DB.

Some reworking has to be done in the db handling, with one solution of the following:

1) any add/modify/delete operations should sync with DB immediately (e.g. addSymbol() also adds to the DB)
2) any DB operations are done when dialog closes with a new function syncDB() - this loops through all symbols

1) former is easier, 2) is on par with previous behaviour

cheers
Etienne

#5 Updated by Arunmozhi P about 8 years ago

Hi,

Sorry for that buggy patch. I am attaching a new one. This contains two commits of data, one commit has a lot of doc about the functions in QgsStyleV2 (sorry for issue-jacking here). The second one has the extra function updateSymbol and necessary flag params in the addSymbol and addColorRamp.

I thought of issuing a github pull request when I wrote the docs, since the issue added up I am putting it up as patch.

I tested, it safely adds as well as updates. Kindly test and add it to master if found OK.

#6 Updated by Arunmozhi P about 8 years ago

  • File deleted (save_symbols_colorramps.patch)

#7 Updated by Etienne Tourigny about 8 years ago

can yoou file this a pull request in 2 separate commits? That way credit goes to you!
Etienne

#8 Updated by Etienne Tourigny about 8 years ago

  • % Done changed from 90 to 100
  • Resolution set to fixed

Fixed in trunk, b145998078 (by me) and 447c0d1 (by Arun). Creating new ramps did not work, so I updated addSymbol() and addColorRamp().

#9 Updated by Etienne Tourigny about 8 years ago

  • Status changed from Open to Closed

#10 Updated by Etienne Tourigny about 8 years ago

Found issue that new entry was added to db instead of changing old entry, fixed in 2ab844abf8302a489abe86a25a99b54f49ffd91e

Also available in: Atom PDF