December 25, 2011

mario5046 mario5046
Lab Rat
8 posts

QWidget: Must construct a QApplication before a QPaintDevice

 

QWidget: Must construct a QApplication before a QPaintDevice

Anyone know how to repair that problem.?
I use Qwt library.

7 replies

December 25, 2011

Rahul Das Rahul Das
Robot Herder
368 posts

CONFIG += QwtDll this line must be ->
#CONFIG += QwtDll

from” here”:http://www.qtcentre.org/threads/10959-QWidget-Must-construct-a-QApplication-before-a-QPaintDevice

 Signature 

——————————-

    Rahul Das

——————————-

December 25, 2011

mario5046 mario5046
Lab Rat
8 posts

This fix doesn’t work.

December 25, 2011

mario5046 mario5046
Lab Rat
8 posts

I create action for button like this.

  1. void MainWindow::buttonclickhandler()
  2. {
  3. QwtPlot *myPlot=new QwtPlot;
  4.         QwtText title( "Two Curves" );
  5.  
  6.  
  7.             QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1");
  8.             double t[100];
  9.             double y[100];
  10.             for (int i=0;i<100;i++)
  11.             {
  12.                 t[i]=i;
  13.                 y[i]=sin(2*20*i);
  14.             }
  15.             curve1->setRawSamples(t,y,100);
  16.  
  17. curve1->attach(myPlot);
  18. myPlot->show();
  19. myPlot->replot();
  20. }

and when i Start compilate I get error like this: QWidget: Must construct a QApplication before a QPaintDevice

December 25, 2011

mario5046 mario5046
Lab Rat
8 posts

Anyone know how to repair that error.?

December 26, 2011

Volker Volker
Robot Herder
5428 posts

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.

August 15, 2012

simplePlan simplePlan
Lab Rat
11 posts

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).

August 17, 2012

immerse immerse
Lab Rat
1 posts
simplePlan wrote:
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).

Worked for me. Thank you!

 
  ‹‹ How to draw histogram ?      [SOLVED] QWT Plot refresh ››

You must log in to post a reply. Not a member yet? Register here!