Unsolved Enter key press is not working in QListWidget in pyside2
-
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?
-
@yashi95
There is no such Qt class asQStandardListItem
.For a
QListView
, go to https://doc.qt.io/qt-5/qlistview-members.html and search forkey
, e.g.QAbstractItemView::keyPressEvent
is that's what you really want. Or you can always go via aneventFilter()
if required. -
@JonB
hi,
Can you provide some example of eventfliter() -
@yashi95
https://doc.qt.io/qt-5/eventsandfilters.html#event-filters
https://doc.qt.io/qt-5/qobject.html#eventFilterThough why
QListView::keyPressed
is not acceptable to you I do not know. -
@JonB
Hi,
I am using QlistWidget so is working for the same? -
@yashi95
QListWidget
inheritsQListView
so, yes. it shares e.g.QAbstractItemView::keyPressEvent
. -
Hi,
Are you looking for the QListWidget::itemActivated signal ?