Solved can not set focus on a button on touch screen
-
a widget is created to display video. It can be set to full screen mode. After full screen mode is cancelled, the widget returns where it belongs. Then all widgets lose focus and no more buttons react to click before a touch is made on the screen. That means I have to press any button twice to activate it. After any button is activated, all other buttons work fine.
calling setFocus for one of the buttons has no effect.
QTimer::singleShot( 0, m_resetButton, SLOT( setFocus() ) );Clicking the buttons with mouse does not have this problem. A mouse click event is simulated. No help.
Any suggestions?
-
@JoeCFD what do you mean by this line?
After full screen mode is cancelled, the widget returns where it belongs
What is the code snippet used to restore the original size of widget ?
Does the widget is top level widget?Clicking the buttons with mouse does not have this problem. ?
Does above line means that if you are operating with mouse everything is fine.
Then all widgets lose focus and no more buttons react to click before a touch is made on the screen.
are you facing issue with touch screen monitor/screen?
-
@nagesh
setParent( m_parent );
resize( m_size );
setWindowFlags( m_originalWindowFlags );
m_parent->update();
setVisible( true );everything is fine with mouse.
No issues except full screen mode switch. -
@JoeCFD I hope below statement not applicable to mouse, right?
No issues except full screen mode switch.
are you re parenting the widget during restore?
setParent( m_parent );
Is it the same issue that being discussed in this thread?
https://forum.qt.io/topic/105060/popup-modal-dialog-does-not-have-focus-on-touch-screen -
Set the parent of display widget to be the parent of _parent will solve the problem in full screen mode. I set it to be nullptr before.