Add qet.cropImage() and qet.imageCrop() to the script API

Crop a picture as the crop tool does, in one undo step, and read its
crop rectangle back. tst_imagecropundo uses them on the real binary:
a crop that was undone is not saved, and redoing it saves it again.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Beat Hangartner
2026-10-04 19:45:03 +02:00
parent 5cbd65c1d4
commit 05b71e07a0
4 changed files with 179 additions and 0 deletions
+2
View File
@@ -539,6 +539,8 @@ class QetScriptApi : public QObject
Q_INVOKABLE int addImage(int folioIndex, const QString &filePath, double x, double y);
Q_INVOKABLE bool setImageScale(int folioIndex, int imageIndex, double factor);
Q_INVOKABLE bool setImageRotation(int folioIndex, int imageIndex, double angle);
Q_INVOKABLE bool cropImage(int folioIndex, int imageIndex, int x, int y, int width, int height);
Q_INVOKABLE QString imageCrop(int folioIndex, int imageIndex) const;
Q_INVOKABLE bool deleteImage(int folioIndex, int imageIndex);
Q_INVOKABLE int addPdfPage(int folioIndex, const QString &pdfPath, int pageNumber,
int dpi, double x, double y);