Update the text of a label during the button click handler
-
How do you update the text of a label on the main window during the handling of a button click event. For example if I wanted to the elapsed time that the code in the button handler took to execute on a label on the main window, how would that be done?
In my Microsoft Visual C# background I would update the text property of the label ie. this.txtMyLabel.Text="Some New Time";
-
And this is how you do it in Qt as well, you set the text property of the label.
@
label->setText("Some New Time");
@
If you want to measure the time elapsed use "QElapsedTimer":http://qt-project.org/doc/qt-4.8/qelapsedtimer.html.See also "Getting Started With Qt":http://qt-project.org/doc/qt-4.8/gettingstartedqt.html.