我正在使用Qt Creator創建UI。
UI由兩個或更多個QLineEdit
s和十個QPushButton
s組成,用於輸入0-9個數字字符到QLineEdit
s。我怎樣才能在QLineEdit
之間逐一輸入0-9數字string
s。如何從QPushButtons中輸入字符到QLineEdits,具體取決於Qt中的焦點
如果我按QPushButton
與標籤‘在QLineEdit
1或如果QLineEdit
2被選擇應該追加‘在QLineEdit
2並分別與5’「5'和光標在QLineEdit
(比如說QLineEdit
1)它應該追加’5另外QPushButton
也是。
要完成你的答案是:檢查哪些QLineEdit的具有焦點改變其文本:'QLineEdit的* lineEdit = ui.lineEdit-> hasFocus()? ui.lineEdit:ui.lineEdit2; lineEdit-> setText(lineEdit-> text()+ btn-> text())' – Frodon
感謝您的回覆。我無法妥善解釋您的答案,請您詳細說明。請確保我正在使用QT Creator –