Skip to content

Make KisGenericGradientEditor update the gradient when the fg or bg color changes

Deif Lou requested to merge deiflou/krita:deiflou/gradient_editor_fg_bg into master

This tries to solve BUG:438403, which is a wish to make the generic gradient editor update the current gradient if it uses the FG or BG colors and any of them are changed (for example via the advanced color picker when one has the gradient map filter dialog open).

  • The only way I found to make it work was to make the KoCanvasResourcesInterface inherit from QObject and add a canvasResourceChanged signal to it. Every gradient widget uses KoCanvasResourcesInterface to retrieve the FG/BG colors and had no way to be notified of changes. This seemed to me the most straightforward way of implementing the feature, although it makes the class less lightweight.
  • One issue is that the gradient preset chooser does not update. I think someone with more expertise with resources should look at it and change it, or tell me how to do it.
  • Another issue is that this feature is kind of useless for example when editing a gradient fill layer, since the FG/BG colors and the color pickers change the color space to gray.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.
Edited by Halla Rempt

Merge request reports

Loading