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. QTableWidget: detect key that ended editing
Forum Updated to NodeBB v4.3 + New Features

QTableWidget: detect key that ended editing

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 171 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on 14 Jun 2024, 11:50 last edited by
    #1

    I'm using a QTableWidget. I am wondering if it would be possible for me to detect which key it was that ended editing of a cell e.g.

    • Tab, shift-Tab
    • Arrow up/down
    • Return
      Thanks for any help.
    P 1 Reply Last reply 14 Jun 2024, 11:59
    0
    • ? A Former User
      14 Jun 2024, 11:50

      I'm using a QTableWidget. I am wondering if it would be possible for me to detect which key it was that ended editing of a cell e.g.

      • Tab, shift-Tab
      • Arrow up/down
      • Return
        Thanks for any help.
      P Offline
      P Offline
      Pl45m4
      wrote on 14 Jun 2024, 11:59 last edited by Pl45m4
      #2

      @faxmachine said in QTableWidget: detect key that ended editing:

      I am wondering if it would be possible for me to detect which key it was that ended editing of a cell

      With QTableWidget probably not, but when you have your own QTableView + model class then you could emit your own, custom signal when the editing of a cell/data is finished and check the pressed key at the same time to send it via your signal.
      In theory :)
      Not tested, but I can imagine it might work like this.

      Or:
      You use your own delegate editor widget and handle the editor events, which are able to handle exactly the keys you thought of.

      Returns true if the given editor is a valid QWidget and the given event is handled; otherwise returns false. The following key press events are handled by default:

      Tab
      Backtab
      Enter
      Return
      Esc
      

      If the editor's type is QTextEdit or QPlainTextEdit then Tab, Backtab, Enter and Return keys are not handled.

      ( https://doc.qt.io/qt-6/qstyleditemdelegate.html#eventFilter )


      If debugging is the process of removing software bugs, then programming must be the process of putting them in.

      ~E. W. Dijkstra

      1 Reply Last reply
      1

      1/2

      14 Jun 2024, 11:50

      • Login

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