我正在根据以下链接使用示例
将参数传递给槽
当某个滑块发布时,我正在尝试将某个函数与给定参数连接起来。
connect(m_customUIForm.horizontalSliderOr, &QAbstractSlider::sliderReleased(), this, [this]{ sendMoveActuator(1); });
问题似乎出在信号&QAbstractSlider::sliderReleased()
error: cannot call member function 'void QAbstractSlider::sliderReleased()' without object
connect(m_customUIForm.horizontalSliderOr, &QAbstractSlider::sliderReleased(), this, [this]{ sendMoveActuator(1); });
传递滑块发布((信号的正确方法是什么?
^
查看链接帖子中的示例,我建议您删除括号。 即不是:
connect(m_customUIForm.horizontalSliderOr, &QAbstractSlider::sliderReleased(), this, [this]{ sendMoveActuator(1); });
而是:
connect(m_customUIForm.horizontalSliderOr, &QAbstractSlider::sliderReleased, this, [this]{ sendMoveActuator(1); });