Gnats 5148: Typing values in slots lead to out of order numbers. RiverWare 6.2 Development -- 1-05-2012. PRIOR WORK IN THIS AREA: Gnats 4844: 'Inline editing of slot values hides significant digits' Gnats 4953: 'Typing numbers in slots is behaving incorrectly' ... the RwCellQLineEdit class was created to address this bug: ============================================================================= RCS file: /projects/riverware/builds.cvs/QtUtils/RwCellQLineEdit.cpp,v Working file: RwCellQLineEdit.cpp ============================================================================= revision 1.2 date: 2010/09/17 03:04:05; author: philw; state: Exp; lines: +39 -17 Short Description: Fix problem introduced with 4833 last week (in development) Bug Number: 4953 Release notes (y/n): No. Development bug fix. For Release Nums: 5.3 Gnats 4953: Typing numbers in slots is behaving incorrectly Unfortunately, this was broken a week ago in the course of addressing Gnats 4833 ("Inline editing of slot values hides significant digits"). [RiverWare 5.3 Development]. This effected both the Open Slot dialog and the SCT. There were no discrete events I could find which distinguish the two ways in which an incell edit is started -- that is, by double-clicking or just by starting to type. In the latter case, the edit session is started with that first key (single character) -- rather than the prior contents of the cell. And in that case, we DO NOT want to move the cursor to the left side (which was introduced in the course of addressing the bug mentioned above, in order to show the most significant digits of the value being edited). In the case of starting an edit session by just starting to type, the QLineEdit widget is first created, and then the key event is delivered to that widget. The "4833" fix was implemented by starting a timer the first time the QLineEdit becomes visible -- and 50 milliseconds later moving the cursor to the left side. This provides the opportunity to cancel the timer (and disable its effect, in case of a race condition) when processing the (each) key event. That does the trick. --------------------------- QtUtils/RwCellQLineEdit.hpp QtUtils/RwCellQLineEdit.cpp --------------------------- Added method: void RwCellQLineEdit::cancelEditStartFixupTimer(); ... if the _editStartFixupTimer exists, stop the timer, and delete it ... (wiping out the pointer to that timer, of course). In method: RwCellQLineEdit::keyPressEvent (QKeyEvent*), the new method, RwCellQLineEdit::cancelEditStartFixupTimer(). In method: RwCellQLineEdit::editStartFixup(), don't do anything if the _editStartFixupTimer doesn't exist. Note: this effect was not readily testable. This is to protect against a race condition (which may or may not ever occur) where a timeout event has been posted, but not yet serviced at the time a key event is processed. ============================================================================= revision 1.1 date: 2010/09/09 19:12:33; author: philw; state: Exp; Short Description: SCT and Open Slot Dialog: Incell editing, init pos: LEFT. Bug Number: 4833 Release notes (y/n): Yes For Release Nums: 5.3 Gnats 4833: "Inline editing of slot values hides significant digits". The custom QLineEdit used for incell editing in both the Open Object dialog and the SCT was enhanced to move the QLineEdit's cursor to the beginning (left side). Additionally, the custom QLineEdit classes used in both of those contexts were replaced by a common class: QtUtils/RwCellQLineEdit. --------------------------- QtUtils/RwCellQLineEdit.cpp -- NEW QtUtils/RwCellQLineEdit.hpp -- NEW Q3GUI/SlotQDlgLineEdit.cpp -- STUBBED OUT, prepare for removal Q3GUI/SlotQDlgLineEdit.hpp -- STUBBED OUT, prepare for removal QtSCT/SctQLineEdit.cpp -- STUBBED OUT, prepare for removal QtSCT/SctQLineEdit.hpp -- STUBBED OUT, prepare for removal --------------------------- Replaced basically identical custom QLineEdit classes used for incell editing in both the Open Slot dialog and the SCT with a common QLineEdit implementation: QtUtils/RwCellQLineEdit: // RiverWare Qt QLineEdit specialization for incell editing (e.g. in QTable) // // FIRST USES (RiverWare 5.3, 9-2010): // Q3GUI/SlotQDlgTable (a Q3Table) -- replacement for Q3GUI/SlotQDlgLineEdit // QtSCT/SctQTable (a Q3Table) -- replacement for QtSCT/SctQLineEdit Added functionality for Gnats 4833: "Inline editing of slot values hides significant digits". After an edit is started, move the QLineEdit's cursor to the beginning (left side). This is implemented as a delayed action after the first time a RwCellQLineEdit instance is shown. New data members: int _showCount; QTimer* _editStartFixupTimer; New methods: virtual void showEvent (QShowEvent*); void schedEditStartFixupTimer(); void editStartFixup(); ----------------------- Q3GUI/SlotQDlgTable.cpp Q3GUI/SlotQDlgTable.hpp QtSCT/SctQTable.cpp ----------------------- Replace Q3GUI/SlotQDlgLineEdit (a QLineEdit) with QtUtils/RwCellQLineEdit Replace QtSCT/SctQLineEdit (a QLineEdit) with QtUtils/RwCellQLineEdit ------------------------------- QtUtils/Make.package QtUtils/QtUtils.pro QtUtils/QtUtils.vcproj QtUtils/QtUtilsGenerated.pro QtUtils/QtUtilsGenerated.vcproj ------------------------------- Added QtUtils/RwCellQLineEdit (a QObject) to the builds. *** TODO: remove from CVS and make files: Q3GUI/SlotQDlgLineEdit.cpp -- STUBBED OUT, prepared for removal Q3GUI/SlotQDlgLineEdit.hpp -- STUBBED OUT, prepared for removal QtSCT/SctQLineEdit.cpp -- STUBBED OUT, prepared for removal QtSCT/SctQLineEdit.hpp -- STUBBED OUT, prepared for removal =============================================================================