View Full Version : How can I connect a QPushButton and QLineEdit

2nd May 2011, 02:46
I am new programmer in qt and I want write a new program that when you
Clicked a button, line that maked with QLineEdit show a simple word like "HELLO".
I know I have to write a new class and make a new slot but I don't know how can
I write it's slot!!!!

2nd May 2011, 06:29
Do some effort please to read the documentation:

2nd May 2011, 08:10
as tbscope already mentioned, you need definitively some basics.

to give you some hints:

* write a custom class, I suggest to derive QDialog
* put a QLineEdit and a QPushButton into the dialog (you probably want to use Layouts)
* write a custom slot without Parameters. within the definition of this slot, you set the text of your QLineEdit
* connect the clicked()-signal of the button with your custom slot

I think, this task is a good one to start with qt. you can always ask here i you have any problems. show us your code and explain, what you tried to do, then we can help. But please don't ask: "Can someone give me code for ...".