Results 1 to 2 of 2

Thread: Readonly QLineEdit emits editingFinished on focus lost - bug or expected behavior?

  1. #1
    Join Date
    Nov 2006
    Location
    Dresden, Germany
    Posts
    86
    Thanks
    9
    Thanked 7 Times in 7 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Readonly QLineEdit emits editingFinished on focus lost - bug or expected behavior?

    Hi there,

    just noticed an interesting behavior. When a QLineEdit is set to readonly, and it is focused and looses focus again, the editingFinished() signal is emitted. This is somewhat unexpected, since "readonly" means there won't be any editing, right?

    The relevant code is in qlineedit.cpp:1895 (in Qt 5.11.3):
    Qt Code:
    1. if (reason != Qt::PopupFocusReason
    2. || !(QApplication::activePopupWidget() && QApplication::activePopupWidget()->parentWidget() == this)) {
    3. if (hasAcceptableInput() || d->control->fixup())
    4. emit editingFinished();
    5. }
    To copy to clipboard, switch view to plain text mode 

    The signal is emitted without checking the "readonly" state.

    Is this expected behavior or should I post a bug-report?

    -Andreas
    Andreas

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Readonly QLineEdit emits editingFinished on focus lost - bug or expected behavior

    Hmm, good question.

    I personally would also find this behavior weird, i.e. not expect a readonly lineedit to emit this signal.

    I'd say file a bug report.

    Cheers,
    _

Similar Threads

  1. Replies: 2
    Last Post: 9th July 2016, 10:59
  2. Clear focus on editingFinished
    By iwatsu in forum Newbie
    Replies: 1
    Last Post: 7th October 2011, 20:41
  3. Focus lost
    By franco.amato in forum Qt Programming
    Replies: 1
    Last Post: 25th January 2010, 22:07
  4. editingFinished of QLineEdit
    By weixj2003ld in forum Qt Programming
    Replies: 1
    Last Post: 3rd November 2009, 09:06
  5. QLineEdit lost focus
    By codebehind in forum Newbie
    Replies: 5
    Last Post: 4th May 2007, 16: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.