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 :
if( role == Qt::DisplayRole )
{
// just return data at given column
int nPos = index.column() + ( 4 * index.row() );
if( nPos < m_Data.size() )
data = m_Data.at( nPos );
}
if( role == Qt::DisplayRole )
{
// just return data at given column
int nPos = index.column() + ( 4 * index.row() );
if( nPos < m_Data.size() )
data = m_Data.at( nPos );
}
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 :
class CCanMessage
{
};
class CCanMessage
{
QString m_strMessage;
QString m_strTime;
QString m_strCount;
};
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
Bookmarks