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. How to use key Press Event with QlineEdit

How to use key Press Event with QlineEdit

Scheduled Pinned Locked Moved Unsolved Qt for Python
2 Posts 2 Posters 504 Views 1 Watching
  • 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.
  • L Offline
    L Offline
    LT-K101
    wrote on last edited by
    #1

    I'm trying to use Key Press event to track the key a user type in a QLineEdit but it does not seem to work. Please below is what I did. I need help please . Thanks in advance.

        def keyPressEvent(self,event):
            #print(event.text())
            self.ui.lineEdit_2.event.text()
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      You are nuking the original behaviour with what you are doing here which is a bad idea. Also the current uncomment line is likely crashing your application.

      Call the base class implementation when you do not want to explicitly change the behaviour of a function.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

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