QCustomPlot Discussion and Comments

QCPAxis subclassReturn to overview

Hello QCustomPlot users,

I am trying to subclass QCPAxis without success.
With the following code, i have the error "error C2512: 'QCPAxis' : no default constructor available".
I don't know why. Normally, QCPAxis constructor is already deined int the base class.

class CAxis : public QCPAxis
{
//Q_OBJECT
public:
//using QCPAxis::QCPAxis;
CAxis(QCPAxisRect *parent, AxisType type)
{
QCPAxis::QCPAxis(parent, type);
}

protected:

//......
};

Your help will be appreciated.
Regards.

somewhere you're trying to call a default constructor for QCPAxis (a constructor without parameters). For example that line using QCPAxis::QCPAxis; could potentially be a problem... but it's commented out in your case. Also make sure to not comment-out the Q_OBJECT macro as in your code above.