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

How to trigger on highlighted QTableWidget?



  • Hello, I have a QTableWidget that contains some card info.

    I want to display a card preview to the left. I used "on_CardList_pressed" function and it worked well when I click on any row.

    However, when I switch rows using arrow keys, the preview is not updating. I tried all other slots and none of them are working.

    Is there a way to know when a user highlights a different row using arrow keys?


  • Lifetime Qt Champion

    Hi
    What about
    void QTableWidget::cellChanged(int row, int column)

    it should also trigger with keys ?



  • @mrjj said in How to trigger on highlighted QTableWidget?:

    Hi
    What about
    void QTableWidget::cellChanged(int row, int column)

    it should also trigger with keys ?

    Well, I tried this. It only display previews while the table is initializing. So I got a million debug errors.

    The most important thing is that after the table finishes initialization, it's not triggering anymore. Whether I click or use arrow keys the function is never called again.

    EDIT: Nevermind. I used on_CardList_currentCellChanged and everything worked just fine. Thanks for the suggestion.


Log in to reply