Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem with Static Qt
Forum Updated to NodeBB v4.3 + New Features

Problem with Static Qt

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 381 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.
  • A Offline
    A Offline
    AhmedAlshawi
    wrote on last edited by AhmedAlshawi
    #1

    Hi. I have built a static version of Qt which compiles and runs just fine. However, when I execute a particular function, I get this error message:

    QWidget: Must construct a QApplication before a QWidget
    

    This is quite strange because it does not occur when I compile and run the function using the dynamically linked build - only the static. Also, I am pretty sure that I have not made a widget before calling QApplication. I call the QApp right at the start and this error occurs in a function much later on in my code.

    Any initial ideas? The only difference between the two is that I add

    CONFIG += static
    

    when doing the static build.

    Cheers

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you have any static QWidget around in your code ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      A 1 Reply Last reply
      0
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by
        #3

        I would run it in the debugger and set a breakpoint on the output. Then simply look at the backtrace to see where it comes from.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        0
        • SGaistS SGaist

          Hi,

          Do you have any static QWidget around in your code ?

          A Offline
          A Offline
          AhmedAlshawi
          wrote on last edited by
          #4

          @SGaist
          What is a static QWidget?

          The error occurs when I run a function that takes some data, produces a chart using qtcharts and using qwt charts then returns a QPixmap.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            A static variable of the type QWidget.

            But as @Christian-Ehrlicher, run your application through the debugger.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            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