Qt World Summit: Submit your Presentation

how to pass a double value from c++ to a qt user interface

  • I have made a user interface using qt creator 5.9.1. I want to be able to connect it now to an external c++ program so that I can update the values of the double spinboxes. Could someone show a simple example of what code I would need to write to send the double value from the external c++ program. And what code I would need to write to receive that value in the qt program.

  • I mean a c++ program that is not on qt. I am using ubunto 16.04

  • @VRonin could you give me a simple example of how to actually implement this to pass a double value in from c++ to qt I have read this but I am still confused by it.

  • Should be something like:


    #include <iostream>
    int main(){
    double aNumber;
    std::cin >> aNumber;
    std::cout << "Doubled number: " << 2.0*aNumber;
    return 0;


    #include <QCoreApplication> 
    #include <QProcess>
    #include <QByteArray>
    #include <QDebug>
    int main(int argc, char **argv)
    const double magicNumber = 1.56;
    QCoreApplication app(argc,argv);
    QProcess otherProcess;
    if (!otherProcess.waitForStarted())
            return 1;
    if (!otherProcess.waitForReadyRead())
            return 1;
    qDebug() << otherProcess.readAllStandardOutput();
    if (!otherProcess.waitForFinished())
            return 1;
    return 0;

  • @VRonin thank you so much

Log in to reply