Hi all,

I am trying to get my head around the model/view way of programming. I am making a simple example using my own class, and have run into a problem. My own class is very simple at this stage, since I'm just trying to get it to work:

Qt Code:
  1. class VfAlert : public QObject
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. VfAlert( QObject *parent = 0 ) : QObject( parent ) {}
  7. VfAlert( const VfAlert &alert );
  8. QString title;
  9. };
  10.  
  11. class VfAlertListModel : public QAbstractListModel
  12. {
  13. Q_OBJECT
  14.  
  15. public:
  16. VfAlertListModel( const QList<VfAlert> &alerts, QObject *parent = 0 )
  17. : QAbstractListModel(parent), alertList(alerts) {}
  18.  
  19. // int rowCount(const QModelIndex &parent = QModelIndex()) const;
  20. // QVariant data(const QModelIndex &index, int role) const;
  21. // QVariant headerData(int section, Qt::Orientation orientation,
  22. // int role = Qt::DisplayRole) const;
  23.  
  24. private:
  25. QList<VfAlert> alertList;
  26. };
To copy to clipboard, switch view to plain text mode 

and the copy constructor for VfAlert:

Qt Code:
  1. VfAlert::VfAlert( const VfAlert &alert )
  2. {
  3. title = alert.title;
  4.  
  5. };
To copy to clipboard, switch view to plain text mode 
I had to add the copy constructor because without it, it wouldn't compile.

Now it compiles ok, but I get this warning:
warning: base class 'class QObject' should be explicitly initialized in the copy constructor
That sounds pretty serious, so I'm guessing I shouldn't ignore it, but can't get my head around what exactly I should be doing with a QObject in the copy constructor

Any ideas?

Thanks