This is what I did at the end, I did like that :
virtual void keyPressEvent
( QKeyEvent* event
) override
{
// Activate all selected items when enter or return.
if( ( event->key() == Qt::Key_Enter ) || ( event->key() == Qt::Key_Return ) )
{
// Call itemActivated for each item needed.
...
event->accept();
return;
}
// Alphanumeric keys.
if( event->text().isEmpty() == false )
}
virtual void keyPressEvent( QKeyEvent* event ) override
{
// Activate all selected items when enter or return.
if( ( event->key() == Qt::Key_Enter ) || ( event->key() == Qt::Key_Return ) )
{
// Call itemActivated for each item needed.
...
event->accept();
return;
}
// Alphanumeric keys.
if( event->text().isEmpty() == false )
QListWidget::keyPressEvent( event );
}
To copy to clipboard, switch view to plain text mode
That works good but the Qt doc says mac uses another key, but maybe enter and return works good for all plateform at the end.
If I press multiple time one alphanumeric key, the action is stopped, I have no answer why.
Bookmarks