Results 1 to 4 of 4

Thread: access to combobox number

  1. #1
    Join Date
    Aug 2013
    Posts
    41
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default access to combobox number

    Hello,

    I have 3 QComboBoxes:

    Combo 0:
    Combo 1:
    Combo 2:

    I have used a for loop to add them to the layout. Each comboBox has 2 items added to it. Using the connect function, when the index of the item is changed, then I call the slot function.

    So far its clear. But, I would like to have access to the Combo box number as well in the slot function.

    For example, when I change the index to 1 in Combo 2, then along with the index number = 1, how can I have access to the combobox number = 2 as well in the slot function?

    Please guide.

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,475
    Thanked 274 Times in 269 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: access to combobox number


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

    uz_qt (14th October 2013)

  4. #3
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,420
    Thanks
    37
    Thanked 1,545 Times in 1,495 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: access to combobox number

    Or three slots that call a common private method with the combo box number as and additional argument

    Cheers,
    _

  5. The following user says thank you to anda_skoa for this useful post:

    uz_qt (14th October 2013)

  6. #4
    Join Date
    Aug 2013
    Posts
    41
    Thanks
    4
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: access to combobox number

    thanks guys for your inputs.

    I have created a QComboBox subclass and appended them using QVector<>. It works as desired now.

    Following document was helpful too! (for those who have similar problems)
    http://doc.qt.digia.com/qq/qq10-signalmapper.html

    Cheers! :-)

Similar Threads

  1. Color ComboBox
    By ioannis in forum Qt Programming
    Replies: 14
    Last Post: 23rd March 2016, 07:08
  2. how do I use comboBox
    By QT++ in forum Newbie
    Replies: 5
    Last Post: 2nd July 2013, 14:13
  3. Replies: 1
    Last Post: 5th March 2012, 06:34
  4. Help ComboBox
    By vinny gracindo in forum Newbie
    Replies: 3
    Last Post: 20th November 2009, 19:41
  5. ComboBox of bmp:s
    By SailinShoes in forum Qt Programming
    Replies: 2
    Last Post: 5th March 2008, 15:22

Tags for this Thread

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.