O
O
Oleg Seledets2018-06-30 23:55:38
Qt
Oleg Seledets, 2018-06-30 23:55:38

How to put value from qcombobox into Russian?

Hello, there is a ComboBox
in it 3 values, all in Russian.
by pressing the button It is necessary to write to the settings file what is now in the comboBox.

QSettings *dbsett = new QSettings("default.ini",QSettings::IniFormat);
    //тут получение значения из бокса
    QString nu = ui->comboBox->currentText().toUtf8();

    dbsett->setValue("user/nameuser", nu);
    dbsett->sync();

if "Administrator" is selected, then "\x410\x434\x43c\x438\x43d\x438\x441\x442\x440\x430\x442\x43e\x440" will be written to the
file
QTextCodec *codec = QTextCodec::codecForName("Utf8");
    QTextCodec::setCodecForLocale(codec);

and like this:
QString::fromLocal8Bit
How can this be solved?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
Oleg Seledets, 2018-07-01
@oleja1ee7

QSettings *dbsett = new QSettings("default.ini",QSettings::IniFormat);
dbsett->setIniCodec("UTF-8");
// get value from box here
QString nu = ui->comboBox->currentText();
dbsett->setValue("user/nameuser", nu);
dbsset->sync();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question