Skip to content

Bugfix 484889: Fix grids glitches when subdivision style is solid

Grum 999 requested to merge grum/krita:grum999/grids_and_guides_rectbug into master

Fix BUG:484889

Following KA post https://krita-artists.org/t/grids-guides-improvements/85979/16?u=grum999

Bug has been introduced with commit 76471979 (to fix bug 461912)

From Qt's documentation, setDashOffset() method implicitly converts the style of the pen to Qt::CustomDashLine. When current line style is solid, it seems the custom dash line is not solid anymore and is weirdly rendered; updated grid generate artifacts&glitches.

To avoid the problem, we need to check if style is solid or not before updating dash offset (then, do update only if not solid).

In addition, the original commit only 'fixed' dash offset problem for subdivision but not for main grid division; this commit fix both (main & subdivision) grids lines.

Test Plan

  1. Create a document, activate rectangular grid
  2. Set main & subdivision lines style as solid --> move cursor above grid: should be properly rendered
  3. Set main & subdivision lines style as dashed or dotted --> move cursor above grid: should be properly rendered (also: dash offset is correct)

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.

Reminder: the reviewer is responsible for merging the patch, this is to ensure at the least two people can build the patch. In case a patch breaks the build, both the author and the reviewer should be contacted to fix the build. If this is not possible, the commits shall be reverted, and a notification with the reasoning and any relevant logs shall be sent to the mailing list, kimageshop@kde.org.

Merge request reports