Results 1 to 7 of 7

Thread: ComboBox into String

  1. #1
    Join Date
    Sep 2009
    Posts
    34
    Thanks
    28
    Qt products
    Qt4
    Platforms
    MacOS X

    Question ComboBox into String

    Hey guys,

    I was wondering how I can obtain what a user selected in a ComboBox and put into a QString? (By the way there are two combo Boxes, one for the day of the month, the other for the month itself, and they display the currently selected day/month as a number, unless nothing is selected as in that case the comboBox displays a hyphen "-").

    Code samples would be greatly appreciated.

    Thanks in advance,

    Nefastious

  2. #2
    Join Date
    Jun 2007
    Location
    India
    Posts
    1,042
    Thanks
    8
    Thanked 133 Times in 128 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: ComboBox into String


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

    Nefastious (14th October 2009)

  4. #3
    Join Date
    Sep 2009
    Posts
    34
    Thanks
    28
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: ComboBox into String

    Well,...

    the problem is currentText() returns and int and I'm not sure how to turn that into a QString...

    Code samples are appriciated as usual

    Thanks

  5. #4
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: ComboBox into String

    currentText returns QString. what is the problem? can you elaborate it?
    Qt Assistant -- rocks!
    please, use tags [CODE] & [/CODE].

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

    Nefastious (14th October 2009)

  7. #5
    Join Date
    Apr 2009
    Location
    Valencia (Spain)
    Posts
    245
    Thanks
    38
    Thanked 19 Times in 19 Posts
    Qt products
    Qt4
    Platforms
    Symbian S60

    Default Re: ComboBox into String

    maybe he's thinking in itemIndex :P

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

    Nefastious (14th October 2009)

  9. #6
    Join Date
    Sep 2009
    Posts
    34
    Thanks
    28
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: ComboBox into String

    Ooops, sorry, after all I really was using currentIndex instead of currentText (this is what happens when you try to work when you haven't slept that much...)

    I'd like to thank you all for your support

  10. #7
    Join Date
    Jan 2006
    Location
    Frankfurt
    Posts
    500
    Thanks
    1
    Thanked 52 Times in 52 Posts
    Platforms
    MacOS X Unix/X11

    Default Re: ComboBox into String

    You should seriously considering not using the string. If you translate your application, the string will be different and you have to adopt the logic.
    It's nice to be important but it's more important to be nice.

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

    Nefastious (15th October 2009)

Similar Threads

  1. Replies: 0
    Last Post: 18th February 2009, 13:31
  2. String operations, printing to stdout
    By Cruz in forum Newbie
    Replies: 3
    Last Post: 20th January 2009, 15:30
  3. Replies: 8
    Last Post: 15th May 2007, 09:21
  4. saving a c string of variable length in a shared memory?
    By nass in forum General Programming
    Replies: 4
    Last Post: 3rd January 2007, 14:40
  5. Filling combobox from database
    By Philip_Anselmo in forum Qt Programming
    Replies: 3
    Last Post: 11th May 2006, 17:53

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.