T
T
theSever2018-03-10 19:40:30
Qt
theSever, 2018-03-10 19:40:30

Qt SQLite C++ encoding problem, Russian letters?

I open the database and display the result in listWidget or textEdit.

// Очистить список строк
    ui->listWidget->clear();

    //Осуществляем запрос
    QSqlQuery query;
    query.exec("select name from sqlite_master where type='table'");

    //Вывод
    while (query.next())
    {
    QString table = query.value(0).toString();
    ui->listWidget->addItem(table);

//Осуществляем запрос
   QSqlQuery query;
   query.exec("select id,name,comment from `Default`");

   //Выводим значения из запроса
   while (query.next())
   {
   QString id = query.value(0).toString();
   QString name = query.value(1).toString();
   QString comment = query.value(2).toString();
   ui->textEdit->insertPlainText(id+" "+name+" "+comment+"\n");

All Russian letters are displayed as nonsense.
4 none ������ ���� �� �����

How to solve this problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question