How could I create a window with Qt that the user can interact with (i.e., clicking buttons in the window) but that does not otherwise change or take focus?
Use case: I have a QLineEdit and I would like to show an additional "manipulator" popup when the QLineEdit gains focus. This manipulator popup might include buttons for tasks like converting to uppercase/lowercase or such.
I can get it to work if I set the focus policy for all the manipulator's child widgets to Qt::NoFocus but this feels a little odd because I literally have to iterate over them.
I am wondering if there is a way to disable focus to a widget altogether, like setEnabled() would disable/enable all the child widgets.
Below are some findings so far.
QCompleter
The QCompleter does something very similar to a QLineEdit, showing a QListView popup. It does so by setting the QListView's parent to 0 so it becomes a window, and it sets the Qt::Popup window flags so it will be frameless. Finally it sets focusPolicy(Qt::NoFocus) to prevent it from taking over the focus from the associated QLineEdit.
This is trivial because there is only one single widget that needs its focus policy set to Qt::NoFocus.
QDateTimeEdit
In QDateTimeEdit something similar is done. The popup there, however, actually takes focus.
