Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [SOLVED] [Qt5] crash when using qApp and installTranslator But working when using qApp and setFont
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] [Qt5] crash when using qApp and installTranslator But working when using qApp and setFont

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 1.8k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    t.verstraete
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0
    • T Offline
      T Offline
      t.verstraete
      wrote on last edited by
      #2

      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.

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved