Skip to content

Gradient Widgets Improvements

This MR adds a new generic gradient editor widget that is highly configurable. It makes use of already existing gradient related widgets and puts them together to ease the editing of the gradients.

Among other things this editor allows:

  • to set/get a stop or segment gradient (internally the right editor is used)
  • to show a gradient preset chooser, as a pop-up in a button or inline, that lets the user quickly choose a gradient from the resources
  • to convert from/to a stop gradient to/from a segment gradient
  • to setup the ui in different ways showing/hiding only the needed elements
  • to set the visualization mode of the presets (icons/list, small/large items, etc.)
  • to load/save the ui settings from/to the configuration
  • TODO: save the current gradient to the presets

To make this new editor the following had to be done:

  • Add some nullptr checks when using the canvas resources interface in KisStopGradientEditor and KisAutogradientEditor
  • Add functionality to KisAutogradientEditor (new constructor, setGradient, signal, etc.)
  • Add a function to KisResourceItemChooser to show/hide the storage button
  • Add functions to convert to/from different types of gradients

To showcase the new editor it was put in the new gradient generator configuration widget:

Screenshot_20201117_005903

Screenshot_20201117_010202

Screenshot_20201117_010337

Screenshot_20201117_010424

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