Skip to content

Commit 7a2f623

Browse files
committed
block mouse event when touch event active
1 parent 131037b commit 7a2f623

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/widgets/DrawingWidget.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ void DrawingWidget::eventHandler(int source, int type, int id, QPointF pos, floa
544544
}
545545
curs.penType[id] = penType;
546546
curs.drawing[id] = true;
547-
if (num_of_press == 1){
547+
if (num_of_press == 1 || id == -1){
548548
mergeSelection();
549549
if(penType != ERASER){
550550
background->image = image.toImage();
@@ -601,7 +601,7 @@ void DrawingWidget::eventHandler(int source, int type, int id, QPointF pos, floa
601601
}
602602
curEventButtons = 0;
603603

604-
if(num_of_press == 0) {
604+
if(num_of_press == 0 || id == -1) {
605605
curs.clear();
606606
if(penType == SELECTION) {
607607
addPoint(id, pos);
@@ -682,7 +682,9 @@ bool DrawingWidget::event(QEvent *ev) {
682682
if(tablet_enabled) {
683683
break;
684684
}
685-
num_of_press=1;
685+
if(num_of_press > 0){
686+
break;
687+
}
686688
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(ev);
687689
eventHandler(mouseEvent->buttons(), PRESS, -1, mouseEvent->position(), 1.0);
688690
return true;
@@ -691,7 +693,9 @@ bool DrawingWidget::event(QEvent *ev) {
691693
if(tablet_enabled) {
692694
break;
693695
}
694-
num_of_press=0;
696+
if(num_of_press > 0){
697+
break;
698+
}
695699
QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(ev);
696700
eventHandler(mouseEvent->buttons(), RELEASE, -1, mouseEvent->position(), 1.0);
697701
return true;

0 commit comments

Comments
 (0)