[Qt-interest] how to convert QMap<QString, QString>::const_iterator to QString?

Ross Driedger ross at earz.ca
Mon Apr 5 16:14:17 CEST 2010


On 5-Apr-10, at 6:49 AM, qt-interest-request at trolltech.com wrote:

> Message: 4
> Date: Mon, 5 Apr 2010 15:16:34 +0300
> From: Meir Yanovich <meiry242 at gmail.com>
> Subject: [Qt-interest] how to convert QMap<QString,
> 	QString>::const_iterator to QString?
> To: qt-interest at trolltech.com
> Message-ID:
> 	<j2gc30def491004050516w526f11f7zf033a5fae6a8ccd0 at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Hello all
> i need to convert ( for log printing )  
> QMap<QString,QString>::const_iterator
> to QString ( i think )
> i have this but this dosn't work....

What is not working about it?

> QMap<QString,QString> args
> QMap<QString,QString>::const_iterator i = args.constBegin();
>    while (i != args.constEnd()) {
>       //cout << i.key() << ": " << i.value() << endl;
>        QString temp(i.key().toStdString()  +  ": "  +
> i.value().toStdString());  // this dosn't work !!!

Why would you convert a QString to std::string object and then back to  
QString?

QString is perfectly capable of doing the job itself, so there is no  
reason to switch from one to the other and back.

>        UT::getInstance()->LogToFile(temp);
>        ++i;
>    }

Ross Driedger
ross (at) earz (dot) ca




-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100405/8aba0e42/attachment.html 


More information about the Qt-interest-old mailing list