QtSlider exmaple in javascript ?
-
-
@Largol said in QtSlider exmaple in javascript ?:
I have trouble with the connect function....
in order to receive help you should also tell what your problem is
-
Ok, let's go for it.
I have this code
function StepperMotorON()
{
// Motor on with a user defined value for current
var current = "0";
var result = "";
UI_StepperMotorCurrentSlider.setRange(0,232);
value = parseInt(int, 16);
QObject.connect(StepperMotorCurrentSlider, SIGNAL(valueChanged(int),lineEditCurrentMotor, SLOT(setText(parseInt(int, 16)));
// QObject.connect(StepperMotorCurrentSlider, SIGNAL(valueChanged(parseInt(int,var),lineEditCurrentMotor, SLOT(setText(var));
current = UI_StepperMotorCurrentSlider.valueChanged(current);
current = (current*1.074);
current = current.toFixed(0);
/*if(current > 150)
{
return -1;
} */
current = current.toString(16);
//to debug
UI_lineEditIofStepperMotor.setText(current);
// confidential code to drive the motor.
// if (result == "")
// {
return -1;
}
return 1;
} -
@Largol said in QtSlider exmaple in javascript ?:
QObject.connect(StepperMotorCurrentSlider, SIGNAL(valueChanged(int),lineEditCurrentMotor, SLOT(setText(parseInt(int, 16)));
this syntax doesn't work in QML.
In QML you use the Connections type -
@Largol
when you do not have the requirement for pure JS, then i would suggest that you use the benefits of QML.
Since you anway let your script run in a QML engine right?