Hi Guys,
I'm working with Qt since 2 weeks now and it's really interesting to me. My first task is to read out a image(raw-file) and to display it. So it take a while, but now I made some progress. I included the raw-file as a resource to my programm, made a QImage with an 8bit grayscale colourmap and read the file data to a string. Oh I forgot, the raw-file is very simple and contains only pixeldata, the size is about 131072 signs and this value fits to the resolution of 512x256 pixels. The pixels are stored as ascii-signs within the file, I was able to read the pixel value(0-255) with an hex-editor and guess it is ascii.
So the next step is to read out the file-data to a QString(or similar) and convert it to int or const char(value 0-255). Therefore I wrote this code:
QFile file(":/new/1.raw");
if(file.open(QIODevice::ReadOnly|QIODevice::Text)) {qDebug("File opened");}
else{qDebug("File not opened");}
QTextstream out(&file);
QString str= out.readAll();
Now I'm really not sure about the datatype of str and how to get my pixel value's or even create an output for the ascii data on a label. Hope someone can give me a hint on this?
Best reagards,
Olli
Bookmarks