Hi,
I have an application composed by two different parts: a window and a terminal.
The terminal interacts with my window : for instance the terminal asks to a user the number of the shape he wants to display on the window, the user enters the number and the terminal asks the window to display the shape which has the number submitted by the user.
My question is: how can my terminal interact with my window? I am on Ubuntu with Qt Creator.
I’d like my application launches a terminal and a window when it is launched.
I don’t know how to run a part of my program in a terminal and the other part in a window. For exemple I’d like to do something like this :
#include <iostream>
#include <QApplication>
using namespace std;
int main(int argc, char* argv[])
{
int number;
//Create a window
QApplication app(argc, argv);
MainWindow window(900, 700, QString("Window"));
window.show();
//On the terminal
cin >> number;
//Display shape on the window
window.drawShape(number);
return app.exec();
}
But I have an error due to std::cout. I guess it’s because I don’t have a standard out in a terminal…
Thanks for your help!
Have a nice fay.
↧