I have a horizontal slider, and I want a line edit updated when the slider value is changed.
I wrote this, but nothing happens:
connect(ui->horizontalSlider1, SIGNAL(&QSlider::valueChanged), ui->lineEdit2, SLOT(&QLineEdit::setText));
I can see that the valueChanged has a parameter of type int, but the setText takes a parameter of a different type.
I don't get an error during build, and nothing happens when I run the application.
What is the correct way of doing this?
First update the
MainWindowclass inside the mainwindow.h:Then use this as the contents of the mainwindow.cpp: