Skip to content

WIP: Bugfix: Keep canvas position on show canvas only

I already made the logic in python so figured might as well patch it. I haven't tested it on windows build yet(will do that tomorrow as it is getting late) and some mac testing would be nice since I don't have a mac.


This patch checks the position of the mdiArea before and after activating 'show canvas only' mode and moves any subwindow that is not maximized to the same absolute global position. Any subwindow that is maximized, or in tab mode, the scrollbar is adjusted to the same position.

Note: Any maximized subwindow or tab that is set to a non-constant zoom mode(ex. Fit Page) will be ignored. As it is assumed the user wishes to resize the canvas to fit.

Fixes Bug#392225

Test Plan

Tab MultiDocument Mode

  1. Open a new document, press tab. It should resize to fit the screen as default. Press tab to go back.
  2. Resize the document to a constant percent zoom, like 100%. Press tab. The position of canvas should remain. press tab to go back. It should also remain.
  3. Open another document and resize it to a constant percent zoom. Press tab. Switch documents. Both canvases should retain their position. Press tab to go back. Again both canvases should retain their position.

Subwindow MultiDocument Mode

  1. Open a new document, make sure the sub window is maximized and page is to fit.
  2. Open another document, this one should not be maximized. Press tab. The first document will resize, while the 2nd document subwindow should retain its position.
  3. Go back to the first document, and make it a constant percent zoom. Then bring the 2nd document subwindow to the front. Press tab. Both documents should retain their position on the screen.

Extra

  1. Go into Configure Krita and in Canvas-Only settings, uncheck the Menu.
  2. Repeat the above tests. Despite the additional menu, position should remain.

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.

Merge request reports