Important: Please read the Qt Code of Conduct -

A possible solution for column splitting in QTableWidget

  • Hi,
    I must implement a table in which every column must be subdivided into three subcolumns starting from a given row. That is, for every column I've one numeric value in the first three rows and three values in the next ones.

    I have read that the columns of a QTableWidget cannot be splitted. So, I think a possible solution could be the use of a widget (having, for example, three line edits) for the cells with three numeric values, but I don't know if it's the correct approach. Is it the only way to solve my problem ? Is there any other possible and more elegant solution ?

    Thanks in advance

  • Hi there,
    Interesting question and I think the answer lies in the use of delegates. For every cell or for every cell in a column you can set a different delegate. In this delegate you might be able to set a new table to fill. Never ever done it myself by the way, so it's just a thought.
    Good luck and let us know how it goes!

  • Yes the answer is to use a delegate to achieve the same. You can also have a look "Qt-Grid-View": and download the source code to get a hint about the implementation.

  • Thank you for your quick reply, I'll try with delegates and have a look at Qt-Grid-View.


Log in to reply