Results 1 to 3 of 3

Thread: Set value to QComboBox

  1. #1
    Join Date
    Feb 2011
    Location
    Latvia
    Posts
    139
    Thanks
    24
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Set value to QComboBox

    Hi, it's me again.
    To complete my app I need to learn, how to set a value to the QComboBox. Is that eve possible? Fact is - my QComboBox has 6 values. How can I set one of them to be the active one, when all I know is the QString of the value?

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,391
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Set value to QComboBox

    You can find item's index with int QComboBox::findText() method, and pass this index to void setCurrentIndex ( int index ), it's all in the docs.

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

    Archa4 (19th May 2011)

  4. #3
    Join Date
    Feb 2011
    Location
    Latvia
    Posts
    139
    Thanks
    24
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Set value to QComboBox

    Thanks for fast answer, i was trying to find something like that but failed...

Similar Threads

  1. QComboBox
    By kavinsiva in forum Qt Programming
    Replies: 3
    Last Post: 10th August 2009, 17:11
  2. QComboBox
    By bismitapadhy in forum Qt Programming
    Replies: 7
    Last Post: 15th July 2009, 07:01
  3. QComboBox
    By coderbob in forum Qt Programming
    Replies: 4
    Last Post: 12th December 2007, 07:38
  4. QComboBox
    By merry in forum Qt Programming
    Replies: 1
    Last Post: 31st August 2007, 14:17
  5. QComboBox??
    By crocus in forum Qt Programming
    Replies: 3
    Last Post: 8th February 2006, 19:00

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.