Skip to content

Commit aa4df2a

Browse files
committed
fix addImage bug
1 parent 64c11d4 commit aa4df2a

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

src/DrawingWidget.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,12 @@ void DrawingWidget::mouseMoveEvent(QMouseEvent *event) {
359359
penType = penTypeBak;
360360
}
361361

362+
void DrawingWidget::addImage(QImage img){
363+
images.last_image_num++;
364+
images.image_count = images.last_image_num;
365+
images.saveValue(images.last_image_num, img.copy());
366+
}
367+
362368
void DrawingWidget::mouseReleaseEvent(QMouseEvent *event) {
363369
if(curEventButtons & Qt::LeftButton && !isMoved) {
364370
drawLineTo(event->position()+QPointF(0,1));
@@ -371,11 +377,10 @@ void DrawingWidget::mouseReleaseEvent(QMouseEvent *event) {
371377
update();
372378
return;
373379
}
374-
images.last_image_num++;
375-
images.image_count = images.last_image_num;
376-
images.saveValue(images.last_image_num, image.copy());
380+
377381
curEventButtons = 0;
378382
curs.hide(-1);
383+
addImage(image);
379384
}
380385

381386
void DrawingWidget::initializeImage(const QSize &size) {

src/DrawingWidget.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class DrawingWidget : public QWidget {
6464
bool isNextAvailable();
6565
void loadImage(int num);
6666
void mergeSelection();
67+
void addImage(QImage img);
6768

6869
protected:
6970
bool drawing = false;

src/Selection.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,6 @@ void DrawingWidget::mergeSelection() {
5959
cropWidget->move(QPoint(-1,-1));
6060
update();
6161
painter.end();
62+
addImage(image);
6263

6364
}

0 commit comments

Comments
 (0)