Hi to all,

I have some very strange problems.

I would like to add the Q_OBJECT macro to a class called Plot, inherited by QwtPlot.

I did everything in the right way and if I replace QwtPlot by QObject it works.

If I inherit by QwtPlot I get an "Undefined reference" error by the linker, it complains about missing QMetaObject const QwtPlot::staticMetaObject ...

The .pro file is:
Qt Code:
  1. #-------------------------------------------------
  2. #
  3. # Project created by QtCreator 2017-03-08T16:00:42
  4. #
  5. #-------------------------------------------------
  6.  
  7. QT += core gui
  8.  
  9. greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
  10.  
  11. TARGET = Test
  12. TEMPLATE = app
  13.  
  14.  
  15. SOURCES += main.cpp\
  16. mainwindow.cpp \
  17. plot.cpp
  18.  
  19. HEADERS += mainwindow.h \
  20. plot.h
  21.  
  22. FORMS += mainwindow.ui
  23.  
  24. INCLUDEPATH += C:\Qwt-6.1.3\include
  25. LIBS += -LC:\Qwt-6.1.3\lib\ -lqwt
To copy to clipboard, switch view to plain text mode 

The plot.h is:
Qt Code:
  1. #ifndef PLOT_H
  2. #define PLOT_H
  3.  
  4. #include <QObject>
  5. #include <qwt_plot.h>
  6.  
  7. class Plot: public QwtPlot
  8. {
  9. Q_OBJECT
  10. public:
  11. Plot(QWidget *parent);
  12. };
  13.  
  14. #endif // PLOT_H
To copy to clipboard, switch view to plain text mode 

Funny thing is that they do it in pretty much the same way in the examples of Qwt.

Does anyone know how to solve this problem, please?
Thanks a lot.