Ignore small selection (less 3x3).

This commit is contained in:
Gres 2015-09-30 19:48:21 +03:00
parent 3109444805
commit 4c51e264b5

View File

@ -102,7 +102,10 @@ bool SelectionDialog::eventFilter (QObject *object, QEvent *event) {
QPoint endPos = mouseEvent->pos (); QPoint endPos = mouseEvent->pos ();
QRect selection = QRect (startSelectPos_, endPos).normalized (); QRect selection = QRect (startSelectPos_, endPos).normalized ();
QPixmap selectedPixmap = currentPixmap_.copy (selection); QPixmap selectedPixmap = currentPixmap_.copy (selection);
if (!selectedPixmap.isNull ()) { if (selectedPixmap.width () < 3 || selectedPixmap.height () < 3) {
reject ();
return QDialog::eventFilter (object, event);
}
ProcessingItem item; ProcessingItem item;
item.source = selectedPixmap; item.source = selectedPixmap;
item.screenPos = pos () + selection.topLeft (); item.screenPos = pos () + selection.topLeft ();
@ -122,7 +125,6 @@ bool SelectionDialog::eventFilter (QObject *object, QEvent *event) {
emit selected (item); emit selected (item);
} }
} }
}
return QDialog::eventFilter (object, event); return QDialog::eventFilter (object, event);
} }