I have been new to the Qt environment. I recently started with a QtCreator
project for a simple chat application (QMainWindow). I have nearly completed the project but stuck with the SIGNAL/SLOT problem
.
Let me explain my problem in brief :
Due to the length of the code I am not able to paste it here.
- I have two classes
MainWindow
andNetworkFile
. - The function
newServerConn()
in NetworkFile connects the signalreadyRead()
to the slotreadFromClient()
. - The string returned by client is stored in a
QString
inreadFromClient()
SLOT.
Problem:
I have to return the QString in the slot to the newServerConn()
function and from there to a function in MainWindow
class because only then I would be able to print the string to the plainLineEdit
widget pointed by the ui
object.
Question 1: How can I return a value from the slot?
Question 2:
Or is there any way I could get a copy of the ui
instance in the NetworkFile
class so that I could use the widgets from there?
Thanks.