This is what I have done so far:However, I can't find a way to implement the following:
- A cell in a QTableWidget is selected and a key is pressed
- This causes the GridDelegate (my custom subclass of QItemDelegate) to create the editor (QLineEdit) and set the line edit text to the key I pressed.
- Using the cursorPositionChanged(int,int) signal to watch for cursor position changes, when the cursor moves I move it back to the start of the line. This way one can never enter more than one number.
Does anyone have an idea of the best way of going about this?
- When a key is pressed it is instantly committed to the line edit, then the delegate should save this data to the model and the line edit should then lose focus. This is what happens when the enter key is pressed, so I guess simulating an enter key press would do the trick.
I'm using Qt 4.1 under Linux
Bookmarks