Nominate our 2022 Qt Champions!

Performant grid handling

  • Hi Folks,

    In my application, I need to create a grid that manages user data depends on the column of the grid. I know both of QTableView and QTableWidget.
    I will need columns with QCombobox, QSpinBox and QPushButtons, but I wuld like to create only one instance of them and if the user click on the cell of the grid, display the control, the user interacts with it and the result stay there as string in the cell.
    I think, its a more performant sulution then creating controls into each cell, but I don't know how can I do that.

    Can anybody explain me how can I do that? Maybe can he / she put some snippet as well?


  • Lifetime Qt Champion


    Sounds like you need a QStyledItemDelegate with a custom editor and paint method.

    You have several examples linked in the documentation of the class to help you get started.

Log in to reply