Results 1 to 2 of 2

Thread: QComboBox current text is empty, but currentText() got "("

  1. #1
    Join Date
    Jul 2014
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default QComboBox current text is empty, but currentText() got "("

    Hi,

    I connect a slot to signal: editTextChanged(const QString&).
    It is ok to receive current text by the slot each time when I key-in something.
    But when I "backspace" to clear the string in QComboBox, currentText() still return "(".

  2. #2
    Join Date
    Jul 2014
    Posts
    23
    Thanks
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: QComboBox current text is empty, but currentText() got "("

    Hi all,

    I found the root-cause, it was from the usage of qPrintable().
    This function will convert QString to char*, and the string pointer may be freed after the calling.
    So I should keep the string immediately after qPrintable(), that is it!

Similar Threads

  1. Replies: 1
    Last Post: 3rd December 2013, 02:19
  2. Replies: 3
    Last Post: 8th December 2011, 19:21
  3. Replies: 4
    Last Post: 5th March 2010, 18:03
  4. Translation QFileDialog standart buttons ("Open"/"Save"/"Cancel")
    By victor.yacovlev in forum Qt Programming
    Replies: 4
    Last Post: 24th January 2008, 19:05
  5. Replies: 2
    Last Post: 6th April 2006, 08:21

Tags for this Thread

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.