QCustomPlot Discussion and Comments

Subclassing QCustomPlot?Return to overview

Hi! I need to subclass QCustomPlot so that I can implement a few of my own changes in replot() function. When I try to do subclass it I get the following error: E2422 defaulted default constructor cannot be constexpr because the corresponding implicitly declared default constructor would not be constexpr from qmutex.h.
Any idea why is it coming up? My subclass is just basic:

// mycustomplot.h file
#include "qcustomplot.h"
class myCustomPlot : public QCustomPlot
    myCustomPlot(QWidget *parent);
// mycustomplot.cpp file
#include "mycustomplot.h"
myCustomPlot::myCustomPlot(QWidget *parent)
    : QCustomPlot(parent)
I am using QCustomPLot in Visual Studio 2019 with a 'Qt VS Tools' Extension.

I tried it with Qt 5.15, VS2019 (latest release), qcustomplot 2.0.1, and it compiles without errors.


if i had to guess, it is because you are missing the explicit keyword on the constructor in the header. You should also have QWidget* parent =0 and a virtual on the deconstructor... just to be correct.

I think it is a bug, I saw something similar on Qt Forum: https://forum.qt.io/topic/111793/how-to-resolve-error-of-qmutex-h It seems like the problem is due to change in qmutex.h file in the recent release.

@Oliver I have exactly the same configuration but it doesn't work.
@ian I tried all that and in each possible combination, nothing works.