且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

使用QSlider更改变量的值

更新时间:2023-02-12 13:57:11

slider已经是一个指针,例如移除&'

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

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

编辑:这将不工作,因为信号没有参数。
将setValue(double)重命名为setValue(),并使用slider-> value()从滑块中获取值。

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().