Qt World Summit: Submit your Presentation

Any good QT and QML examples for newbies?

  • Hello everyone,

    I am looking to make a QT and QML app with the following structure.
    The app will run two CLI apps in the background. I have the c++ code for both apps.

    I want to have two buttons that trigger the apps.
    I want one input box that can pass a variable to the CLI app.

    I want some text boxes that store the latest output the CLI apps return.

    Are there any good examples for complete beginners that illustrate this?
    I basically want to be able to tie up some buttons to some CLI code, in both QML and QT.

    Thank you if you can help at all

    Edit: perhaps there could be a main c++ "app" that handles the other c++ code?

  • Lifetime Qt Champion


    No there's no example that does exactly what you describe. However the QML book is very good source to get started.

    Then take a look at the C++ integration part and QProcess.

  • Thank you for the quick reply. I will do more reading into it. Thank you!

    To be more specific, my c++ "apps" are quite simple.
    One app for instance takes a command line text argument, validates the text and prints out the result at the end.

    I use "int main(int argc, char *argv[])"

    It is all very basic. I would like to have some of these basic apps run side by side in the background. Is that a big issue? Will I need to consider things like threadings and timing of the code execution?

    Also, a very big question is debugging. Can I have the "c++ apps" open in terminal output windows next to the GUI while I am developing?

  • Lifetime Qt Champion

    I thought you wanted to execute these apps from within your Qt Quick based app. Is it not the case ?

  • Well yes. I want to integrate the apps and execute them from within the qt GUI.

    Edit: I am going to read up on it more. I was just thinking there might be a very newbie friendly way to do that.

    Is there an obvious way to debug an app to see what is happening "in the background"? Can I have my c++ app run in the terminal window beside the GUI just to see if everything is working as it should? The rest I will figure out myself.

  • Lifetime Qt Champion

    Ok, but what kind of window do you want them to open since they are console application ?

  • I would like to see a console next to the gui, but only during debugging

  • Lifetime Qt Champion

    If it's only to see what your application is outputting, then you can connect the standard output and error related signals of QProcess and show the content of these two channels on a text edit control for example.

  • would this show me everything print() shows?

  • Lifetime Qt Champion

    That's the goal of reading stdout

Log in to reply