I'm both a Qt newbie and a C++ newbie, so bear with me.

I've created a QAbstractTableModel for use in a QTableView table.
The basic data in the model for each row of the table is a list (QList) of structures that hold three things:
1. A single letter name (type QChar)
2. An integer
3. A pointer to some data

The first two are to be displayed in the table. The third is not to be displayed in the QTableView, but is simply a pointer to data that is linked to the row.

I've implemented a "setData()" function for accessing the row data, as per an example I'm using for help, with the following parameters:
Qt Code:
  1. bool QAbstractItemModel::setData ( const QModelIndex & index, const QVariant & value, int role = Qt::EditRole )
To copy to clipboard, switch view to plain text mode 

When I pass the setData function the first two variable types (QChar or int) 'value', there is no problem using the data; I simply use the QVariant conversion functions to convert from QVariant to the correct types and then place the value in the appropriate table entry.
But when I want to use setData to update the pointer, I'm not sure how to do it.... Can I pass QVariant a pointer?

userTableModel.h
Qt Code:
  1. #ifndef USERTABLEMODEL_H
  2. #define USERTABLEMODEL_H
  3.  
  4. #include <QAbstractTableModel>
  5. #include <QList>
  6.  
  7. //Structure to store individual user information
  8. struct userInfo
  9. {
  10. QChar userName;
  11. int userNumber;
  12. int *userData;
  13. };
  14.  
  15. class userTableModel : public QAbstractTableModel
  16. {
  17. Q_OBJECT
  18.  
  19. public:
  20. userTableModel(QObject *parent=0);
  21. userTableModel(QList<userInfo> userInfoList, QObject *parent=0);
  22.  
  23. int rowCount(const QModelIndex &parent) const;
  24. int columnCount(const QModelIndex &parent) const;
  25. QVariant data(const QModelIndex &index, int role) const;
  26. QVariant headerData(int section, Qt::Orientation orientation, int role) const;
  27. Qt::ItemFlags flags(const QModelIndex &index) const;
  28. bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole);
  29. bool insertRows(int position, int rows, const QModelIndex &index=QModelIndex());
  30. bool removeRows(int position, int rows, const QModelIndex &index=QModelIndex());
  31. QList<userInfo> getList();
  32.  
  33. private:
  34. QString systemName;
  35. int systemNumber;
  36.  
  37. QList<userInfo> listOfUserInfo; //List of user info
  38. };
  39.  
  40. #endif
To copy to clipboard, switch view to plain text mode 

setData() from userTableModel.cpp (note line 17)
Qt Code:
  1. bool userTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
  2. {
  3. if (index.isValid() && role == Qt::EditRole) {
  4. int row = index.row();
  5.  
  6. //Select the correct row
  7. userInfo p = listOfUserInfo.value(row);
  8.  
  9. //User's Name (Initial)
  10. if(index.column() == 0)
  11. p.userName = value.toChar();
  12. //User's Number
  13. else if(index.column() == 1)
  14. p.userNumber = value.toInt();
  15. //Pointer to User's Data
  16. else if(index.column() == 2)
  17. //Not Sure what to put here!!!
  18.  
  19. else
  20. return false;
  21.  
  22. listOfUserInfo.replace(row, p);
  23. emit(dataChanged(index, index));
  24.  
  25. return true;
  26. }
  27.  
  28. return false;
  29. }
To copy to clipboard, switch view to plain text mode 

How would I use the same function (setData()) to update the "userInfo.userData" pointer?