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:
#-------------------------------------------------
#
# Project created by QtCreator 2017-03-08T16:00:42
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Test
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
plot.cpp
HEADERS += mainwindow.h \
plot.h
FORMS += mainwindow.ui
INCLUDEPATH += C:\Qwt-6.1.3\include
LIBS += -LC:\Qwt-6.1.3\lib\ -lqwt
#-------------------------------------------------
#
# Project created by QtCreator 2017-03-08T16:00:42
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = Test
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp \
plot.cpp
HEADERS += mainwindow.h \
plot.h
FORMS += mainwindow.ui
INCLUDEPATH += C:\Qwt-6.1.3\include
LIBS += -LC:\Qwt-6.1.3\lib\ -lqwt
To copy to clipboard, switch view to plain text mode
The plot.h is:
#ifndef PLOT_H
#define PLOT_H
#include <QObject>
#include <qwt_plot.h>
{
Q_OBJECT
public:
};
#endif // PLOT_H
#ifndef PLOT_H
#define PLOT_H
#include <QObject>
#include <qwt_plot.h>
class Plot: public QwtPlot
{
Q_OBJECT
public:
Plot(QWidget *parent);
};
#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.
Bookmarks