| Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date | |
| All threads index page 1 | |
The following class (.h) compiles. If I uncomment the Q_OBJECT, I get
"undefined referenct o vtable" errors? I need Q_OBJECT since I want
this class to emit signals to a GUI form. What am I missing?
--------------------------------------------------
#ifndef JGXMLPARSER_H
#define JGXMLPARSER_H
//
#include <QXmlStreamReader>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QIODevice>
#include <QFile>
//
class JgXmlParser : public QXmlStreamReader {
//Q_OBJECT
public:
JgXmlParser(QTreeWidget &acctTree, QFile &xmlFile);
bool parse();
private:
QTreeWidget &acctTree;
QFile &xmlFile;
};
#endif
--------------------------------------------------
--
[ signature omitted ]
Hi Mike,
Does QXmlStreamReader inherit from QObject? If not, I think you may need:
class JgXmlParser : public QObject, public QXmlStreamReader {
Tony.
> -----Original Message-----
> From: Mike Adolf [mailto:mlnx@xxxxxxx]
> Sent: Thursday, 4 October 2007 12:48
> To: qtInterest
> Subject: Q_OBJECT vtable error
>
>
> The following class (.h) compiles. If I uncomment the Q_OBJECT, I get
> "undefined referenct o vtable" errors? I need Q_OBJECT since I want
> this class to emit signals to a GUI form. What am I missing?
>
> --------------------------------------------------
> #ifndef JGXMLPARSER_H
> #define JGXMLPARSER_H
> //
> #include <QXmlStreamReader>
> #include <QTreeWidget>
> #include <QTreeWidgetItem>
> #include <QIODevice>
> #include <QFile>
> //
> class JgXmlParser : public QXmlStreamReader {
> //Q_OBJECT
> public:
> JgXmlParser(QTreeWidget &acctTree, QFile &xmlFile);
> bool parse();
> private:
> QTreeWidget &acctTree;
> QFile &xmlFile;
> };
>
> #endif
> --------------------------------------------------
>
>
>
> --
> To unsubscribe - send a mail to
> qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the
> subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>
--
[ signature omitted ]
Dnia czwartek, 4 października 2007, Mike Adolf napisał:
> class JgXmlParser : public QXmlStreamReader {
Does class must inherit from QObject and you must include *,moc file generated
from your *.h file.
Regards,
--
[ signature omitted ]
Attachment:
signature.asc
Description: This is a digitally signed message part.
Mike Adolf wrote: > The following class (.h) compiles. If I uncomment the Q_OBJECT, I get > "undefined referenct o vtable" errors? I need Q_OBJECT since I want > this class to emit signals to a GUI form. What am I missing? Have you tried re-running qmake on the project file? In my experience when you introduce Q_OBJECT in a class funny things can happen with the meta-object compiler. Running make will not update the makefile itself since the .pro file itself has not been modified. Cheers, -Federico -- [ signature omitted ]
Hi, I faced the same problem, I removed all files and removed the generated Makefile from qmake and then regenerated the Makefile using qmake and it worked ! # make clean # rm Makefile # qmake *.pro # qmake # make Regrads, Sai Ram On 10/4/07, Federico Zenith <federico.zenith@xxxxxxxxxx> wrote: > > Mike Adolf wrote: > > The following class (.h) compiles. If I uncomment the Q_OBJECT, I get > > "undefined referenct o vtable" errors? I need Q_OBJECT since I want > > this class to emit signals to a GUI form. What am I missing? > > Have you tried re-running qmake on the project file? In my experience when > you introduce Q_OBJECT in a class funny things can happen with the > meta-object compiler. Running make will not update the makefile itself > since the .pro file itself has not been modified. > > Cheers, > -Federico > > -- > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with > "unsubscribe" in the subject or the body. > List archive and information: http://lists.trolltech.com/qt-interest/ > >