Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    Solved Check if CTRL is pressed (QLineEdit)

    General and Desktop
    2
    3
    239
    Loading More Posts
    • 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.
    • B
      beedaddy last edited by

      In my MainWindow, I have a QLineEdit. When the user presses Enter in this Widget, I process the text entered. This works great because I just have to connect to the returnPressed-Event of QLineEdit. But now I would like to additionally check if the user has pressed CTLR+ENTER. The question is, how can I do that? Do I have to derive from QLineEdit and overwrite the keyPressEvent? Or is there an easier way?

      Ratzz 1 Reply Last reply Reply Quote 0
      • Ratzz
        Ratzz @beedaddy last edited by Ratzz

        @beedaddy

        You can make use of eventfilters
        http://doc.qt.io/archives/qt-4.8/eventsandfilters.html#event-filters
        Sample example here and wiki link.

        --Alles ist gut.

        1 Reply Last reply Reply Quote 4
        • B
          beedaddy last edited by

          @Ratzz
          Great, that works! Thanks a lot.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post