I am using the Qt plugin for Eclipse and I am following one of the tutorials for Qt 4.3.
I have this:
Code:
void cannonfield::setAngle(int angle) { if (angle < 5) angle = 5; if (angle > 70) angle = 70; if (currentAngle == angle) return; currentAngle = angle; update(); emit angleChanged(currentAngle); } { }
setAngle is called by:
Code:
void lcdrange::on_horizontalSlider_valueChanged(int value) { ui.lcdNumber->display(value); this->setValue(value); ui.cannon->setAngle(value); }
The program will run. However, when it is run, nothing is displayed I am trying to get the angle value to be displayed in the "cannonfield" widget. The cannonfield widget is there, but the angle is not displayed. I put:
into the paintEvent method and nothing is displayed in the console when I move the slider around. However, after I close the window, losts of "test"s are displayed.Code:
printf("test");
Also, how does the keyword "emit" work?
Thanks.