On Mon, Sep 8, 2008 at 6:57 PM, Emanuel Rumpf <[EMAIL PROTECTED]> wrote:
> what about using:
>
> std::string xxx = std::string( qstr.toAscii().data() );
>
> instead?

No, absolutely not.  We never want to constrain the conversion to
ASCII (or Latin-1 for that matter).

Use qstrtostr and strtoqstr for strings that are being stored for
later display in the GUI, and that we may want to convert back and
forth more than once.  (Reason: preserves UTF8 encoding in both
directions.)

Use toStdString() when the target is a std::string for immediate
display at the console (not in the GUI) or for use in an error message
or as a file or directory path.  (Reason: creates std::string
directly; uses local encoding; shorter than toLocal8Bit().data())

Use toLocal8Bit().data() when the target is a file or directory path
in a system call or similar.  (Reason: uses local encoding; creates
C-style string as desired)

I think.  Any advance on that from anyone else?


Chris

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Rosegarden-devel mailing list
[email protected] - use the link below to unsubscribe
https://lists.sourceforge.net/lists/listinfo/rosegarden-devel

Reply via email to