File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -212,3 +212,22 @@ bool QgsFilterLineEdit::event( QEvent *event )
212
212
213
213
return QLineEdit::event ( event );;
214
214
}
215
+
216
+ void QgsSpinBoxLineEdit::focusInEvent ( QFocusEvent *e )
217
+ {
218
+ QLineEdit::focusInEvent ( e );
219
+ if ( e->reason () == Qt::MouseFocusReason && ( isNull () ) )
220
+ {
221
+ mWaitingForMouseRelease = true ;
222
+ }
223
+ }
224
+
225
+ void QgsSpinBoxLineEdit::mouseReleaseEvent ( QMouseEvent *e )
226
+ {
227
+ QLineEdit::mouseReleaseEvent ( e );
228
+ if ( mWaitingForMouseRelease )
229
+ {
230
+ mWaitingForMouseRelease = false ;
231
+ clear ();
232
+ }
233
+ }
Original file line number Diff line number Diff line change @@ -324,6 +324,14 @@ class SIP_SKIP QgsSpinBoxLineEdit : public QgsFilterLineEdit
324
324
setModified ( true );
325
325
emit cleared ();
326
326
}
327
+
328
+ protected:
329
+ void focusInEvent ( QFocusEvent *e ) override ;
330
+ void mouseReleaseEvent ( QMouseEvent *e ) override ;
331
+
332
+ private:
333
+ bool mWaitingForMouseRelease = false ;
334
+
327
335
};
328
336
// / @endcond
329
337
You can’t perform that action at this time.
0 commit comments