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. #include <QGuiApplication>
Forum Update on Monday, May 27th 2025

#include <QGuiApplication>

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 4 Posters 2.9k Views
  • 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.
  • U Offline
    U Offline
    user4592357
    wrote on last edited by
    #1

    i'm working on a project and i need to include <QGuiApplication>. but i get an error:

    fatal error: QGuiApplication: No such file or directory
    

    i also can't find a .pro file anywhere to add QT += gui. please help!

    raven-worxR 1 Reply Last reply
    0
    • U user4592357

      i'm working on a project and i need to include <QGuiApplication>. but i get an error:

      fatal error: QGuiApplication: No such file or directory
      

      i also can't find a .pro file anywhere to add QT += gui. please help!

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @user4592357 said in #include <QGuiApplication>:

      i also can't find a .pro file anywhere to add QT += gui. please help!

      what does that mean?!?!
      What are you actually trying to do?

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • U Offline
        U Offline
        user4592357
        wrote on last edited by
        #3

        i need to use QGuiApplication::clipboard() for which i need to include <QGuiApplication> which i somehow am not able to do

        raven-worxR 1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          To add to @raven-worx, without a .pro file how are you managing your project ? CMake ? QBS ?

          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
          • U user4592357

            i need to use QGuiApplication::clipboard() for which i need to include <QGuiApplication> which i somehow am not able to do

            raven-worxR Offline
            raven-worxR Offline
            raven-worx
            Moderators
            wrote on last edited by
            #5

            @user4592357
            so you are trying just to use a portion of Qt code in an arbitrary C++ application? Did i get this right?
            If so it would be way more easier to use the native code working for what you are trying to do, than fiddling around with the Qt integration into your application (if possible at all).

            --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
            If you have a question please use the forum so others can benefit from the solution in the future

            1 Reply Last reply
            0
            • U Offline
              U Offline
              user4592357
              wrote on last edited by
              #6

              they use .make files but i didn't find any such include there

              1 Reply Last reply
              0
              • VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by
                #7

                What version of Qt are you using?

                In old versions it's #include <QApplication> and QApplication::clipboard()

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                1 Reply Last reply
                2
                • U Offline
                  U Offline
                  user4592357
                  wrote on last edited by
                  #8

                  qt 4.8, and thanks, i used it and it solved my problem.

                  but i'm still curious cause this might happen to me again and i wanna know how can i include <QGuiApplication> in such projects?

                  1 Reply Last reply
                  0
                  • VRoninV Offline
                    VRoninV Offline
                    VRonin
                    wrote on last edited by
                    #9

                    You can't In Qt5 the gui module was split in 2, gui and widgets. gui includes QGuiApplication and widgets uses QApplication. In Qt4 there is no such distinction, QApplication is the only option.

                    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                    ~Napoleon Bonaparte

                    On a crusade to banish setIndexWidget() from the holy land of Qt

                    1 Reply Last reply
                    3

                    • Login

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