0

I need to migrate qt/4.8.6 code to qt/5.9 . I am struggling with using print statement within QScriptEngine evaluate statement. In simplified form implementation looks like:

#include <iostream>
#include <QApplication>
#include <QtScript>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QScriptEngine engine;
    std::cout << "Hello, world!\n";
    engine.evaluate("print('test\n\n')");
    }

.pro file

CONFIG += qt
CONFIG += console

SOURCES += main.cc

QT += widgets 
QT += script

sources.files =  main.cpp qscript.pro
INSTALLS +=  sources

->output to console: Hello, world!

in qt/4.8.6 it prints out evaluated print statement to console "Hello, world! test", whereas in qt/5.9 it prints only "Hello, world!"

Any idea, why using print command is not working? Note, I need to implement printing to stdout by using js scripting+ evaluate.

0 Answers0