Skip to content

Revamp selection tools' options

This MR's first purpose was to add the "grow" and "feather" options to all the selection tools, as requested here. Then I decided to make all the selection tools' widgets more consistent. Here is a video showcasing the changes.

I'll explain the changes I made by commit:

  1. I added a new widget that unifies and encapsulates the functionality of those button strips found in the selection tools. Basically, the new KisOptionButtonStrip uses KoGroupButtonand QButtonGroup under the hood, just as you would use without this new widget. Then I changed the fill and enclose fill tool option widgets to use it, to make the overall look consistent without having to repeat code.

  2. I ported all the selection tools to the new KisOptionCollectionWidget, as I did in the fill tool.

  3. I implemented the "grow" and "feather" selection options in all tools, and antialias in the "similar selection tool". These options are stored in the config per tool, like the "sampling" options, they are not shared between tools. It is easy to make them shared like the "mode" and "action" options, but I think they are better independent, since the user may want them to be different between tools.
    NOTE: There is an issue here. For some reason I'm getting the following safe assert in all the selection tools but the contiguous selection tool (the tools that now implement grow/feather): SAFE ASSERT (krita): "boundsRect != KisDefaultBounds().bounds()" in file [...]/libs/image/kis_convolution_painter.cc, line 154.
    One can check the code in the KisToolSelectRectangular::finishRect since it is simpler, but it is mostly the same in all the selection tools so the fix should resolve the issues in all the tools. And of course, it only happens when the feather is greater than 0.

  4. I found that when one closes an image and open another one, or just switches from one image to another, the tool options docker can show some weird vertical spacing for some tools. This may be related to the use of a "special spacer". I just wrapped the docker contents in a new box layout and added a stretch item to solve that. It works, but it's kind of a temporary hack. I think that all that "special spacer" stuff should be rethinked.

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 Deif Lou

Merge request reports