Hi,

I have a data model which displays items of information in a QTableView. The data is just stored in a simple QList<QString> and displayed from the model like so :

Qt Code:
  1. if( role == Qt::DisplayRole )
  2. {
  3. // just return data at given column
  4. int nPos = index.column() + ( 4 * index.row() );
  5. if( nPos < m_Data.size() )
  6. data = m_Data.at( nPos );
  7. }
To copy to clipboard, switch view to plain text mode 

Now what I want to also be able to do, is show this information in another view without it scrolling. m_Data contains the following data : can Id, message data, time data, count and thus is displayed like the following in the table view :

CanId Message time count
0x7e8 00112233 08082 1
0x9ea 11223344 09088 2
0x7e8 00112233 0a023 3

Now, as can be seen, there are two canId's with same id, I want this to be displayed on the same line, thus :

CanId Message time count
0x7e8 00112233 0a023 2
0x9ea 11223344 09088 1

Obviously my data structure ( m_Data ) is limited and thought of having a QHash map of the following object :

Qt Code:
  1. class CCanMessage
  2. {
  3. QString m_strMessage;
  4. QString m_strTime;
  5. QString m_strCount;
  6. };
To copy to clipboard, switch view to plain text mode 

This would get stored in the QHash map key'd on the CanId. Does this seem a way of doing this?

Regards,
Steve