Results 1 to 13 of 13

Thread: QComboBox: setCurrentIndex() is not working?

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2007
    Location
    Jundiai/SP, Brazil
    Posts
    114
    Thanks
    5
    Thanked 7 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox: setCurrentIndex() is not working?

    I agree, but from the standpoint of someone who needs to implement a solution(especially if it depends on your employment, for example.) ,
    it will work. Giving space to think of a solution more charm.
    That is, "Doing work first!"

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

    Default Re: QComboBox: setCurrentIndex() is not working?

    Quote Originally Posted by vcp View Post
    I agree, but from the standpoint of someone who needs to implement a solution(especially if it depends on your employment, for example.) ,
    it will work. Giving space to think of a solution more charm.
    That is, "Doing work first!"
    Yes... I have spent really lot of time at work correcting things after people with attitude similar to yours.
    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. #3
    Join Date
    Apr 2015
    Posts
    1
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QComboBox: setCurrentIndex() is not working?

    Quote Originally Posted by wysota View Post
    Yes... I have spent really lot of time at work correcting things after people with attitude similar to yours.
    I hope you accept my question related to your disscussion with a time distance. The solution suggested by vcp is very important for the case, when you want to use combobox for update of the item in a database record. Very often case, when you need to limit the choice of data values by combobox and want to have a single field for the update of the item. It is one of the most frequent and needed cases in db applications. I think vcp found relatively good solution. When you are so sceptic to it, please can you advice more efficient and simpler solution? Thanks in advance for you reply, Hynek.

  4. #4
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: QComboBox: setCurrentIndex() is not working?

    If there are only a few fixed items then that approach, or the OP's if-else cascade is quite fine.

    If the combobox contains 10000 items then a linear search is probably not the quickest option. The more times you have to do this search the more noticeable/significant the slowdown may become. A list like that would likely have to be sorted in order to be usable by a human, and there are faster ways to search in a sorted list (binary search for example). For an unsorted list it may be an option to keep a separate hash map of text to index. As always there is a set of tradeoffs that are partly application specific.

Similar Threads

  1. QComboBox::insertSeparator(int index) is not working
    By osiris81 in forum Qt Programming
    Replies: 2
    Last Post: 14th July 2011, 18:43
  2. breakpoint inside QComboBox subclass not working
    By yodasoda in forum Qt Programming
    Replies: 6
    Last Post: 4th June 2010, 17:02
  3. QComboBox
    By bismitapadhy in forum Qt Programming
    Replies: 7
    Last Post: 15th July 2009, 06:01
  4. setCurrentIndex() doesn't display cursor(bounding rect)
    By DIMEDROLL in forum Qt Programming
    Replies: 0
    Last Post: 5th November 2008, 06:24
  5. Replies: 1
    Last Post: 13th June 2008, 18:58

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
  •  
Qt is a trademark of The Qt Company.