Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Receive event when list view element was selected via keyboard arrows



  • Hey,
    Is there a way to receive event when an element in list view was selected via up/down arrows?
    I have tried these signals, they work for mouse buttons/enter etc. but not up/down arrows.

    connect(ui_->dc6_listview_, &QListView::pressed, this, &MainWindow::selected);
    connect(ui_->dc6_listview_, &QListView::activated, this, &MainWindow::selected);
    connect(ui_->dc6_listview_, &QListView::clicked, this, &MainWindow::selected);
    connect(ui_->dc6_listview_, &QListView::doubleClicked, this, &MainWindow::selected);
    connect(ui_->dc6_listview_, &QListView::entered, this, &MainWindow::selected);
    

  • Lifetime Qt Champion

    Hi,

    I think you are looking for currentChanged.



  • @SGaist Hey, yeah, that's it. Didn't notice it as it's a protected slot. Thank you.


Log in to reply