QTextCodec *codec = QTextCodec::codecForName( "Windows-1251" );QLineEdit* ModemName = new QLineEdit;QSettings* ModemSet = new QSettings("config.txt", QSettings::IniFormat);ModemName->setText(codec->toUnicode(ModemSet->value("ModemName", "").toByteArray())); //нормально считывает/.../ModemSet->setValue("ModemName", ModemName->text().toLocal8Bit().data()); //вот тут загвоздка
C++ (Qt)QTextCodec::setCodecForLocale(QTextCodec::codecForName("cp-1251"));
ModemSet->setValue("ModemName", codec->fromUnicode( ModemName->text() );
C++ (Qt)QTextCodec::setCodecForCStrings(QTextCodec::codecForName("cp-1251"));QSettings settings("test.ini", QSettings::IniFormat); settings.setValue("str1", "абвгд....");settings.setValue("str2", "эюя...");
QTextCodec *codec = QTextCodec::codecForName( "Windows-1251" );QSettings *ModemSet = new QSettings("config.txt", QSettings::IniFormat);QString modemName = editModemName->text();ModemSet->setValue( "ModemName", codec->fromUnicode( modemName ) );
QTextCodec *codec = QTextCodec::codecForName( "Windows-1251" );QSettings *ModemSet = new QSettings("config.txt", QSettings::IniFormat);QString modemName = codec->toUnicode( ModemSet->value( "ModemName", "" ).toByteArray() );editModemName->setText( modemName );
QSettings *ModemSet = new QSettings("config.txt", QSettings::IniFormat);ModemSet->setValue( "ModemName", "СуперМодем" ); // Эта строка и так в CP-1251.
str1=\x430\x431\x432\x433\x434....str2=\x44d\x44e\x44f...
QTextCodec *codec = QTextCodec::codecForName( "Windows-1251" );QSettings *ModemSet = new QSettings("config.txt", QSettings::IniFormat);QString modemName = codec->toUnicode( ModemSet->value( "ModemName", "" ) );editModemName->setText( modemName );
QTextCodec::setCodecForCStrings(QTextCodec::codecForName("cp-1251"));