Hi,
Thank you for your detailed response. It was wonderful learning curve for me. As i posted in my previous reply. The difference we had was
storing the Rgb value in int. Which i understood has no sense. I just altered it, and tried to store the Rgb value using name() directly into a .txt file which i get something like
[RESULT]
#676767
#595959
#646464
#5e5e5e
#737373
#7f7f7f
#9d9d9d
#b2b2b2
#a6a6a6
#afafaf
#939393
#989898
#7d7d7d
#848484[/RESULT]
Which i think suggest the values of "RRGGBB". But my actual aim was completely different. I wanted to grab the QTransform from a QGraphicsPixmapItem and write the transformation matrix as .txt file. I tried it but i am stuck here
QTransform mat=itm2->transform();
mat
=QPixmap::trueMatrix(mat,scn3
->width
(),scn3
->height
());
QFile file("/Users/venkateshpadmanabhan/Desktop/out2.txt");
data<<QTransform(mat);
QTransform mat=itm2->transform();
mat=QPixmap::trueMatrix(mat,scn3->width(),scn3->height());
QFile file("/Users/venkateshpadmanabhan/Desktop/out2.txt");
file.open(QIODevice::WriteOnly);
QDataStream data(&file);
data<<QTransform(mat);
To copy to clipboard, switch view to plain text mode
I wanted to store the data as a .txt file, as you know we can't store the QTransform directly using
QTextStream s(&file);
s<<mat;
I am trying to find a method to store the transform matrix into .txt file. It would be great help if you could show lights on this issue..
Added after 18 minutes:
Hi,
I tried the following code, to convert the transform into QVariant and again convert it into qreal to save it into .txt file. But it doesn't work what going wrong with this ...
QTransform mat=itm2->transform();
mat
=QPixmap::trueMatrix(mat,scn3
->width
(),scn3
->height
());
qreal re=qv.toReal();
QFile file("/Users/venkateshpadmanabhan/Desktop/out2.txt");
data<<re;
endl(data);
QTransform mat=itm2->transform();
mat=QPixmap::trueMatrix(mat,scn3->width(),scn3->height());
QVariant qv(mat);
qreal re=qv.toReal();
QFile file("/Users/venkateshpadmanabhan/Desktop/out2.txt");
file.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream data(&file);
data<<re;
endl(data);
To copy to clipboard, switch view to plain text mode
Bookmarks