Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. can not set focus on a button on touch screen
Forum Updated to NodeBB v4.3 + New Features

can not set focus on a button on touch screen

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 531 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • JoeCFDJ Offline
    JoeCFDJ Offline
    JoeCFD
    wrote on last edited by JoeCFD
    #1

    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?

    1 Reply Last reply
    0
    • nageshN Offline
      nageshN Offline
      nagesh
      wrote on last edited by
      #2

      @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?

      JoeCFDJ 1 Reply Last reply
      1
      • nageshN nagesh

        @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?

        JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by JoeCFD
        #3

        @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.

        1 Reply Last reply
        0
        • nageshN Offline
          nageshN Offline
          nagesh
          wrote on last edited by
          #4

          @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

          1 Reply Last reply
          1
          • JoeCFDJ Offline
            JoeCFDJ Offline
            JoeCFD
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved