1

I'm trying to take start using Qt and decided to poke around this text editor first.

Everything goes fine except some strange behaviour of QFileDialog - I can not manage it to deal with national charset.

Here is what I see when running compiled binary and trying to open file:

Problem dialog

I've tried to search the docs and qt wiki in order to get some clues, but there is nothing about i18n that could be readable for newbie like me.

So here is the problem code:

void TextEdit::fileOpen()
{
    QString fn = QFileDialog::getOpenFileName(this, tr("Open File..."),
                                              QString(), tr("HTML-Files (*.htm *.html);;All Files (*)"));
    if (!fn.isEmpty())
        load(fn);
}

I guess I should attach ::fromUtf8() here somehow, but have no understanding of how this should be done.

UPD

Tried to change default locale just as advised:

QLocale curLocale(QLocale("ru_RU"));
QLocale::setDefault(curLocale);

Also tried this variant:

QLocale::setDefault(QLocale(QLocale::Russian, QLocale::RussianFederation));

This did not help, problem persists.

Community
  • 1
  • 1
im_infamous
  • 327
  • 1
  • 3
  • 17

0 Answers0