How to add multiple values inside a single cell of pyside2 QTableWidget?
-
I am working on a GUI using pyside2, where I have multiple values for columns of a single record. The soultion I have thought for this is that I will show data in QTableWidget and inside table widget show multiple values inside a single cell. Does anyone has any idea how to add multiple values inside a single cell of QTableWidget.
Thanks -
I am working on a GUI using pyside2, where I have multiple values for columns of a single record. The soultion I have thought for this is that I will show data in QTableWidget and inside table widget show multiple values inside a single cell. Does anyone has any idea how to add multiple values inside a single cell of QTableWidget.
Thanks -
@haider
You have to start by thinking out what display/interface/editability you want for these. For example, a comma-separated string list? Separate items on lines of their own? A combo box? A complete sub-table? -
@Denni-0 said in How to add multiple values inside a single cell of pyside2 QTableWidget?:
JonB to put more than one value within a single cell you pretty much have to combine them within code prior to putting them into that cell -- basically treat each cell as if it were like a QLineEdit without all the bells/whistles that come with a QLineEdit object
My other question would be why are even wanting to do this as it seems like that would be rather confusing to the User and be a semi-nightmare when it came to editing -- why not just add more columns? If its a header issue then there are ways to get a header to span more than one column.
As for how to manipulate this data you might want to look into the Data Model aspect of PyQt
@Denni-0 if we can span header to more then one columns then can you help me how we can do that with pyside2