Brendan Jones wrote:
> What is the best way to handle this case:
> 
> qWarning(QObject::tr("Client name '%1' occupied.").arg(name).toUtf8());
> 
> something like, or can I make it simpler:
> 
> qWarning("%s",qPrintable(QObject::tr("Client name '%1'
> occupied.").arg(name).toUtf8()));

Use one of:
qWarning() << QObject::tr("Client name '%1' occupied.").arg(name);
or:
qWarning("%s", QObject::tr("Client name '%1' 
occupied.").arg(name).toLocal8Bit().data());

Note that hardcoding toUtf8() is also a bad idea here, the right encoding to 
use is toLocal8Bit(), or this will print junk in non-UTF-8 locales. (In our 
default UTF-8 locales, it will make no difference.)

        Kevin Kofler

-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Reply via email to