QWidget: Must construct a QApplication before a QPaintDevice
-
CONFIG += QwtDll this line must be ->
#CONFIG += QwtDllfrom" here":http://www.qtcentre.org/threads/10959-QWidget-Must-construct-a-QApplication-before-a-QPaintDevice
-
I create action for button like this.
<code>
void MainWindow::buttonclickhandler()
{
QwtPlot *myPlot=new QwtPlot;
QwtText title( "Two Curves" );QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1"); double t[100]; double y[100]; for (int i=0;i<100;i++) { t[i]=i; y[i]=sin(2*20*i); } curve1->setRawSamples(t,y,100);
curve1->attach(myPlot);
myPlot->show();
myPlot->replot();
}
</code>and when i Start compilate I get error like this: QWidget: Must construct a QApplication before a QPaintDevice
-
Patience is a virtue.
Bumping your topic after one hour is most likely to annoy your fellow developers on the forum and make them stay away from your topic.
Do as the error message suggests: construct a QApplication instance before creating any other widget.
If you really did that, then it's most likely the you mix debug and release versions of your libraries.
And you never get that error on compilation, but only during runtime.
-
I today had the same error. I fixed it by switching to release mode. Seems like I only got the libraries for the release version (using Windows 7 64 bit, Qt Designer using MSVC 2010 compiler).
-
[quote author="simplePlan" date="1345041060"]I today had the same error. I fixed it by switching to release mode. Seems like I only got the libraries for the release version (using Windows 7 64 bit, Qt Designer using MSVC 2010 compiler).[/quote]
Worked for me. Thank you!