Fix canvaspreview out-of-bounds panning for patchbay

Using the small canvaspreview to pan the patchbay resulted in an
exception when panning out of bounds of the window. In this case Carla
tried to create a QPoint with two floats, for which qt has no
constructor. This results in the panning to hang, as the event is
"handled" with an exception.

Casting these two values to int lets qt create the QPoint
and with that properly set the new cursor position, so panning can be
done in all edges again, without having to be precise with the cursor
positioning.

This is probably a left-over from a python2 to python3 migration, as
python did integer divison by default.
This commit is contained in:
Sebastian Lohff 2022-12-27 16:21:38 +01:00 committed by Filipe Coelho
parent 6157a6e85d
commit 57dc14ee42
1 changed files with 1 additions and 1 deletions

View File

@ -368,7 +368,7 @@ class CanvasPreviewFrame(QFrame):
fixPos = True
if fixPos:
globalPos = self.mapToGlobal(QPoint(self.fInitialX + x, self.fInitialY + y))
globalPos = self.mapToGlobal(QPoint(int(self.fInitialX + x), int(self.fInitialY + y)))
self.cursor().setPos(globalPos)
x = self.fRenderSource.width() * x / self.fInternalWidth