Hi,

I'm developping a class that looks like a list box and manage the displaying and scrolling of items (sound, image and color).

I'm trying to use the QValueList Template but I have a compilation error and I don't know how to fix it. My code is inspired from Qt help but it does not works.

Here is my .h
Qt Code:
  1. #ifndef _ITEM_SELECTOR_H
  2. #define _ITEM_SELECTOR_H
  3.  
  4. #include <qwidget.h>
  5. #include <qvaluelist.h>
  6.  
  7. class QListBox;
  8. class CItem;
  9.  
  10. class CItemSelector : public QWidget
  11. {
  12. Q_OBJECT
  13.  
  14. public:
  15. // Constructor / Destructor
  16. CItemSelector(QWidget* parent=0, const char* name=0);
  17.  
  18.  
  19. // Slots
  20. private slots:
  21. void processItemSelectionChange(int);
  22.  
  23. public slots:
  24. void updateHmi(QValueList<CItem>);
  25.  
  26.  
  27. // Signals
  28. signals:
  29. void itemSelectionChanged(const CItem&);
  30.  
  31. // Members
  32. private:
  33. QListBox* lb;
  34.  
  35. QValueList<CItem> currentList;
  36. };
  37.  
  38. #endif
To copy to clipboard, switch view to plain text mode 

and the .cpp
Qt Code:
  1. #include "itemselector.h"
  2. #include <qlistbox.h>
  3. #include ".\\..\\..\\item\\widgetsource\\item.h"
  4.  
  5. CItemSelector::CItemSelector(QWidget* parent, const char* name)
  6. :QWidget(parent, name)
  7. {
  8. resize(300, 400);
  9.  
  10. // Create the list box
  11. lb = new QListBox(this, "lb");
  12. }
  13.  
  14.  
  15. void CItemSelector::updateHmi(QValueList<CItem> list)
  16. {
  17. // Backup the list
  18. currentList = list;
  19.  
  20. // Reset the content of the current list box
  21. lb->clear();
  22.  
  23. // Fill the list box with the list items
  24. QValueList<CItem>::iterator it;
  25. for(it = list.begin(); it != list.end(); it++)
  26. lb->insertItem(it.getItemName());
  27.  
  28. }
  29.  
  30.  
  31. void CItemSelector::processItemSelectionChange(int value)
  32. {
  33. // Process something specific ... eventually
  34. // TO DO
  35.  
  36. // Emit the signal
  37. emit itemSelectionChanged(currentList[value]);
  38. }
To copy to clipboard, switch view to plain text mode 

My compilation error message is the following
Qt Code:
  1. ItemSelector.cpp
  2. ..\WidgetSource\ItemSelector.cpp(26) : error C2039: 'getItemName' : is not a member of 'QValueListIterator<class CItem>
To copy to clipboard, switch view to plain text mode 
Qt Code:
  1. moc_ItemSelector.cpp
  2. C:\Qt\3.3.3\include\qvaluelist.h(71) : error C2079: 'data' uses undefined class CItem
To copy to clipboard, switch view to plain text mode 

What does it mean ? How do I can fix my code ?

Thanks in advance.