Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. qlineedit returnpressed obtain handle to it

qlineedit returnpressed obtain handle to it

Scheduled Pinned Locked Moved Solved Qt for Python
2 Posts 2 Posters 377 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.
  • H Offline
    H Offline
    hermes
    wrote on last edited by
    #1

    I wonder if someone could help me with the following:

    I create in a loop many Qlineedit input fields and connect for each instance the returnpressed action to a function called "r_pressed"
    -> How can I obtain inside the r_pressed function, a handle to the Qlineedit that triggered it?

    for i in [1,2,3]:
        tmp = QtWidgets.QLineEdit(str(i))
        tmp.returnPressed.connect(r_pressed)
    
    def r_pressed():
       i = ? -> How do I get the value of i inside the r_pressed function? (or something equivalent, like the reference to the qlineedit instance that triggered it....)
    

    Any hints are very welcome!

    1 Reply Last reply
    0
    • Kent-DorfmanK Offline
      Kent-DorfmanK Offline
      Kent-Dorfman
      wrote on last edited by Kent-Dorfman
      #2

      QObject::sender()

      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