[SOLVED]QFile and QTextStream Question
-
because i am now writing this in a function
:
@void Dialog::getValue()
{
int h_slide1 = ui->hueSlide1->value();
QFile valueHSV("/home/pi/valueHSV/hsv.txt");
if(!valueHSV.open(QIODevice::WriteOnly| QIODevice::Text)){
qDebug() << "File not able to open" << endl;
return;
}
QTextStream hsv(&valueHSV);
hsv << h_slide1;
qDebug() << "Value ="<<h_slide1
valueHSV.close();
}@ -
hi
you can take a reference from the following link
http://www.codeprogress.com/cpp/libraries/qt/qProgressbarSetValueExample.php#.U7J--ZSSwb8[Edited: Remember it is an old example using 4.7]
-
[quote author="YDYD" date="1404207347"]ermm.. this link not working..[/quote]
link is perfectly working.[quote author="YDYD" date="1404207723"]The example i can understand, but whn the slider move, can i save the current value to a txt file?[/quote]
yes that is why this signal is given.
[quote author="YDYD" date="1404207829"]Hi Lam,
I dont think your suggestion could work, i could not call ui into the function.[/quote]
the example does not use Qt designer Widget it is taking on run time.
I think the problem is you have to understand the basics first like
@
creating .h and .cpp file inheriting QWidget/QMainWindow or Qdialog.
SIGNAL and SLOT
and many more thing.
@