kart-qgis-plugin
kart-qgis-plugin copied to clipboard
Error occurred when using "Swipe" diff type to show the changes
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:
- Import a point layer from PostGIS
- Add one extra point
- Select "Show working copy changes for this dataset..."
- See error
Expected behavior I expected to see the before and after changes in a split window.
Screenshots
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
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.
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)
Thanks!