Hi,
This is the model :
DAStaticModel
::DAStaticModel(QObject *parent
){
}
DAStaticModel::~DAStaticModel()
{
}
int DAStaticModel::rowCount( const QModelIndex& parent ) const
{
return theApp->GetCanMap()->size();
}
int DAStaticModel
::columnCount(const QModelIndex &) const {
return 4;
}
void DAStaticModel::SetHeaders( QStringList& strHeaders )
{
strHeaderList = strHeaders;
}
QVariant DAStaticModel
::headerData(int section, Qt
::Orientation orientation,
int role
) const {
if( role != Qt::DisplayRole )
if (orientation == Qt::Horizontal)
return strHeaderList[section];
}
void DAStaticModel::setCanData( int nAmount )
{
if( nAmount <= 0 )
return;
beginInsertRows
(QModelIndex(),
0,
0);
//theApp->GetCanMap()->size() ); // insert nAmount of rows
endInsertRows();
}
DAStaticModel::DAStaticModel(QObject *parent)
: QAbstractTableModel(parent)
{
}
DAStaticModel::~DAStaticModel()
{
}
int DAStaticModel::rowCount( const QModelIndex& parent ) const
{
return theApp->GetCanMap()->size();
}
int DAStaticModel::columnCount(const QModelIndex &) const
{
return 4;
}
void DAStaticModel::SetHeaders( QStringList& strHeaders )
{
strHeaderList = strHeaders;
}
QVariant DAStaticModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if( role != Qt::DisplayRole )
return QVariant();
if (orientation == Qt::Horizontal)
return strHeaderList[section];
return QVariant();
}
void DAStaticModel::setCanData( int nAmount )
{
if( nAmount <= 0 )
return;
beginInsertRows(QModelIndex(), 0, 0);//theApp->GetCanMap()->size() ); // insert nAmount of rows
endInsertRows();
}
To copy to clipboard, switch view to plain text mode
The GetCanMap :
QMap<QString,
QObject*>
* GetCanMap
() { return &m_oCanMessages;
}
QMap<QString, QObject*>* GetCanMap() { return &m_oCanMessages; }
To copy to clipboard, switch view to plain text mode
where m_oCanMessages is :
QMap<QString,
QObject*> m_oCanMessages;
QMap<QString, QObject*> m_oCanMessages;
To copy to clipboard, switch view to plain text mode
Many thanks for looking.
Steve
Bookmarks