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. Do I need QApllication instance for QPainter, QImage?
Forum Updated to NodeBB v4.3 + New Features

Do I need QApllication instance for QPainter, QImage?

Scheduled Pinned Locked Moved General and Desktop
3 Posts 3 Posters 879 Views 3 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.
  • S Offline
    S Offline
    stima_ua
    wrote on last edited by
    #1

    I need only some core things that aren't related to loop. Do I need QApplication for them?

    1 Reply Last reply
    0
    • Chris KawaC Offline
      Chris KawaC Offline
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      In general you need Q*Application for anything that is derived from QObject.
      I'm not sure but I would risk to say QImage might not need it. QPainter probably does, as it uses some platform specific stuff that might require some system state management handled by Q*Application.

      A worth noting is that you don't need to start a loop (i.e. call exec()) to have a Q*Application instance so if you're not gonna use functionality requiring a loop just don't start it, but do create the instance.

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

        Hi,

        Yes you do, there's some internal setup that's done with QApplication that are needed. However in Qt 4, you have the option to pass a boolean value as third parameter of the constructor to disable the GUI part so you can make a console application using some of the GUI related class

        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