Skip to content

Pop-up Palette improvements

Mathias Wein requested to merge mwein/krita:popup-palette-settings-take2 into master

What originally was supposed to just add some new options turned out to be mostly code refurbishing. Calculations were somewhat all over the place, and some bugs and regressions also surfaced while rebasing my code that was lying here for a year now...

Code fixes/improvements:

  • After the Palette and Brush HUD were combined into one widget upstream, there were once again resizing issues. Widget size is now controlled by the layout, that way it reacts directly to size hint/constraint changes of the HUD part.
  • The "spinning triangle" selector had some rendering issues, the circle was rendered one pixel too large (and hence cut off), and the triangle didn't antialias properly. Furthermore, the triangle rendering triggered an assert at certain sizes, due to passing an invalid QColor to a conversion function.
  • The palette was repainted on every mouse/pen move which wasted a lot of CPU cycles. It should now only paint when the hovered brush preset or color changes.
  • The tooltip was also updated on every mouse/pen move, which also seem to eat a lot of CPU cycles

New features:

  • Palette and Selector size are now configurable (new page in configuration dialog)
  • A third preset layout variant can make better use of available space in certain configurations
  • The option to use KisVisualColorSelector instead of KoTriangleColorSelector which required editing kritarc is now accessible in the settings dialog
  • The maxmimum number of brush presets is now 45 instead of 30

Open questions:

Click to expand
  • should there be an extra button for the settings dialog (see image) or is it too much UI clutter? Currently people need to access it through the brush HUD's button
  • Should the settings be embedded into the "Configure Krita" dialog? If so, how/where? Is it worth a separate KisPreferenceSet?
  • I tried to extend the Brush HUD configuration to have access to all brush engines rather than only the one of the current preset. But I had to find out that using KisPaintOpRegistry::instance()->defaultPreset(...) is not enough to query uniformProperties(), it crashes for reasons I can't quite track down. I could borrow the function to generate a new preset from the brush editor though...

popup_palette_fixes

Test Plan

Basically, try all combinations of sizes and preset counts that you can think of. While I think the current contraints should prevent a dysfunctional palette, some combinations are of questionable value, so maybe it needs additional constraints.

Also, the defaults and contraints are slightly different than before, so keep an eye on visual regressions.

The wording of the settings dialog also needs some review.

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 Mathias Wein

Merge request reports