Non-ASCII path support(partial)

I didn't find other solutions on the Internet.
I found the plugins are loaded when creating MainWindow,
so this solution should be fine?
This commit is contained in:
wh201906
2021-12-15 21:43:10 +08:00
parent dcc17963b6
commit 36307dcda0
5 changed files with 54 additions and 9 deletions
+11
View File
@@ -9,6 +9,17 @@
int main(int argc, char *argv[])
{
// A trick to handle non-ascii path
// The application cannot find the plugins when the path contains non ascii characters.
// However, the plugins will be load after creating MainWindow(or QApplication?).
// QDir will handle the path correctly.
QDir* pluginDir = new QDir;
if(pluginDir->cd("plugins")) // has plugins folder
{
qputenv("QT_PLUGIN_PATH", pluginDir->absolutePath().toLocal8Bit());
}
delete pluginDir;
QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QTextCodec::setCodecForLocale(QTextCodec::codecForName("UTF-8"));
QDir *langPath = new QDir();