1 Attachment(s)
[HELP] how to get a value of slider from ui_XXXX.h
Hi all,
newly register, new to Qt here.
Here is a new question:
I am recently designing a GUI using dialog.ui
i used a lot of slider, i need to read the slider value,
anyone tell me how can i get it from ui_dialog.h ?
is it possible?
here is a photo of GUI:
Attachment 10484
After this question, i would like to save these values that i get from slider in to a text file that using XML format.
How can i achieve this?
Please advise,
Best regards,
YDYD
Re: [HELP] how to get a value of slider from ui_XXXX.h
If you have chosen a designer form class template in QtCreator then you should have a dialog.h and a dialog.cpp generated with the .ui file.
The dialog.cpp will have an include for the generated header and have created an instance of the class and stored that in the "ui" pointer.
The code to access any widget present in the designer form is then
Code:
ui->nameOfTheWidget
e.g. for a slider named "slider1", getting the value would be
Code:
int value = ui->slider1->value();
Cheers,
_
Re: [HELP] how to get a value of slider from ui_XXXX.h
Hi anda_skoa,
appreciate this!
this help me a lot!
Added after 8 minutes:
Hi,
can i printf in LXterminal for checking value of ?
and one more question:
Could i save the value i get into a .TXT file?
Re: [HELP] how to get a value of slider from ui_XXXX.h
Quote:
Originally Posted by
YDYD
can i printf in LXterminal for checking value of
?
Quote:
Originally Posted by
YDYD
and one more question:
Could i save the value i get into a .TXT file?
See QFile and QTextStream.
Cheers,
_
Re: [HELP] how to get a value of slider from ui_XXXX.h
Hi,
i did try this the whole day, i just could sote the value in a txt file... i did as following :
Code:
int h_slide1 = ui->hueSlide1->value();
QFile valueHSV
("/home/pi/valueHSV/hsv.txt") return;
hsv << h_slide1;