PDA

View Full Version : FocusOutevent in Textedit issue



qtuser20
19th February 2010, 23:30
Hello

I am using a QTextEdit as a search field and the user can type in text for autocompletion. I present the matched results in a QDialog with the window flag QT::Tooltip.

I am trying to achieve the following functionality.If i click anywhere outside , the dialog should be hidden. I do this with a focusoutevent().While clicking anywhere outside am able to get the dialog to close. The issue i need help with is:

When a matching result is presented in the dialog, i have also implemented the itempressed() slot to be able to click an item and populate it into the textedit field.[ the dialog contains Qtreewidgetitems in a Qtreewidget].How can i ensure that the focusoutevent() of textedit closes the dialog in all cases, except when i click on the item in qdialog's tree widgetitem to populate in the field? I currently use hasfocus() to determine if treewidget has focus, but this yields unreliable results.

Could somebody please suggest abetter approach to resolve this issue?

Thankyou