Subject: Needs discussion: Date/Time Slot Value "Auto-Apply" on Hitting Enter [Gnats 5266]
Date: Tue, 12 Mar 2013 15:39
From: Phil Weinstein

To: David and Edie;  CC: Software

David suggested that we talk about this before proceeding with a change for this bug.

For implementing "auto-apply" functionality for direct edits to this special date/time spinner (for date/time slot values), minimally I would want to provide this functionality for invalid entries:
  1. If the text represents a valid date/time, that value is applied to the selected slot values.
  2. If the text is invalid, a "beep" is sounded, and the value is _not_ applied to slot values.
It's turning out to be difficult, and would require appreciable additional complexity, to discern whether or not the entered text had been valid at the time of our receiving the "Enter" (or "Return") key-pressed notification.

We _could_ just auto-apply either the valid text -- or the fixed-up text -- whenever the user hits the Enter button -- that is, apply that value to the slot data.  I'm uncomfortable with that solution.
Note: There is one bug I have a fix for which I'd like to apply.  When the user enters an invalid Date/Time into this spinner, instead of reverting back to its prior value, it puts in the timestep corresponding to the CURRENT (wall clock) time.  Clearly that's a bug.
Technical: The underlying Qt Spinner widget (QSpinBox) is an integer spinner which supports translation to and from application-level strings (i.e. our Date/Time formats) through subclassing and overriding virtual methods.  In the course the spinner's base class (QAbstractSpinbox) processing of the Enter key, it interprets and refreshes the display value.  (It does go through our code, but we don't have a way of knowing that it is processing the Enter key press).  By the time we receive "our" Enter key press notification, the fixup has already occurred.

I'm pretty certain we could devise some mechanism to ultimately discern the disposition of the original entered text, but it adds a non-trivial amount of complexity.  David suggested that we talk about this before we proceed.

We could revisit the use of an "Apply" stage.  The considerations are different for Scalar and other slots which have a multiple-value selection to which a value-change would be applied.  I think we _do_ need this for invalid entry scenarios in especially the latter case (non-scalars).  And this new "Auto-Apply" idea is a bit of a fly in the ointment, given the current use of a QSpinBox.

- Phil