Skip to content

Revamp Fill Tool options

This mr tries to improve the fill tool options. It has two main contributions: the fill options redesign itself and some generic/reusable classes that help with making that kind of ui.

The Fill Toll options redesign

These are the changes (see this Krita-Artists thread for the conversation that lead to this mr):

  • The new widget list classes are used.
  • The "fast mode" was removed. Internally it is still used if the right combination of options is set.
  • The widgets are relocated and grouped by function.
  • Now one can select to fill with the background color.
  • The color labels widgets were changed. Now it uses the same widget used to select the layer color label.
    • I made the KisColorLabelSelectorWidget more generic and added some functionality.
    • I simplified the rendering of the KisColorLabelButton. There were some issues with the corners and the margin/spacing was implemented in the painting itself instead of the layout that uses the buttons.
  • A "Reset" button was added to reset the options to their default values.

fill-tools-revamp-01

The widget list helper classes

This introduces two main classes that help creating some consistent list of widgets. It may seem overkill just to revamp the fill tool options, but I would like in the future to make all the tool options use the same mechanism to provide the options widget:

  • KisOptionCollectionWidget is a list of widgets that provide some extras:
    • The widgets are inserted with an id that can be used later to retrieve the widget by id instead of index.
    • The widgets can be hidden/shown "correctly". Just hiding a widget that is in a layout with QWidget::hide or QWidget::setVisible still leaves some spacing in the layout, making it look odd. This list widget shows/hides the widgets by adding/removing them to/from the layout and setting the visibility, so the end result looks better.
    • The orientation of the list can be changed from vertical to horizontal and viceversa. This allows to set a "recursive" flag, so that if the list contains some other KisOptionCollectionWidget or KisOptionCollectionWidgetWithHeader then their orientation can be also changed in a recursive fashion.
    • The list can show some separators between widgets.
  • KisOptionCollectionWidgetWithHeader is a wrapper class around a KisOptionCollectionWidget that also adds a header to the list. The header contains a title label and optionally a "primary widget". The primary widget is shown to the right of the label if there is enough space. If there isn't then it is moved bellow the title, so that it looks like if it was the first widget in the list.

The main idea is to have some generic mechanism to make these kind of "property pages", and maybe make the tool options system follow some predefined conventions. For example using something like these classes one can switch easily to an all-horizontal layout that would allow to implement some tool options toolbar:

fill-tools-revamp-02

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