Using QSlider to change the value of a variable

前端 未结 1 1424
攒了一身酷
攒了一身酷 2021-01-29 01:13

I\'m trying to use QSlider to change the value of a variable,

 #include 

class MainThread : public QWidget{
Q_OBJECT
public:
MainTh         


        
相关标签:
1条回答
  • 2021-01-29 01:44

    slider is already a pointer, e.g. remove the '&'

    connect( slider, SIGNAL((slider->valueChanged())), this, SLOT(setValue(double)) );
    

    Edit: This won't work, since the signal has no argument. Rename the setValue(double) to setValue() and get the value from the slider with slider->value().

    0 讨论(0)
提交回复
热议问题