2 Attachment(s)
Qt Calling function in main fun: Qt slider
Hello All,
I am new to qt and cpp also. I am using qslider for my project. Here is the code:
Attachment 11413Attachment 11414
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.
Re: Qt Calling function in main fun: Qt slider
Quote:
How can I call int pos in main function.
Your question is not clear to me some how.
if you want slider position, useand 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 ;
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
Code:
void MainWindow::onValueChanged(int value)
{
int pos = slider->sliderPosition();
value=pos; //what are doing here, why are you overwriting value
//.................
}