Ossi
23rd September 2009, 13:41
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:
debug/moc_xmlread.cpp:39: error: ‘staticMetaObject’ is not a member of ‘QXmlDefaultHandler’
debug/moc_xmlread.cpp: In member function ‘virtual void* XmlRead::qt_metacast(const char*)’:
debug/moc_xmlread.cpp:53: error: ‘qt_metacast’ is not a member of ‘QXmlDefaultHandler’
debug/moc_xmlread.cpp: In member function ‘virtual int XmlRead::qt_metacall(QMetaObject::Call, int, void**)’:
debug/moc_xmlread.cpp:58: error: ‘qt_metacall’ is not a member of ‘QXmlDefaultHandler’
My header file:
class XmlRead : public QXmlDefaultHandler
{
Q_OBJECT
public:
XmlRead(std::map<QDate, std::vector<double> > &myMap, std::vector<QString> &profile);
bool startElement(const QString &namespaceURI,
const QString &localName,
const QString &qName,
const QXmlAttributes &attribs);
bool endElement(const QString &namespaceURI,
const QString &loacalName,
const QString &qName);
bool characters(const QString &str);
bool fatalError(const QXmlParseException &exception);
private:
std::map<QDate, std::vector<double> > *mapPtr;
std::vector<QString> *profilePtr;
QString currentText;
std::vector<double> vec;
bool validDate;
QDate myDate;
};
If I remove the Q_OBJECT macro the compiler cant find the tr() function... What am I doing wrong?
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:
debug/moc_xmlread.cpp:39: error: ‘staticMetaObject’ is not a member of ‘QXmlDefaultHandler’
debug/moc_xmlread.cpp: In member function ‘virtual void* XmlRead::qt_metacast(const char*)’:
debug/moc_xmlread.cpp:53: error: ‘qt_metacast’ is not a member of ‘QXmlDefaultHandler’
debug/moc_xmlread.cpp: In member function ‘virtual int XmlRead::qt_metacall(QMetaObject::Call, int, void**)’:
debug/moc_xmlread.cpp:58: error: ‘qt_metacall’ is not a member of ‘QXmlDefaultHandler’
My header file:
class XmlRead : public QXmlDefaultHandler
{
Q_OBJECT
public:
XmlRead(std::map<QDate, std::vector<double> > &myMap, std::vector<QString> &profile);
bool startElement(const QString &namespaceURI,
const QString &localName,
const QString &qName,
const QXmlAttributes &attribs);
bool endElement(const QString &namespaceURI,
const QString &loacalName,
const QString &qName);
bool characters(const QString &str);
bool fatalError(const QXmlParseException &exception);
private:
std::map<QDate, std::vector<double> > *mapPtr;
std::vector<QString> *profilePtr;
QString currentText;
std::vector<double> vec;
bool validDate;
QDate myDate;
};
If I remove the Q_OBJECT macro the compiler cant find the tr() function... What am I doing wrong?