[Qt-interest] Optionally deriving from QWidget
David Doria
daviddoria at gmail.com
Thu Sep 15 23:32:01 CEST 2011
I have a class that emits Qt signals. I want to use this class in two ways:
1) Interactive - I want to use this class as part of a Qt GUI application
that can handle the signals.
2) Non-interactive - I want to use this class in a command line application
that does not know about Qt.
I tried defining a compiler flag INTERACTIVE and then doing something like
this:
#ifndef FORM_H
#define FORM_H
#if defined(INTERACTIVE)
#warning "Using interactive!"
#include <QWidget>
class Form : public QWidget
#else
#warning "Not using interactive!"
class Form
#endif
{
#if defined(INTERACTIVE)
Q_OBJECT
public:
public slots:
#endif
};
#endif
but even when the flag is defined, I get some vtable errors.
CMakeFiles/interactive.dir/interactive.cpp.o: In function `Form':
/media/portable/Examples/c++/src/QT/OptionalQt/form.h:14: undefined
reference to `vtable for Form'
/media/portable/Examples/c++/src/QT/OptionalQt/form.h:14: undefined
reference to `vtable for Form'
CMakeFiles/interactive.dir/interactive.cpp.o: In function `~Form':
/media/portable/Examples/c++/src/QT/OptionalQt/form.h:14: undefined
reference to `vtable for Form'
/media/portable/Examples/c++/src/QT/OptionalQt/form.h:14: undefined
reference to `vtable for Form'
Is this the right way to go about this? Can anyone explain where I went
wrong?
Thanks,
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110915/ec19f218/attachment.html
More information about the Qt-interest-old
mailing list