Results 1 to 3 of 3

Thread: Clearing editted text from ComboBox on return

  1. #1
    Join Date
    May 2008
    Posts
    25
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Clearing editted text from ComboBox on return

    As the title says.

    If I enter a value into an editable combobox and then hit return, I'll looking to be able to clear the combobox, ready for the next input.

    Thoughts? Suggestions?

    R

  2. #2
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Clearing editted text from ComboBox on return

    Since you are using an editable combox it has a QLineEdit asociated with it. see QComboBox::lineEdit () .
    QLineEdit has the editingFinished () signal.
    ==========================signature=============== ==================
    S.O.L.I.D principles (use them!):
    https://en.wikipedia.org/wiki/SOLID_...iented_design)

    Do you write clean code? - if you are TDD'ing then maybe, if not, your not writing clean code.

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

    cnbp173 (3rd February 2011)

  4. #3
    Join Date
    May 2008
    Posts
    25
    Thanks
    3
    Thanked 2 Times in 2 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Clearing editted text from ComboBox on return

    Hi there,

    I tried this, but to no avail. I tried:

    connect(comboBox,SIGNAL(editingFinished()),comboBo x,SLOT(clearEditText()));

    Is this right? or is there a specific way to cast to the lineEdit functions

    R


    Added after 19 minutes:


    Quote Originally Posted by cnbp173 View Post
    Hi there,

    I tried this, but to no avail. I tried:

    connect(comboBox,SIGNAL(editingFinished()),comboBo x,SLOT(clearEditText()));

    Is this right? or is there a specific way to cast to the lineEdit functions

    R
    OK, sorry for being blonde......

    works with

    connect(comboBox->lineEdit(),SIGNAL(editingFinished()),comboBox,SLO T(clearEditText()));
    Last edited by cnbp173; 3rd February 2011 at 22:41.

Similar Threads

  1. Replies: 1
    Last Post: 22nd July 2010, 17:12
  2. clearing a list.....
    By reshma in forum Qt Programming
    Replies: 7
    Last Post: 22nd March 2009, 15:28
  3. centering combobox text
    By illuzioner in forum Qt Programming
    Replies: 4
    Last Post: 30th May 2007, 14:06
  4. Replies: 8
    Last Post: 15th May 2007, 09:21
  5. Clearing QDateEdit
    By jpujolf in forum Qt Programming
    Replies: 3
    Last Post: 27th July 2006, 21:19

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.