Results 1 to 2 of 2

Thread: QComboBox with QCompleter

  1. #1
    Join Date
    Nov 2011
    Location
    Karlsruhe, Germany
    Posts
    57
    Thanks
    10
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Windows

    Lightbulb QComboBox with QCompleter

    Hello all,

    after the completer is set to combobox,

    the combobox doesn't have the items. is it correct?

    Qt Code:
    1. box.setEditable(true);
    2.  
    3. //box.addItem("a1");
    4. //box.addItem("a2");
    5. //box.addItem("a3");
    6.  
    7. list << "a1" << "a2" << "a3";
    8.  
    9. QCompleter com(list);
    10. com.setCaseSensitivity(Qt::CaseInsensitive);
    11. com.setCompletionMode(QCompleter::PopupCompletion);
    12.  
    13. box.setCompleter(&com);
    14.  
    15. // int num = box.count();
    16. box.show();
    To copy to clipboard, switch view to plain text mode 

    here num is 0, and if you push the button of dropdown menu, there is no element shown.
    only when you input something e.g "a", the meet results are shown.

    does it mean for the combobox list, we need to call addItem to set it again?

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

    Default Re: QComboBox with QCompleter

    I am not sure what your problem is.

    You say that the completer works and you say that the combobox is empty just the way you've created it.
    Seems to me that both object work as expected.

    Cheers,
    _

Similar Threads

  1. QCompleter + SQL
    By Wild Pointer in forum Qt Programming
    Replies: 1
    Last Post: 1st September 2012, 10:18
  2. Qcompleter
    By wambagilles in forum Qt Programming
    Replies: 7
    Last Post: 6th April 2011, 08:14
  3. QCompleter Help
    By shinegun in forum Qt Programming
    Replies: 0
    Last Post: 2nd September 2010, 13:26
  4. Replies: 1
    Last Post: 12th October 2008, 08:21
  5. QCompleter with QTextEdit
    By ePharaoh in forum Qt Programming
    Replies: 1
    Last Post: 19th July 2006, 13:03

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.