Hello,
I am learning Qt5/QWT so that I am developping a little program. However, when I only create a QtPlotCurve (curveTime in my program), it crashes (it seems to be a segfault). If I comment the QtPlotCurve declaration is works. Could you help me please ?
Header :
#ifndef TABCRAMERRAOBOUND_H
#define TABCRAMERRAOBOUND_H
#include <QWidget>
#include <QBoxLayout>
#include <QLabel>
#include <QFormLayout>
#include <QLineEdit>
#include <qwt/qwt_plot.h>
#include <qwt/qwt_plot_curve.h>
// Build tab1 called "Cramer-Rao bound"
class tabCramerRaoBound
: public QWidget{
Q_OBJECT
public:
explicit tabCramerRaoBound
(QWidget *parent
= 0);
~tabCramerRaoBound();
signals:
public slots:
private slots:
private:
void buildForm(QFormLayout * formLayout);
};
#endif // TABCRAMERRAOBOUND_H
#ifndef TABCRAMERRAOBOUND_H
#define TABCRAMERRAOBOUND_H
#include <QWidget>
#include <QBoxLayout>
#include <QLabel>
#include <QFormLayout>
#include <QLineEdit>
#include <qwt/qwt_plot.h>
#include <qwt/qwt_plot_curve.h>
// Build tab1 called "Cramer-Rao bound"
class tabCramerRaoBound : public QWidget
{
Q_OBJECT
public:
explicit tabCramerRaoBound(QWidget *parent = 0);
~tabCramerRaoBound();
signals:
public slots:
private slots:
private:
void buildForm(QFormLayout * formLayout);
QLineEdit * lineEdit;
QwtPlot * myPlot;
QwtPlotCurve * curveTime;
};
#endif // TABCRAMERRAOBOUND_H
To copy to clipboard, switch view to plain text mode
Source :
#include "tabCramerRaoBound.h"
tabCramerRaoBound
::tabCramerRaoBound(QWidget *parent
) : QWidget(parent
) {
// Construct the window
setLayout(layoutV1);
// Separation
line1
->setFrameShape
(QFrame::HLine);
line1
->setFrameShadow
(QFrame::Sunken);
// Layouts
QFormLayout * formLayout = new QFormLayout();
tabCramerRaoBound::buildForm(formLayout);
// Separation
line2
->setFrameShape
(QFrame::VLine);
line2
->setFrameShadow
(QFrame::Sunken);
// Graphic
// Place widgets
layoutV1->addWidget(line1);
layoutH2->addLayout(formLayout);
layoutH2->addWidget(line2);
layoutH2->addWidget(myPlot);
layoutV1->addLayout(layoutH2);
}
tabCramerRaoBound::~tabCramerRaoBound() {
}
void tabCramerRaoBound::buildForm(QFormLayout * formLayout) {
// Read user configuration
formLayout->addRow(label1);
formLayout->addRow(label2, lineEdit);
}
#include "tabCramerRaoBound.h"
tabCramerRaoBound::tabCramerRaoBound(QWidget *parent) : QWidget(parent) {
// Construct the window
QVBoxLayout * layoutV1 = new QVBoxLayout(this);
setLayout(layoutV1);
// Separation
QFrame * line1 = new QFrame();
line1->setFrameShape(QFrame::HLine);
line1->setFrameShadow(QFrame::Sunken);
// Layouts
QHBoxLayout * layoutH2 = new QHBoxLayout();
QFormLayout * formLayout = new QFormLayout();
tabCramerRaoBound::buildForm(formLayout);
// Separation
QFrame * line2 = new QFrame();
line2->setFrameShape(QFrame::VLine);
line2->setFrameShadow(QFrame::Sunken);
// Graphic
myPlot = new QwtPlot();
curveTime = new QwtPlotCurve("Time CRB");
// Place widgets
layoutV1->addWidget(line1);
layoutH2->addLayout(formLayout);
layoutH2->addWidget(line2);
layoutH2->addWidget(myPlot);
layoutV1->addLayout(layoutH2);
}
tabCramerRaoBound::~tabCramerRaoBound() {
}
void tabCramerRaoBound::buildForm(QFormLayout * formLayout) {
// Read user configuration
QLabel * label1 = new QLabel(tr("<b>Test:</b>"));
formLayout->addRow(label1);
QLabel * label2 = new QLabel(tr("Parametre:"));
lineEdit = new QLineEdit();
formLayout->addRow(label2, lineEdit);
}
To copy to clipboard, switch view to plain text mode
Here is the kind of error :
Starting /home/julien/Bureau/Devs/synchro tool hand/build-synchronization_tool-Desktop-Debug/synchronization_tool...
*** Error in `/home/julien/Bureau/Devs/synchro tool hand/build-synchronization_tool-Desktop-Debug/synchronization_tool': double free or corruption (out): 0x0000000000fc97e0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x80a46)[0x7f98ec112a46]
/usr/local/qwt-6.1.0/lib/libqwt.so.6(_ZN7QwtPlotD1Ev+0xed)[0x7f98ee11540d]
/usr/local/qwt-6.1.0/lib/libqwt.so.6(_ZN7QwtPlotD0Ev+0x9)[0x7f98ee115489]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN14QObjectPrivate14deleteChildrenEv+0x6e)[0x7f98ecea5eee]
/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(_ZN7QWidgetD2Ev+0x2df)[0x7f98ed9d81cf]
Starting /home/julien/Bureau/Devs/synchro tool hand/build-synchronization_tool-Desktop-Debug/synchronization_tool...
*** Error in `/home/julien/Bureau/Devs/synchro tool hand/build-synchronization_tool-Desktop-Debug/synchronization_tool': double free or corruption (out): 0x0000000000fc97e0 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x80a46)[0x7f98ec112a46]
/usr/local/qwt-6.1.0/lib/libqwt.so.6(_ZN7QwtPlotD1Ev+0xed)[0x7f98ee11540d]
/usr/local/qwt-6.1.0/lib/libqwt.so.6(_ZN7QwtPlotD0Ev+0x9)[0x7f98ee115489]
/usr/lib/x86_64-linux-gnu/libQt5Core.so.5(_ZN14QObjectPrivate14deleteChildrenEv+0x6e)[0x7f98ecea5eee]
/usr/lib/x86_64-linux-gnu/libQt5Widgets.so.5(_ZN7QWidgetD2Ev+0x2df)[0x7f98ed9d81cf]
To copy to clipboard, switch view to plain text mode
Thanks !!
Bookmarks