1

I´ve created a Qt-Quick Combo-Box that, when it will be pressed, opens a QWindow, in which I show the content within a TableView. The problem is, the focus on the TableView can´t be set.

So first question is: How can I set the Focus on my TableView (which is hosted inside my QWindow)?

Furthermore, I have to get the event, if the user clicks beside the QWindow or outside the Application. That means the focus was changed and I can close my QWindow.

So second question is: How can I get the information, that the TableView lost the focus?

Thanks in advance.

RefMa77
  • 283
  • 2
  • 14
  • can't you use setFocus to set the focus? To recognize that the focus has been lost, you have to derive the class and override the focusOutEvent or write an eventfilter. – Gombat Sep 08 '15 at 12:25
  • It works perfectly thank you +1 – RefMa77 Sep 08 '15 at 13:01

1 Answers1

0

For from QWidget derived classes:

To set a focus use setFocus.

To recognize that the focus has been los, you can derive the class and override focusOutEvent or write an eventfilter.

Gombat
  • 1,994
  • 16
  • 21