[quote author="NameZero912" date="1336228968"]Thanks for the fast response. Well, in my case I'm connecting the slider's valueChanged(int) signal to the label's setNum() slot in the QtDesigner (consequently, the generated cpp files have this connect(...) statement), but then in my own code I also connect the slider's valueChanged(int) signal to my own slot (in which I take the new value and do something else with it). I was looking for a way to have both slots (my own, and labe's setNum()) to be triggered on start-up of the application.[/quote]
This can be done, for example, by adding a suitable signal to your own class. Then you can connect the signal of your own class to the QLabel's signals. Qt can connect signals to signals! Then emitting your own signal will trigger the signal that it is connected to (e.g. the signal of the QLabel). The QLabel's signal in turn will trigger all slots connected to it - as you desire. Look at the code of my previous posting for an example...
Of course you may simply call all slot's you want to trigger directly ;-)
[quote author="NameZero912" date="1336228968"]From reading your code samples, it occurred to me that it's probably not a good approach to set the default value in the QtDesigner, trying to "push" this default value into the slots connected to slider's valueChanged(int). Instead I should simply have something that is not the default value in QtDesigner, and set the default value in code instead, i.e. @someSlider->setValue(initialValue);@[/quote]
After all it may be desirable to "remember" the last value in an INI file and load it from there at the next application startup. If you do this, you will have to overwrite the value somewhere in your own initialization code anyway. Nonetheless you can keep the "initial" value from QDesigner with code like this:
someSlider->value() will initially contain the value you have set in QDesigner, given that setupUi() has been called.
My OpenSource software at: http://muldersoft.com/
Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS
Go visit the coop: http://youtu.be/Jay...