Solved FocusOutEvent question.... please help me.
-
hi, all.
Please understand that my English skills is not good.
I have Dialog
this dialog has one lineEdit and one pushButton (Cancel button / when clicked close dialog)
I have set the focusOutEvent on the lineEdit
because , when emit focuseOutEvent to put up a messageBox.
then, when i click CancelButton , i want to just close dialog , but a message pops up.
How can I solve this problem?
I tried hard with my low English skills..... Please Help me .. !
-
Hi
You said:- but a message pops up.
Your own messageBox comes again when you close dialog
or is it a new message ? ( not yours) -
Could you post your code? That would help us understand your problem.
-
focusOutEvent of lineEdit
focusOutEvent(QFocusEvent* event)
{
QMessageBox::warning(this,tr("message"),"message",QMessageBox::OK);
// Because, if user enters the wrong value in lineEdit
}- I click cancel button (to close dialog)
- my lineEdit is focusOut
- call focusOutEvent
- pop up a message.
I want to keep the message out.
-
@kwanyoung I think what you want to achive can better be done with a QValidator assigned to the lineEdit.
And please: no messagebox! thats bad user experience. disable the dialogs Ok button, show an status message in the dialog, but no messagebox. thanks :)
Edit: Example: http://code.qt.io/cgit/qt/qtserialbus.git/tree/examples/serialbus/can/sendframebox.cpp?h=dev
-
thank you !
-
@kwanyoung if your problem is solved, please mark this topic as SOLVED too. thanks :)