Problems with Open-Source Downloads read https://www.qt.io/blog/problem-with-open-source-downloads and https://forum.qt.io/post/638946

How to add console with mainwindow



  • Dear All, I am new to qt and I want to make gui for my project that I have written in c++. In c++ when I run the program I can see the output of printf statements in console, like if I have three printf statements, I can see the output of all statements in console. I am using qDebug for display and right now using QLabel to display in gui but if I write more than one qDenug statements I could see the output of last qDebug. Please guide me how can I display the output of qDebug in gui similar to the console so that I can see output of all qDebug statements in gui.



  • Please share your code. So that I can check.



  • thank you for your quick reply. I found the solution,
    @
    void MainWindow::print(const QString &input){

    data_lab += input;
    ui->label->setText(input);

    ui->textBrowser->setText(data_lab);
    }@

    above code I am using to display output, I was not using below line in my code
    @data_lab += input;@

    After adding this line in my code I can see output of all statements. where data_lab is a Qstring that I have defined in my mainwindow class.

    I am using textbrowser but is it possible to use console like window in gui?


Log in to reply