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. Enter key press is not working in QListWidget in pyside2

Enter key press is not working in QListWidget in pyside2

Scheduled Pinned Locked Moved Unsolved Qt for Python
7 Posts 3 Posters 1.6k 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.
  • Y Offline
    Y Offline
    yashi95
    wrote on last edited by
    #1

    I can't find any signals for when the enter key was pressed on an item in the list (QStandardListItem). Can't seem to find any keypress events either.

    Is it possible to "hook up" QListView to an event just like that? How?

    JonBJ 1 Reply Last reply
    0
    • Y yashi95

      I can't find any signals for when the enter key was pressed on an item in the list (QStandardListItem). Can't seem to find any keypress events either.

      Is it possible to "hook up" QListView to an event just like that? How?

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @yashi95
      There is no such Qt class as QStandardListItem.

      For a QListView, go to https://doc.qt.io/qt-5/qlistview-members.html and search for key, e.g. QAbstractItemView::keyPressEvent is that's what you really want. Or you can always go via an eventFilter() if required.

      Y 1 Reply Last reply
      0
      • JonBJ JonB

        @yashi95
        There is no such Qt class as QStandardListItem.

        For a QListView, go to https://doc.qt.io/qt-5/qlistview-members.html and search for key, e.g. QAbstractItemView::keyPressEvent is that's what you really want. Or you can always go via an eventFilter() if required.

        Y Offline
        Y Offline
        yashi95
        wrote on last edited by
        #3

        @JonB
        hi,
        Can you provide some example of eventfliter()

        JonBJ 1 Reply Last reply
        0
        • Y yashi95

          @JonB
          hi,
          Can you provide some example of eventfliter()

          JonBJ Online
          JonBJ Online
          JonB
          wrote on last edited by
          #4

          @yashi95
          https://doc.qt.io/qt-5/eventsandfilters.html#event-filters
          https://doc.qt.io/qt-5/qobject.html#eventFilter

          Though why QListView::keyPressed is not acceptable to you I do not know.

          Y 1 Reply Last reply
          0
          • JonBJ JonB

            @yashi95
            https://doc.qt.io/qt-5/eventsandfilters.html#event-filters
            https://doc.qt.io/qt-5/qobject.html#eventFilter

            Though why QListView::keyPressed is not acceptable to you I do not know.

            Y Offline
            Y Offline
            yashi95
            wrote on last edited by
            #5

            @JonB
            Hi,
            I am using QlistWidget so is working for the same?

            JonBJ 1 Reply Last reply
            0
            • Y yashi95

              @JonB
              Hi,
              I am using QlistWidget so is working for the same?

              JonBJ Online
              JonBJ Online
              JonB
              wrote on last edited by
              #6

              @yashi95
              QListWidget inherits QListView so, yes. it shares e.g. QAbstractItemView::keyPressEvent.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                Hi,

                Are you looking for the QListWidget::itemActivated signal ?

                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