[Qt-interest] Setting a label's value from a slider automatically on launch
Pritam Ghanghas
pritam_ghanghas at infosys.com
Thu Aug 25 17:09:39 CEST 2011
On Wed, 2011-08-24 at 21:56 +0530, David Doria wrote:
> I have a slider and a label on my QMainWindow. In QtDesigner, I've
> created a signal/slot pair so that the slider's value is displayed in
> the label. When I run the program and slide the slider, the label is
> updated appropriately. However, the label does not take the correct
> value until the slider is moved for the first time. Is there a way to
> automatically make the label take the slider's value as soon as the
> program is started (before the slider is moved)?
You will have to give the label proper initial value. You have many
choices
You can specify the default values for both to be same from designer's
property editor.
Or
After setupUI() either call slider.setValue (that will result in
valuechanged signal if you set some value different from default)
or better query it using slider.value and set on label.
>
> Thanks,
>
> David
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest
**************** CAUTION - Disclaimer *****************
This e-mail contains PRIVILEGED AND CONFIDENTIAL INFORMATION intended solely
for the use of the addressee(s). If you are not the intended recipient, please
notify the sender by e-mail and delete the original message. Further, you are not
to copy, disclose, or distribute this e-mail or its contents to any other person and
any such actions are unlawful. This e-mail may contain viruses. Infosys has taken
every reasonable precaution to minimize this risk, but is not liable for any damage
you may sustain as a result of any virus in this e-mail. You should carry out your
own virus checks before opening the e-mail or attachment. Infosys reserves the
right to monitor and review the content of all messages sent to or from this e-mail
address. Messages sent to or from this e-mail address may be stored on the
Infosys e-mail system.
***INFOSYS******** End of Disclaimer ********INFOSYS***
More information about the Qt-interest-old
mailing list