[SOLVED] [Qt5] crash when using qApp and installTranslator But working when using qApp and setFont
-
I would like to install my fonts and i have done the following:
fontDatabase->addApplicationFont(":/fonts/HelveticaNeue.ttf");
fontDatabase->addApplicationFont(":/fonts/HelveticaNeue-Bold.ttf");
qApp->setFont(QFont("Helvetica Neue"));and this seems to work but when i do the same for translations it fails
if (anitaTranslator->load("anita_nl", ":/translations/"))
qApp->installTranslator(anitaTranslator);even though both use the same setup + because it tries to install the translator i know it has found the file and still crashes.
another thing i find strange is that when doing this QGuiApplication *app = QGuiApplication::instance(); the compiler complains that it is getting a QCoreApplication instead of a QGuiApplication
am i doing something wrong?
-
Ok i solved the issue, i was trying to access qApp with a GUI function outside the GUI thread or event loop ... once i made sure i did only run it on the GUI thread then everything is working.