View Full Version : Qt Calling function in main fun: Qt slider
graviteja
7th October 2015, 06:47
Hello All,
I am new to qt and cpp also. I am using qslider for my project. Here is the code:
1141311414
How can I call int pos in main function. to my knowledge int x= functionname(& variable), but I cannot call.
Thans a lot in advance.
prasad_N
7th October 2015, 09:04
How can I call int pos in main function.
Your question is not clear to me some how.
if you want slider position, use
QSlider::value()
and you have a current change value with the help of onValueChanged(int value) // value is the current slider value
If you want current slider value in some other place, have a public function in mainwindow which return
slider->value() ;
And call this where ever you want main/some other class where you have this mainwindow handle.
i don't know what your doing with this code
void MainWindow::onValueChanged(int value)
{
int pos = slider->sliderPosition();
value=pos; //what are doing here, why are you overwriting value
//.................
}
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.