Results 1 to 3 of 3

Thread: QLineEdit: textEdited called on backspace

  1. #1
    Join Date
    Feb 2007
    Location
    Italy
    Posts
    69
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QLineEdit: textEdited called on backspace

    Hello,
    from the manual of QLineEdit
    textEdit():
    This signal is emitted whenever the text is edited. The text argument is the next text.
    Unlike textChanged(), this signal is not emitted when the text is changed programmatically, for example, by calling setText().
    But still this signal seems to be called when using the backspace() (or del()) method.

    How come? If the difference is only on setText(), then what's the point of having two methods, since I've to do everything by hand?

    Thanks in advance
    ~Aki
    Last edited by akiross; 10th August 2011 at 20:06.

  2. #2
    Join Date
    May 2011
    Posts
    239
    Thanks
    4
    Thanked 35 Times in 35 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Symbian S60

    Default Re: QLineEdit: textEdited called on backspace

    I think Qt's approach makes sense. When you use backspace() in your app, you are editing the field programmatically and may need to callback to check what is happening. But the situation is different when you get the text in a string, edit it with any functions needed and return the whole string back (perhaps changed, perhaps replaced). In that case it is "changed", but not "edited".

  3. #3
    Join Date
    Feb 2007
    Location
    Italy
    Posts
    69
    Thanks
    12
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QLineEdit: textEdited called on backspace

    Hi, thanks for the reply!
    I'm not sure I got your point...
    Why using "changed" and not "edited" if only *some* functions affect the behavior, while others don't?
    I mean, we could also use only one signal "changed", and keep track of what we are doing programmatically; having an "edited" signal (which signals only changes by the user), is a convenient way of tracking what user is doing and. But if both signals are emitted some times, while some other times only one signal is emitted, then where's the convenience?

    Anyway, I'm not sure if just asking "why" is useful... As "programmatically" on the doc doesn't seems to be always honored, it would be useful to know which methods emit which signal.

    Thanks again
    ~Aki

Similar Threads

  1. Replies: 1
    Last Post: 19th October 2010, 05:08
  2. QTmobility why Backspace dont run on QTextedit
    By nhs_0702 in forum Qt Programming
    Replies: 1
    Last Post: 3rd June 2010, 02:30
  3. Replies: 2
    Last Post: 8th October 2008, 14:18
  4. textChanged vs textEdited
    By Raccoon29 in forum Newbie
    Replies: 4
    Last Post: 27th March 2008, 17:01
  5. Slot to color background of line edit on textedited
    By tpf80 in forum Qt Programming
    Replies: 5
    Last Post: 21st June 2007, 09:02

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.