Skip to content

Draft: WIP Popup Palette Improvements

Various improvements + fixes to the popup palette. New to c++ so bear with me if anything is odd...

I added some configuration settings (I like a minimalistic popup palette) and dynamic slot count:


Also added a bottom bar toggle. Here are the different palette variations one could have. The defaults are still the same except for dynamic slot count which is now enabled by default.


I added the ability to snap to 15 degrees while rotating and also some slight improvements/changes to the handle and reset indicator:

Note: the weird opacity thing with the brush hud i think is a bug with Qt since the widget isn't doing anything odd when setting the opacity.


Also rewrote the algorithm to maximize space, make it more precise, and allow for a small margin between slots.

It works on the same principles as before but is much more complicated (mostly due to the space maximization when using three rows). Although hopefully still intelligible and also much easier to debug since the function can just be copy/pasted into the paint event so you can draw the points and see what the algorithm is doing with each "maximization".

But I totally understand if that particular change doesn't get accepted. It is possible to remove the space maximization part and just have a more accurate version of the earlier algorithm too, if there's any interest in that.

Here's a before/after. As you can see the big difference is when the ring is very wide + one/both rings are disabled. algorithm

WIP Stuff / Doubts

  • I re-used an existing icon for the color history reset button, should I make another one and what should it even look like? Also for some reason it looks slightly off center. Did not investigate why yet.
  • Given I've set out an area for buttons related specifically to the palette and that clicking the color indicators now switches them, I think it would be a good idea to add a reset fg/bg color button, although from what I could find, they don't have an icon but are drawn. So that would require an icon. I tried prototyping a non-button one, just drawing one close to the color indicators, but it just looked really weird.
  • The way rotation currently works is 0 at the top -> 270 to the left. But then from 270 to 360 it's -90 to 0. I know this doesn't matter but is a bit weird. I made the snap points follow this logic, but imo either 0 to 360, or 0 to 180 on the right and 0 to -179 on the left would make more sense I think.

Test Plan

I've added a temporary commit that provides some shortcuts (1-9) for quickly changing the variables to make sure the UI changes accordingly without having to go into the settings (focus must be on a widget). But they are just setting the local variables, the settings themselves should also be tested without this commit.

  • Remove temporary commit.

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!) Am on windows and could not get them to run.
  • 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 Alan North

Merge request reports