QT creates buttons that add text to the edit text box

New for QT, just playing with him to find out if he likes something that I like, and if so, then and further, and to study the program in-depth.

Damage with button concept. I created a button and a text area. I want to add a line of text to a text box when a button is clicked.

I can not find anything on google or QT wiki for this. Can someone point me in the direction so that I can at least start and play with this great tool.

+3
source share
1 answer

In Qt, signals and slots are used to communicate between objects. This should provide you with the necessary information to get you started.

. Qt , , . - , . Qt , ​​ , , .

, QPushButton clicked() , , ( ):

 QPushButton * btn = new QPushButton("Button", this);
 connect(btn, SIGNAL(clicked()), this, SLOT(onBtnClicked()));

:

 private slots:
     void onBtnClicked();

:

 void MySpecialWidget::onClick() 
 {
     // Do what is to be done
 }

, ... , , :

Object::connect: No such slot MySpecialWidget::onClick() in ...

Object::connect: No such signal ....

, .

, Qt.

+4

All Articles