hai I am using QCustomPlot in one of my application.
while adding graph application is unexcpectedly closed
in my mainwindow.cpp
m_pCustomPlot->addGraph();(M_pCustomPlot is QCustomPlot*)
in customplot.cpp
QCPGraph *QCustomPlot::addGraph(QCPAxis *keyAxis, QCPAxis *valueAxis) { if (!keyAxis) keyAxis = xAxis; if (!valueAxis) valueAxis = yAxis; if (!keyAxis || !valueAxis) { qDebug() << Q_FUNC_INFO << "can't use default QCustomPlot xAxis or yAxis, because at least one is invalid (has been deleted)"; return 0; } if (keyAxis->parentPlot() != this || valueAxis->parentPlot() != this) { qDebug() << Q_FUNC_INFO << "passed keyAxis or valueAxis doesn't have this QCustomPlot as parent"; return 0; }
in above code while assigning xAxis to keyAxis The program has unexpectedly finished.
and
ploting initialisation is as shown below
m_pCustomPlot->setWindowFlags(Qt::FramelessWindowHint); m_pCustomPlot->setMinimumSize(210,240); m_pCustomPlot->setGeometry(0,70,240,240); m_pCustomPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom | QCP::iSelectAxes | QCP::iSelectLegend | QCP::iSelectPlottables); QFont legendFont = font(); legendFont.setPointSize(8); m_pCustomPlot->xAxis->setRange(0,16384); m_pCustomPlot->yAxis->setRange(0,20000); m_pCustomPlot->axisRect()->setupFullAxesBox(); m_pCustomPlot->plotLayout()->insertRow(0); m_pCustomPlot->xAxis->setLabel("Bin"); m_pCustomPlot->xAxis->setLabelFont(legendFont); m_pCustomPlot->yAxis->setLabelFont(legendFont); m_pCustomPlot->yAxis->setLabel("Bin Count");
please suggest me why program was unexpectedly finished?