PDA

View Full Version : dateEdit, editingFinished, isolate return key press



meena
30th June 2010, 12:34
Hi
I need the functionality that in dateEdit after enter key press the date should be stored in DB,

& if a return key pressed the date shold not be enterd in the DB.(as i din't wanted to add a

button.)

currently i am using the slot "editingFinished()" (on_dateEdit_editingFinished())
This signal is emitted when the Return or Enter key is pressed or the line edit loses focus.

i din't find any other signal which does my work..
is there any other signal or any other method to do the job..?

void FrontScreen::on_dateEdit_editingFinished()
{
execute the req query & do the required things
}

tbscope
30th June 2010, 12:48
Use the key press event.

But, the following worries me deeply:

I need the functionality that in dateEdit after enter key press the date should be stored in DB,
& if a return key pressed the date shold not be enterd in the DB.(as i din't wanted to add a
button.)

That is weird behaviour and I can guarantee you it would annoy me a lot.

meena
30th June 2010, 12:56
what is weird behaviour here?

tbscope
30th June 2010, 14:55
what is weird behaviour here?

Return for adding to the database
Enter for not adding to the database.

At least use Esc to discard changes.

Return or enter should always be used for confirmation. And different behavior between them should always be visible.

meena
1st July 2010, 07:21
sorry my mistake.. I meant on Esc & Enter key press the changes are updated, but i wanted to Esc to discard changes.. as the default behavior of slot "editingFinished()" (on_dateEdit_editingFinished())
This signal is emitted when the Return or Enter key is pressed or the line edit loses focus.

i din't find any other signal which does my work..
is there any other signal or any other method to do the job..?

tbscope
1st July 2010, 07:32
i din't find any other signal which does my work..
is there any other signal or any other method to do the job..?

I think I'm going to repeat myself.
You can use the key press event.