Skip to content

Zoom fit with margins

(Tell us what you did!)

This is an amateur attempt at implementing a "beginner coding task"; features mentioned in BUG#381537 "Zoom fit with margins?".

  1. It adds margins to the canvas when using a fit-to-page zoom mode, with the width being configurable in the settings dialog.
  2. It adds an action to toggle between the current fit-to-page mode and the previous constant zoom level.

The features seem to work, but I don't know much about code and UI quality/style and those most likely need changes. (In fact, the UI is not as intended because I made a mistake merging code, and I apologize for that.)

Test Plan

(Tell us how to test the changes you made.)

Open an image.

  1. Configure the margin in the settings under General/Tools. Set the zoom level to fit page/width/height and confirm there is a margin of the proper width.
  2. Configure a hotkey for the Toggle Zoom Fit to Page action (` for example). Change the zoom level and invoke the action to confirm toggling between constant and fit-page zoom levels.

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 Dmitry Kazakov

Merge request reports