PDA

View Full Version : Confused about Signals and Slots



duave
4th October 2010, 06:28
Hey guys,

I'm new to QT and I need some help with signals and slots.

Basically, I'm writing a program that uses QTcpSocket and connects to a server. I can get the connection part, but I need the text on the QPushButton to change from "Connect" to "Disconnect" when they click it and back from "Disconnect" to "Connect" when they click it again (and on.. and on..).

I can't figure out how to get the signals and slots to change appropriately.

How can I go about setting this up in QT?

aamer4yu
4th October 2010, 06:58
connect(button,SIGNAL(clicked()),this,SLOT(process ButtonClick()));
In the slot, you can check the text of the button and change it accordingly..