Hello! Friends,
I have designed a GUI in which i have lots of cout & cerr messages. Right now am able to see all those in console window but i want them to be displayed in my GUI's QTextEdit widget.
For this i made forum search and found this from where i got to know that i will have to make my own streaming class that inherits std:
stream and outputs everything using qDebug or some completely different mechanism. Also here i found that i can use qdebugstream.h header to do the needful, but its not working
May be i might have made mistake in implementing it.
Here is what i tried: -
#include <QtGui>
#include <iostream>
#include "qdebugstream.h"
using namespace std;
#include "log.h"
{
setupUi(this); // this sets up GUI
mylog
::setWindowTitle(QString("Checking log"));
connect( Start, SIGNAL( clicked() ), this, SLOT( examine() ) );
}
void mylog::examine()
{
cout <<"Hello! We are ready for working" << endl;
QDebugStream cout(std::cout,logTextEdit);
QDebugStream cerr(std::cerr,logTextEdit);
}
#include <QtGui>
#include <iostream>
#include "qdebugstream.h"
using namespace std;
#include "log.h"
mylog::mylog(QWidget *parent)
:QWidget( parent )
{
setupUi(this); // this sets up GUI
mylog::setWindowTitle(QString("Checking log"));
connect( Start, SIGNAL( clicked() ), this, SLOT( examine() ) );
}
void mylog::examine()
{
cout <<"Hello! We are ready for working" << endl;
QDebugStream cout(std::cout,logTextEdit);
QDebugStream cerr(std::cerr,logTextEdit);
}
To copy to clipboard, switch view to plain text mode
Can anyone please let me know where am i making mistake. Or is there any other way to do the needful.
I will be grateful if helped--> Thanks in advance.
Bookmarks