개요:
1. ui 컨트롤을 끌어 QLineEdit 컨트롤을 만듭니다.
2. QLineEdit 컨트롤의 크기 및 위치 설정
setGeometry (int x, int y, int width, int height)
// (x, y)는 컨트롤의 왼쪽 위 모서리 좌표, width는 컨트롤의 너비, height는 컨트롤의 높이입니다.
ui->lineEdit->setGeometry(25,25,150,25);
3. QLineEdit 컨트롤 설정을 수정할 수 없습니다.
ui->lineEdit->setEnabled(false);
4. QLineEdit 컨트롤 입력의 글꼴 스타일 및 크기 설정
QFont font;
font.setPointSize(16); //字号大小
font.setFamily(("wenquanyi")); //字体样式
font.setBold(false);
ui->lineEdit->setFont(font); // 为控件设置格式
5. QLineEdit 컨트롤의 내용에 값 할당
ui->lineEdit->setText("0.000015");
6. QLineEdit 컨트롤의 내용 가져 오기
QString 유형을 가져옵니다.
QString name = ui->lineEdit->text();
이중 유형 가져 오기 :
double c1 = ui->lineEdit->text().toDouble();
다른 유형은 비슷합니다 ...
7. QLineEdit 컨트롤에 입력 할 때 암호 텍스트를 표시합니다.
//输入的时候就显示圆点
ui->edit_pw->setEchoMode(QLineEdit::Password);