Results 1 to 4 of 4

Thread: Help with QComboBox

  1. #1
    Join Date
    Jul 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Help with QComboBox

    Hello

    in the main windows I use a text file to get the values for the QComboBox
    but I also have slots that modify this same file
    when I return to the main window the values don't changes
    How can I proceed to update the values in the QComboBox

    and thank you;

  2. #2
    Join Date
    May 2011
    Posts
    11
    Thanks
    1
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows Maemo/MeeGo

    Default Re: Help with QComboBox

    Hello,
    if I get your question right, there are two method that I might think of:

    1) reload the combobox; call clear() and refill the combo's values.
    2) iterate over the combos values and check if the new value exist; using count() to get the size of values in the combo and then loop through them searching one by one.

    hope it helps

  3. #3
    Join Date
    Jul 2012
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Help with QComboBox

    it's a paiement program
    first you select the company with QComboBox
    but if you want to add a new company you push the botton new
    wich take the data of the new company and save them into the file that containt all companies
    it is the same file that QComboBox use to get it's values
    but when add successfully your new company and return to the main window
    the values in the QComboBox are the same

    I hope that this describe the situation properly

    And thank you

  4. #4
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Thanks
    15
    Thanked 16 Times in 15 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11

    Default Re: Help with QComboBox

    Quote Originally Posted by the9gamer View Post

    but when add successfully your new company and return to the main window
    the values in the QComboBox are the same

    I hope that this describe the situation properly

    And thank you
    R u sure you read the file (hope) each time before reloading the contents of QComboBox?
    did you debug the file reading operation to make separately to make sure it works fine?
    paste your file reading and combo box loading function here, so that we could find the problem.

Similar Threads

  1. QComboBox BUG?
    By mak_user in forum Qt Programming
    Replies: 15
    Last Post: 18th September 2020, 08:00
  2. How to get value from QComboBox
    By talmage in forum Newbie
    Replies: 6
    Last Post: 1st December 2011, 15:11
  3. Set value to QComboBox
    By Archa4 in forum Newbie
    Replies: 2
    Last Post: 19th May 2011, 13:46
  4. QComboBox
    By bismitapadhy in forum Qt Programming
    Replies: 7
    Last Post: 15th July 2009, 07:01
  5. QComboBox
    By coderbob in forum Qt Programming
    Replies: 4
    Last Post: 12th December 2007, 07: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.