Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to enter a character to qlineEdits from pushButtons depending on the selected lineEdit

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

Scheduled Pinned Locked Moved Unsolved General and Desktop
line editpush button
2 Posts 2 Posters 793 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Saad_Rafey
    wrote on 24 Nov 2015, 16:41 last edited by
    #1

    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.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 24 Nov 2015, 17:50 last edited by
      #2

      Hi
      look at this sample
      http://www.java2s.com/Code/Cpp/Qt/Calculatorwithpushbuttons.htm
      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.

      1 Reply Last reply
      0

      1/2

      24 Nov 2015, 16:41

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved