Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. QWidget: Must construct a QApplication before a QPaintDevice
Qt 6.11 is out! See what's new in the release blog

QWidget: Must construct a QApplication before a QPaintDevice

Scheduled Pinned Locked Moved 3rd Party Software
8 Posts 5 Posters 23.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mario5046
    wrote on last edited by
    #1

    QWidget: Must construct a QApplication before a QPaintDevice

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

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rahul Das
      wrote on last edited by
      #2

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

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


      Declaration of (Platform) independence.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mario5046
        wrote on last edited by
        #3

        This fix doesn't work.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mario5046
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mario5046
            wrote on last edited by
            #5

            Anyone know how to repair that error.?

            1 Reply Last reply
            0
            • G Offline
              G Offline
              goetz
              wrote on last edited by
              #6

              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.

              http://www.catb.org/~esr/faqs/smart-questions.html

              1 Reply Last reply
              0
              • S Offline
                S Offline
                simplePlan
                wrote on last edited by
                #7

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

                1 Reply Last reply
                0
                • I Offline
                  I Offline
                  immerse
                  wrote on last edited by
                  #8

                  [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!

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved