Results 1 to 3 of 3

Thread: Reading from line edit

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Aug 2011
    Posts
    42
    Thanks
    10
    Qt products
    Qt4
    Platforms
    Windows

    Default Reading from line edit

    I have a stacked widget structure in my program. In one of the widgets i have a line edit element in which an external device that pastes a string onto. I use a lineEdit_textchanged function to capture the lineedit value(i use this later in the program) & switch to the next widget. The problem is that the textchanged function switches before the device finishes inputting the whole string. Is there a workaround this issue.

    Thank you in advance.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Reading from line edit

    I assume the external device is keyboard stuffing so textChanged() is called for each input character just as if you were typing it yourself. Either use editingFinished() if the device triggers it (by Tab or Enter) or set a strict validator/and or input mask and only react to textChanged() if hasAcceptableInput() is true.

  3. The following user says thank you to ChrisW67 for this useful post:

    premroxx (27th October 2011)

  4. #3
    Join Date
    Oct 2011
    Posts
    4
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Reading from line edit

    Try using the "editingFinished()" signal, instead.

  5. The following user says thank you to waterstw for this useful post:

    premroxx (27th October 2011)

Similar Threads

  1. QTableView line edit clears the text on edit
    By PlasticJesus in forum Qt Programming
    Replies: 5
    Last Post: 14th March 2015, 19:06
  2. Reading a text line per line
    By Momergil in forum Newbie
    Replies: 0
    Last Post: 19th July 2011, 15:46
  3. Replies: 3
    Last Post: 26th August 2010, 08:57
  4. Image reading and writing line by line
    By Astrologer in forum Qt Programming
    Replies: 7
    Last Post: 29th April 2010, 08:15
  5. Replies: 8
    Last Post: 15th May 2007, 09:21

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.