#include <QGuiApplication>



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


  • Moderators

    @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?



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


  • Lifetime Qt Champion

    Hi,

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


  • Moderators

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



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



  • What version of Qt are you using?

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



  • 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?



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.