Fix cyclic dependencies in Image Size dialog
ClosedPublic

Authored by dkazakov on Jun 13 2017, 2:29 PM.

Details

Summary

This patch does quite big changes to Image Size dialog, so I would like
you to review and test it. The original bug it fixes is:

  1. Create an image 3000x2000 @ 200ppi
  2. Open Image Size dialog
  3. You'll see the size 2999x1999

It happened due to the cyclic updates in a chain
Pixel Size->Print Size->Pixel Size and the rounding that
happened during it.

The patch introduces the following fixes:

  1. The patch uses KisAspectRatioLocker and KisAcyclicSignalConnector which break update loop that caused these rounding errors.
  1. The patch removed double-boxes for choosing units. Now the user can select the unit by clicking on a single combo box.
  1. Fixes Maximum/Minimum updates of the print size fields. They depend on the current resolution, and it was never handled properly.
  1. Fixes the number of decimals and single step size for the Pixel Size fields. They should vary depending on the current unit.
  1. Add a feedback aout locked Print Size aspect ratio when the print size is modified separately.

A list of utility commits:

  • Implement "Coordinated Acyclic Connectors"

    Coordinated acyclic connectors allow the user to create a group of signal connections that block each other and forbid recursive signal calls.
  • Fix KisAspectRatioLocker to handle Unit spin boxes correctly

    value() and setValue() calls in QDoubleSpinBox are *not* virtual! In SliderWrapper we basically implement 'vtable' functionality, but it was implemented in an incorrect way: the pointers should be type-cast in a ascending inheritance order.
Test Plan
  1. Check pixel->print conversion, with and without keep aspect ratio option
  2. Check print->pixel conversion, with and without keep aspect ratio option
  3. Check switching units with a checkbox
  4. Check switching units by typing a unit in a text box
  5. Check synchronization of fields when "Modify print size separately" is active.

Diff Detail

Repository
R37 Krita
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
dkazakov created this revision.Jun 13 2017, 2:29 PM
dkazakov edited the summary of this revision. (Show Details)Jun 13 2017, 2:30 PM
dkazakov edited the summary of this revision. (Show Details)
rempt accepted this revision.Jun 14 2017, 8:19 AM

I've just tested it and I can find no regressions.

This revision is now accepted and ready to land.Jun 14 2017, 8:19 AM
This revision was automatically updated to reflect the committed changes.