PDA

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



Fafa
2nd May 2011, 03:46
Hi.
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!!!!

tbscope
2nd May 2011, 07:29
Do some effort please to read the documentation:
http://doc.qt.nokia.com/4.7/tutorials.html

FelixB
2nd May 2011, 09: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 ...".