Home > Back-end >  QWidget: Must construct a QApplication before a QPaintDevice how broken?
QWidget: Must construct a QApplication before a QPaintDevice how broken?

Time:09-19

Using the Qwt plot and plotcurve draw a curve, the code is very simple, the use of the property curve, it is an error: longj: : InitDll CheckPidProc g_modulename plot. Exe bAppOffice 0 return g_pidProcType 0 QWidget: Must construct a QApplication before a QPaintDevice
Inner: the module name: ATTACH_PrintScreen is called!!!!!! The empty inner name and ver. Dynamic -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- screen need SpecialCtrl mon 1
Direct post code, please expert guidance

//the main CPP

# include "mainwindow. H"
#include
#include
Int main (int arg c, char * argv [])
{
QApplication a(argc, argv);
The MainWindow w;
w.show();

return a.exec();
}

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
//mainwindow. CPP

# include "mainwindow. H"
#include
#include
#include
#include


MainWindow: : MainWindow (QWidget * parent)
: QMainWindow (parent)
{
//QWidget * widget=new QWidget;
//this - & gt; SetCentralWidget (widget);

Qwtplot=new qwtplot (this);
Qwtplot - & gt; SetAxisTitle (QwtPlot: : xBottom, x - & gt; "" );
Qwtplot - & gt; SetAxisScale (QwtPlot: : xBottom, 0.0, 10.0); Abscissa//from 0 to 10, the direction of the abscissa xBottom said from down to up
Qwtplot - & gt; SetAxisTitle (QwtPlot: : yLeft, "y - & gt;" );
Qwtplot - & gt; SetAxisScale (QwtPlot: : yLeft, 1.0, 1.0);//ordinate 1 to 1, said yLeft ordinate direction from left to right
//the curve - & gt; The attach (qwtplot);


For (double x=0; X & lt; 2.0 * M_PI; X +=(10.0)/M_PI)
{
Xs. Append (x);
Ys. Append (qSin (x));

}
Onto the setSamples (xs and ys);
The curve. The attach (this - & gt; Qwtplot);
}

MainWindow: : ~ MainWindow ()
{

}

-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --

//mainwindow. H


# # ifndef MAINWINDOW_H
# define MAINWINDOW_H

#include
#include
#include
#include
#include


The class MainWindow: public QMainWindow
{
Q_OBJECT

Public:
MainWindow (QWidget * parent=0);
~ MainWindow ();
Private:
QVector Xs.
QVector Ys.
QwtPlotCurve curve;
QwtPlot * QwtPlot;

};

# endif//MAINWINDOW_H

CodePudding user response:

The building Lord done

CodePudding user response:

I because didn't use administrator privileges to open,,,
  • Related