kart-qgis-plugin icon indicating copy to clipboard operation
kart-qgis-plugin copied to clipboard

Error occurred when using "Swipe" diff type to show the changes

Open elinaw123 opened this issue 1 year ago • 2 comments

Describe the bug An error occurred when using "Swipe" diff type to show the changes under the "Geometries" tab.

To Reproduce Steps to reproduce the behavior:

  1. Import a point layer from PostGIS
  2. Add one extra point
  3. Select "Show working copy changes for this dataset..."
  4. See error

Expected behavior I expected to see the before and after changes in a split window.

Screenshots image

Version info (this is important!): Kart Plugin version 1.0.14 QGIS version 3.34.6-Prizren Operating system Windows 11 10.0.22631 SP0 Kart version Kart v0.15.2, Copyright (c) Kart Contributors » GDAL v3.8.5; PROJ v9.4.0; PDAL v2.6.0 » PyGit2 v1.12.1; Libgit2 v1.6.4; Git v2.45.1.7.g5be46a8262; Git LFS v3.3.0 » SQLAlchemy v1.4.45; pysqlite3 v2.6.0/v3.45.3; SpatiaLite v5.1.0; Libpq v16.0.2

elinaw123 avatar Jul 10 '24 03:07 elinaw123

I can reproduce the bug (appeared during workshop on QGIS UC 2024). After closing the error dialog it will pop-up again, forcing users to kill the entire QGIS instance.

jakimowb avatar Sep 10 '24 11:09 jakimowb

As a blind bruteforce fix you can replace the paint function in gui/swipemap.py with this:

    def paint(self, painter, *args):  # NEED *args for WINDOWS!
        if len(self.layers) == 0 or self.length == -1 or self.image is None:
            return

        if self.isVertical:
            h = self.image.height() - 2
            w = self.length
            line = QLine(int(w) - 1, 0, int(w) - 1, int(h) - 1)
        else:
            h = self.image.height() - self.length
            w = self.image.width() - 2
            line = QLine(0, int(h) - 1, int(w) - 1, int(h) - 1)

        image = self.image.copy(0, 0, int(w), int(h))
        painter.drawImage(QRect(0, 0, int(w), int(h)), image)
        painter.drawLine(line)

kannes avatar Sep 10 '24 12:09 kannes

Thanks!

hamishcampbell avatar Oct 31 '24 20:10 hamishcampbell