-1

I am using Qt creator 4.2.1. I have installed Qwt lib successfully and been able to drag and drop QwtPlot widget to my form. I have an custom class Plot:public QwtPlot. I wish I can add QwtPlot to my form and then perform a widget promote to Plot.

However, when I try to do so, the promote dialog box does not show QwtPlot as a base class that I can choose. If I select QWidget as the base class and then specify "Plot" and "plot.h" as my promote class and header file, I got build errors complaining redefine of "class Plot". I do have the plot.h in my project already and it seems uic creates another "class Plot" for me. Hence, the compiler complains my plot.h has an redefined class.

How to resolve this problem? Thanks!

Max Li
  • 551
  • 2
  • 14
  • Did you rename your class `Plot`? And you can place a widget in ui from toolbox and promote that widget. check you have added printsuport in .pro file – saeed Oct 03 '17 at 04:22

1 Answers1

1

Place a widget from toolbox and use promote and make sure your class structure is like following sample.

#ifndef PLOT_H
#define PLOT_H

#include <QObject>

#include <qwt_plot.h>

class Plot : public QwtPlot
{
    Q_OBJECT
public:
    explicit Plot(QWidget *parent = nullptr);

signals:

public slots:
};

#endif // PLOT_H
saeed
  • 2,477
  • 2
  • 23
  • 40