[Qt-interest] How to change std::vector<char> to QString?
donglongchao
donglongchao at 163.com
Mon Dec 14 09:05:08 CET 2009
Then I should use QString(QVector<char>::fromStdVector(std::vector<char> std_vec).data()),is it right?Is this the only way, an indirect way?Is there any function like data() in std::vector ?
在2009-12-14,"Eirik Ulvik" <eiriku at simsurgery.com> 写道:
>From docs:
http://doc.trolltech.com/4.6/qvector.html#fromStdVector
QVector<char>::fromStdVector(std_vec);
Eirik
donglongchao skrev:
Hi,
Help!I am using a shared library in which there is a function who return a std::vector<char>.I want to assign it to a QString object to show it on my GUI.But I do not know how to do it.Is there any constructor/member function in QString to do this?Or is there any constructor/member function in std::vector<char> to change itself into a char* or sth like that so that I can use it as a parameter in QString's constructor/member function to do this?I search the document but find nothing.If there is no,do I have to pull each element of the std::vector<char> out and then push them into my QString to do this?While I do not like this method very much.:-(.So,please point me the right direction and a better approach.Thanks a lot in advance.
Longchao
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.comhttp://lists.trolltech.com/mailman/listinfo/qt-interest
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091214/3a8e7cf4/attachment.html
More information about the Qt-interest-old
mailing list