Hi all.

I have to use the tr() function so i include the Q_OBJECT macro in my class declaration. But when I compile I get the errors:

Qt Code:
  1. debug/moc_xmlread.cpp:39: error: ‘staticMetaObject’ is not a member of ‘QXmlDefaultHandler’
  2. debug/moc_xmlread.cpp: In member function ‘virtual void* XmlRead::qt_metacast(const char*)’:
  3. debug/moc_xmlread.cpp:53: error: ‘qt_metacast’ is not a member of ‘QXmlDefaultHandler’
  4. debug/moc_xmlread.cpp: In member function ‘virtual int XmlRead::qt_metacall(QMetaObject::Call, int, void**)’:
  5. debug/moc_xmlread.cpp:58: error: ‘qt_metacall’ is not a member of ‘QXmlDefaultHandler’
To copy to clipboard, switch view to plain text mode 



My header file:

Qt Code:
  1. class XmlRead : public QXmlDefaultHandler
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. XmlRead(std::map<QDate, std::vector<double> > &myMap, std::vector<QString> &profile);
  7.  
  8. bool startElement(const QString &namespaceURI,
  9. const QString &localName,
  10. const QString &qName,
  11. const QXmlAttributes &attribs);
  12. bool endElement(const QString &namespaceURI,
  13. const QString &loacalName,
  14. const QString &qName);
  15. bool characters(const QString &str);
  16. bool fatalError(const QXmlParseException &exception);
  17.  
  18. private:
  19. std::map<QDate, std::vector<double> > *mapPtr;
  20. std::vector<QString> *profilePtr;
  21. QString currentText;
  22. std::vector<double> vec;
  23. bool validDate;
  24. QDate myDate;
  25. };
To copy to clipboard, switch view to plain text mode 

If I remove the Q_OBJECT macro the compiler cant find the tr() function... What am I doing wrong?