I was using the QLibraryInfo::location(QLibraryInfo::TranslationsPath) to check the available languages and try to load the right one, I could also let the user choose the language and replace the current QTranslator. These seem like the legit way to do It for a reusable QObject between project. But then, setting the QLibraryInfo::TranslationsPath have proof to be a huge pain in the ... and therefore I edit it, when compiling on mobile I use the QLibraryInfo::TranslationsPath, and when compiling desktop I hard code the path relative to the executable QString folder = QCoreApplication::applicationDirPath() + "/translations";
I made a different .pri for desktop that create the folder and copy the .qm to the build directory, I will also have to check if the linuxqtdeploy will play nice with that. On mobile I simply add the .qm files to the .qrc and everything is going nice, since I can make a qt.conf and the plugins and Qt found his own stuff. Qml2Imports was not really important here, but just showing the problems of settings just a few path and not the others and having a build that cannot run into QtCreator anymore. -----Original Message----- From: Interest <interest-boun...@qt-project.org> On Behalf Of Nikos Chantziaras Sent: January 16, 2019 12:10 PM To: interest@qt-project.org Subject: Re: [Interest] Qt.conf and desktop application Can't you load translation files programmatically with QTranslator? Can't help with QML though. I don't know what you're doing there and why you need to set Qml2Imports. On 16/01/2019 18:40, Jérôme Godbout wrote: > So how do you specify the Translation and QmlImport path when running > locally? I wish I could only add a few lines at the beginning of my C++ but > it doesn't seem possible to modify the translation file into a .qrc file. Ok, > I guess the qt.conf is only for release overwrite when deploying, but I still > have no solution to make this work properly into debug and QtCreator then. > > All this seem over complicated for setting a few paths. I don't want to fall > into the mess I used to do with a script that set the env and launch the > application, this was painful to maintain and no fun at all. > > -----Original Message----- > From: Interest <interest-boun...@qt-project.org> On Behalf Of Nikos > Chantziaras > Sent: January 16, 2019 11:09 AM > To: interest@qt-project.org > Subject: Re: [Interest] Qt.conf and desktop application > > On 16/01/2019 01:12, Jérôme Godbout wrote: >> I’m having some problem while porting an application to Linux Desktop. >> I’m using a qt.conf to set 2 values >> >> [Paths] >> Translations=:/i18n >> Qml2Imports=:/ >> >> I don’t do anything else, but I cannot launch my application when I >> add the Qt.conf (even with only Translations). The platform library >> cannot be found anymore. > You never use a qt.conf when running locally during development. You only use > one for the deployed application package where you bundle the Qt libs. > > Your error here is simply due to a missing "Plugins=<path>" entry in the > qt.conf. But again, you only do that in the deployed application. > > _______________________________________________ > Interest mailing list > Interest@qt-project.org > https://lists.qt-project.org/listinfo/interest > _______________________________________________ > Interest mailing list > Interest@qt-project.org > https://lists.qt-project.org/listinfo/interest > _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest