Search code examples
qtdesignermayaqspinboxqslider

QT Designer: Connect QSlider and QDoubleSpinBox (both ways)


I'm new to QT Designer and am building interfaces for Maya. In most tutorials I've seen, setting signals/slots between two objects is pretty straightforward.

I'm trying to setup a slider and spinbox to drive each other. If the slider is updated, the value in the spinbox updates, and vice versa. However, there don't seem to be any updates for all the connections I try.

I want to try and do this purely through QT Designer.

Here's an image of the options I get going from the slider to the spinbox:

enter image description here


Solution

  • One of my Maya's script use something similar, except that these are Int in the QSpinBox. I use these sliders to set the first and last frame when baking animations.

    Here is a screenshot (couldn't manage to move the labels on it, sorry)enter image description here

    If you use the signals ans slots in the table below, this should work fine.

    _______________________________________________________________________
    | Source Widget | Signal            | TO | Slot          | Dest Widget |
    |---------------|-------------------|----|---------------|-------------|
    | QSlider       | sliderMoved(int)  | TO | setValue(int) | QSpinBox    |
    | QSpinBox      | valueChanged(int) | TO | setValue(int) | QSlider     |