Results 1 to 9 of 9

Thread: completer and QComboBox

  1. #1
    Join Date
    Apr 2009
    Location
    Gdansk, Poland
    Posts
    11
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default completer and QComboBox

    How can I use completer in QComboBox when I use editable=false ?
    I have a lot of data in database and completer will be usefull to find correct row.
    Last edited by olosie; 15th May 2009 at 18:39.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: completer and QComboBox

    Using a completer with a combo box doesn't make any sense... You can use it with a line edit but a combo box already acts as a completer - start typing on your keyboard when it has focus and you'll see.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


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

    olosie (16th May 2009)

  4. #3
    Join Date
    Apr 2009
    Location
    Gdansk, Poland
    Posts
    11
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: completer and QComboBox

    Standard completer in combobox (when editable=false) works only for first letter but I want add something like search term.

  5. #4
    Join Date
    Jan 2008
    Location
    Poland
    Posts
    687
    Thanks
    4
    Thanked 140 Times in 132 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: completer and QComboBox

    How can I use completer in QComboBox when I use editable=false ?
    And how it should work if the combo box would be not editable? Make it editable and, as wysota said, it would be working as a completer.
    I would like to be a "Guru"

    Useful hints (try them before asking):
    1. Use Qt Assistant
    2. Search the forum

    If you haven't found solution yet then create new topic with smart question.

  6. The following user says thank you to faldzip for this useful post:

    olosie (16th May 2009)

  7. #5
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: completer and QComboBox

    You will need to write your own completer for that and set on combo box (QComboBox::setCompleter) .
    You can have look at QCompleter examples in Tools section in Qt Demos.

  8. The following user says thank you to aamer4yu for this useful post:

    olosie (16th May 2009)

  9. #6
    Join Date
    Apr 2009
    Location
    Gdansk, Poland
    Posts
    11
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: completer and QComboBox

    Quote Originally Posted by faldżip View Post
    And how it should work if the combo box would be not editable? Make it editable and, as wysota said, it would be working as a completer.
    editable is a bad solution because someone can write anything in editline (not only rows from database).

  10. #7
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: completer and QComboBox

    You need to write to search, dont you ?
    And by making combobox editable, it doesnt mean you can chage the existing entries. I guess combobox adds entries when u press return, but that behaviour can be easily overriden.

  11. The following user says thank you to aamer4yu for this useful post:

    olosie (16th May 2009)

  12. #8
    Join Date
    Apr 2009
    Location
    Gdansk, Poland
    Posts
    11
    Thanks
    7
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: completer and QComboBox

    Quote Originally Posted by aamer4yu View Post
    You need to write to search, dont you ?
    And by making combobox editable, it doesnt mean you can chage the existing entries. I guess combobox adds entries when u press return, but that behaviour can be easily overriden.
    Yes exactly
    I think the best solution is to extend current reaction on popup list (search by one key) in combobox. Is it possible to grab keys from popup list?

  13. #9
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: completer and QComboBox

    Can you explain what you try to achieve ?
    You have told us what you have tried, but ur goals are still not clear. Might be there is a better way

Similar Threads

  1. QComboBox problem
    By ^NyAw^ in forum Qt Programming
    Replies: 4
    Last Post: 31st March 2008, 11:43
  2. QComboBox
    By coderbob in forum Qt Programming
    Replies: 4
    Last Post: 12th December 2007, 06:38

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.