Cstatic QString qwsFontPath(){ QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QWS_FONTDIR")); if (fontpath.isEmpty()) {#ifdef QT_FONTS_ARE_RESOURCES fontpath = QLatin1String(":/qt/fonts");#else#ifndef QT_NO_SETTINGS fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath); fontpath += QLatin1String("/fonts");#else fontpath = QLatin1String("/lib/fonts");#endif#endif //QT_FONTS_ARE_RESOURCES } return fontpath;}
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("UTF-8"));QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
button->setText("С новым годом!");
button->setText(QString::fromUtf8("С новым годом!"));
QString string = QTextCodec::codecForName("Windows-1251")->toUnicode(stringFromNetwork);