On Monday 16 February 2015 10:51:16 André Somers wrote: > Jha Sonakumar schreef op 16-2-2015 om 09:49: > > Hi all, > > > > Generally we use to display data from database by *QTableView * rows. > > > > But i need to display all items of a row in a cell of a column,so in > > this way there will be only one column. > > > > Could you please share any idea. > > Easiest would be to create a proxy model. In this proxy model, you fix > the column count to 1. Then, you reimplement the data() method to return > the data you need for every role. I usually create my own roles enum > that extends the standard roles; one role for each logical piece of data. > > I actually also in my own models provide such an interface: make all > data for a logical item available for all columns that contain aspects > of that item through roles. That makes it easier to integrate with QML, > but also I find that other code becomes easier. So, all columns provide > the same data, except for the DisplayRole and other standard roles that > I need. > > To display all that, you can use a custom delegate that uses more than > just your Qt::DisplayRole. > > André
Another option would be to use a select statement, that concatenates your columns. -- Reinhardt _______________________________________________ Interest mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/interest
