Results 1 to 4 of 4

Thread: QComboBox Signals and Slots Help

  1. #1
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QComboBox Signals and Slots Help

    I would like to have a QComboBox control the display of options based on what is currently selected in the ComboBox. I am fairly new to Qt and I haven't really figured the whole signals/slots thing out yet.

    I have a ComboBox with "Mode 1", "Mode 2", "Mode 3", etc... and for "Mode 1" I want three checkboxes to be displayed, and "Mode 2", I want a SpinBox, and so on...

    Is the best way to do this by using the currentIndexChanged signal, and sending it to a custom slot that hides and shows the options I want to display for each combobox choice? I'm not really sure the best way to structure this, because in the end I will have many different comboBoxes where each choice will need a page of options displayed below it.

    Does anyone have an example of how I could accomplish this? Thanks for the help,
    dave

  2. #2
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QComboBox Signals and Slots Help

    I just discovered the QStackedWidget reference. This looks like a great option. Sorry for the trouble. If anyone has a good example using QComboBox with QStackedWidget, I would love to see what all can be done with it. Thanks,
    dave

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

    Default Re: QComboBox Signals and Slots Help

    Connect the currentIndexChanged signal from the combobox to setCurrentIndex slot in the stacked widget. I think this is enough for an example

  4. #4
    Join Date
    Feb 2007
    Posts
    81
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QComboBox Signals and Slots Help

    yes, that worked perfectly. I just hadn't ever seen the QStackedWidget documentation before. Thanks for much for your help,
    dave

Similar Threads

  1. Signals and Slots question
    By Thoosle in forum Qt Programming
    Replies: 5
    Last Post: 5th December 2006, 00:24
  2. Nested signals and slots
    By vishva in forum Qt Programming
    Replies: 2
    Last Post: 18th August 2006, 09:47
  3. Signals and Slots in dll
    By ankurjain in forum Qt Programming
    Replies: 8
    Last Post: 29th March 2006, 08:12
  4. Order of signals and slots
    By Morea in forum Newbie
    Replies: 1
    Last Post: 26th February 2006, 22:09
  5. Problem with Signals and Slots
    By Kapil in forum Newbie
    Replies: 11
    Last Post: 15th February 2006, 11:35

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.