Reputation: 239
This question sounds simple, but I've struggled with it.
I have a.h, b.h, c.h, mainwindow.h
and a.cpp, b.cpp, c.cpp, main.cpp, mainwindow.cpp
In a, b, c these C++ Classes I have some custom functions, the common between them is they all use "printf" to print out some messages(since they all origin from C++).
In my UI, I drag a text edit and uses "ui->textedit->append(QString str)" to print out messages.
The code above works fine if written in "mainwindow.cpp", but I want those message in a, b, c Classes can also be print in my text edit component.
How should I do?
Upvotes: 0
Views: 326
Reputation: 1660
There are two ways that I would approach this:
In a, b cnd c you will replace the occurances of printf with either the call to the function, or by emitting a signal.
I would probably go with the second option.
Upvotes: 1