Hi all,
I'm running tutorial number 6: http://doc.trolltech.com/4.4/tutorials-tutorial-t6.html
Inside the LCDRange constructor there is the following:
slider->setValue(0);
connect(slider,SIGNAL(valueChanged(int)),lcd,SLOT(display(int)));
slider->setValue(0);
connect(slider,SIGNAL(valueChanged(int)),lcd,SLOT(display(int)));
To copy to clipboard, switch view to plain text mode
however, I think it doesn't work as expected...at least, on startup: lcd displays the correct number when the slider moves, but it doesn't happen when slider->setValue(0), or generally, slider->setValue(some int) is executed.
For example
slider->setValue(45);
connect(slider,SIGNAL(valueChanged(int)),lcd,SLOT(display(int)));
slider->setValue(45);
connect(slider,SIGNAL(valueChanged(int)),lcd,SLOT(display(int)));
To copy to clipboard, switch view to plain text mode
moves the slider to right position, but lcd displays 0.
Instead, moving connect statement before slider->setValue()
connect(slider,SIGNAL(valueChanged(int)),lcd,SLOT(display(int)));
slider->setValue(0);
connect(slider,SIGNAL(valueChanged(int)),lcd,SLOT(display(int)));
slider->setValue(0);
To copy to clipboard, switch view to plain text mode
does the trick, so lcd displays 45 correctly.
Can I have some explanation of this ?
Bookmarks