how to enter a character to qlineEdits from pushButtons depending on the selected lineEdit

  • I am using QT creator to make a UI. UI consists of two or more lineEdits and ten pushButtons to input 0-9 numberic characters to lineEdits. How can I enter 0-9 number strings in both lineEdits one by one.

    If I press pushButton with label '5' and cursor is on lineEdit (say lineEdit 1) it should append '5' in lineEdit 1 or if lineEdit 2 is selected it should append '5' in lineEdit 2 and any number of lineEdits respectively with 0-9 numeric pushButtons also.

  • Lifetime Qt Champion

    look at this sample
    Shows how to hook up buttons etc. (its numeric keypad)

    you can change it to use
    QApplication::focusWidget () const

    to input to whatever LineEdit that is selected.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.