Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

C++ and QtC++



  • Hello, new here.
    also new at programming. I am looking for a way to program a gui in C++. Looking at C++ and Qt C++. They seem to be different languages. I watched a tutorial on creating a notepad application in Qt with C++ but it didn't look anything like C++. Why is that?

    thank you,

    Michael Cote'


  • Moderators

    Hi, and welcome!

    @michaelscote said in C++ and QtC++:

    Looking at C++ and Qt C++. They seem to be different languages.

    C++ is a language, while Qt is a library.

    The Qt library is written in standard C++. Qt also supports declarative programming via the QML language (which incorporates the JavaScript language)

    Note that Qt isn't just a library either. It also includes tools like a WYSIWYG (what-you-see-is-what-you-get) GUI editor called Qt Designer. This lets you create C++ GUIs quickly, but it stores its files in XML format.

    I watched a tutorial on creating a notepad application in Qt with C++ but it didn't look anything like C++. Why is that?

    Hard to say without seeing the tutorial! Can you provide a link?


  • Moderators

    Perhaps the bits that have put you off are Qt-specific C++ "features" like Q_OBJECT, signals and slots - but don't worry, they are 100% standard C++. The trick is that Qt uses a code generator (called MOC - Meta Object Compiler) which generates the files that "add" these features. All these files (your code and generated MOC code) are normal C++, compiled with a regular C++ compiler.


Log in to reply