QT --QLineEdit

QLineEdit of six signals

Here Insert Picture Description
There are three inherited from QWidget, 2 Ge inherited from QObject

Diagram

figure 1
I've added the top six slots in the name of the function QLineEdit inside, the contents of the slot function is Debug output current signal names
on Figure 1 is not issued debug window signal, there is no thing.
When I filled out the names box to

figure 2
Can be seen from Figure 2, the four signal sent.
cursorPositionChanged is the current cursor has moved, be signaled
textEdited block is currently being edited, be signaled
textChanged changing the current text block, be signaled
editingFinished editing the current block is completed, to signal
image 3
when ENTER is pressed, then the issuing returnPressed signal

The two properties QLineEdit

Figure 4
Figure 5
Figure 6
Figure 7
To name the column, for example, when I was 5 and has not changed placeholderText when clearButtonEnable
gray prompt text box does not exist, when I changed the value placeholderText of the box that is prompted
by checking the box clearButtonEnabled is back in the Clear button

Relating to the issue of the current information is incomplete, not the next step tips

If the current study did not seek to enter the number reached 10, press OK
Figure 8
how to achieve, using QMessagedBox
Figure 9
I used here critical, error reporting
usage is as follows:

 if(name.length() < 1 || id.length() < 10 || ins.length() < 1){
     QMessageBox::critical(this,"错误","信息填写不完整,请重新检查","确定");
 }

When I press OK, and determine which fill in the information is complete, incomplete serial report errors pop up.
Other Question, Information, Warning similar usage.

Released three original articles · won praise 5 · Views 983

Guess you like

Origin blog.csdn.net/weixin_43086497/article/details/104578856