[SOLVED] QLineEdit does not receive character input on Android
-
@tarod.net Sorry, my English isn't the best.
- Yes, the "background" is a main window (my application is a text editor) and this widget is like a dropdown menu, where I can setup many things.
- Yes, we are talking the same widget that was QDialog before, but I recreated and now it is a QWidget. (Now called MctWidget, and yes, the name was misleading, it was "main" because it had some child dialogs as well.)
- Maybe :) My (really) main window contains a tool handler object which owns the formatting and configuring dialogs and widgets.
Now I am trying :
- to override
focusInEvent()
on this ReallyMainWindow focusInEvent()
emits a signal that connected to ToolHandler- ToolHandler gets a new slot: where calls
this->mctWidget->hide()
-
@SteveMBay Thank you for your answers! :)
Why don't you set MctWidget as modal
setWindowModality(Qt::WindowModal);
and add a button to close this child window?
If you implement that, MctWidget will remain opened until the user clicks the close button, but you will have more control to avoid wrong behaviours.
The line
this->setWindowFlags(Qt::Popup| Qt::FramelessWindowHint);
should be removed if you like the idea.About
focusInEvent
, try with this instead:bool ReallyMainWindow::event(QEvent *e) { { if (e->type() == QEvent::WindowActivate) { // window was activated } return QWidget::event(e); }
-
@tarod.net The Modal window does the trick! Now this works fine! Thank you!
It's so easy solution...
(Otherwise, I don't understand why Qt::Popup prevented to get input. Is this a bug or a feature?)
(About ReallyMainWindow... i found that other view catches the input instead of RMW, and I didn't modify the code so deep, so this was a dead end as well)
-
@SteveMBay When you say that other view catches the input, do you mean other subwindows or child windows which you are using to setup your main window?
In my opinion, it's the same case, and I think you should apply the same solution setting the window modality as
Qt::WindowModal
. -
@tarod.net It isn't so important, but I can explain it.
Other views are the surrounding and background objects on the screen (such as toolbar and docview).
ReallyMainWindow class is just a container, it does not implements the event handling. To be honest, the main structure is not my task and I am not really familiar with the deep details. As far as I see, there are more surface object where the input (touch) can be caught.
+---ReallyMAinWindow----+ | toolbar | +-------------+-----+---+ | | MCT | | | +-----+ | | docview | | | +-----------------------+