Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to emit a keyspress signal ?
Qt 6.11 is out! See what's new in the release blog

How to emit a keyspress signal ?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 843 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.
  • V Offline
    V Offline
    VoLinhTruc
    wrote on last edited by
    #1

    Hi there, I'm trying to emit a Keys.leftpressed signal after a mouse click.
    This is what I try.

    		MouseArea
    		{
    			anchors.fill: parent
    			onClicked:
    			{
    				if (_state == 0)
    				{
    					Keys.leftPressed()
    				}
    			}
    		}
    

    But Keys.leftPressed require a argument.
    I try this

    		MouseArea
    		{
    			property KeyEvent _event
    			anchors.fill: parent
    			onClicked:
    			{
    				if (_state == 0)
    				{
    					Keys.leftPressed(_event)
    				}
    			}
    		}
    

    And I got an error: "KeyEvent is not a type"

    What I have to do now?

    1 Reply Last reply
    0
    • 6thC6 Offline
      6thC6 Offline
      6thC
      wrote on last edited by
      #2

      What. Why? You're (IMO) making this way too hard on yourself.

      Bind both left pressed & mouse click to the same <signal | action> - keep it simple.
      Don't try remote control calling things as you do, that's just going to hurt you 2*, now and in the future.

      V 1 Reply Last reply
      0
      • 6thC6 6thC

        What. Why? You're (IMO) making this way too hard on yourself.

        Bind both left pressed & mouse click to the same <signal | action> - keep it simple.
        Don't try remote control calling things as you do, that's just going to hurt you 2*, now and in the future.

        V Offline
        V Offline
        VoLinhTruc
        wrote on last edited by
        #3

        @6thC
        Because I'm using PC and wanna test the Gestures.
        I want to emit a "Pinch" signal by using the wheel on mouse.

        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