I’m new both to QT development, and std libraries.
At this moment I’m trying to create a simple console application, although it’s simple, it must be cross platform. It must work with Linux, Windows and android.
While I’m quite used with using std::cout and std::cin to read and write to the console. I’m trying to figure out the same thing with QT libraries.
Is there any way of interacting with the user, using QT library? I cannot use std::cout and std::cin.
I’ve search for answers at stack overflow, but everything I find is people telling to use qDebug, but that’s not what I need, I need the interaction with the user.
Qt is mainly used for GUI’s, but you can connect some Qt Classes to act like stdin and stdout.
I would read up on at least these three, and if you really don’t want to use std::cin and std::cout, I would use QTextStream objects in the same way.
QDebug
QIODevice
QTextStream
Here is a chunk of code from the details documentation:
QFile also has some good information in its documentation.
The only real advantage I would see with using QTextStream instead of the std library functions is to later connect it to your own built in console in your GUI (later) instead of the OS console.
Another way that I get settings and setup information from the user is using QSettings and setting the default format to INI and opening the INI file using QDesktopServices::openUrl().