Rewrite KoDockWidgetTitleBar to use QHBoxLayout
Instead of custom-painting the title text and positioning the buttons manually, just use a label for the title and use a QHBoxLayout to position everything. This has these advantages:
- Title doesn't overlap with buttons anymore
- Title can be elided by ellipsis, and the full title can be shown in a tooltip
- We can allow the docker to become narrower without breaking the visuals too much
- The button layout is no longer broken in RTL
The minimum size calculation still uses some of the original code and we still do funky stuff to calculate the button size, but this shouldn't be a huge problem.
Note: I don't know how this behaves with the Breeze theme as I only tested with the appimage docker. If anyone can test, please do!
Supersedes !1264 (closed)
CC @timotheegiet @scottpetrovic
Test Plan
- Check that dockers can get narrower than the title text.
- Check that dockers cannot get too narrow to the point it is not even visible at all.
- Check that the title bar layout doesn't get messed up.
Formalities Checklist
-
I confirmed this builds. -
I confirmed Krita ran and the relevant functions work. - n/a 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.