Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to create QFontDatabase without QGuiAppliaction ?
QtWS25 Last Chance

How to create QFontDatabase without QGuiAppliaction ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 5 Posters 992 Views
  • 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.
  • J Offline
    J Offline
    jiri.kochanek
    wrote on last edited by
    #1

    I need to create a library in Qt C ++ that will create image bitmaps. These images will be passed to render to the Android native application.
    I have it solved - everything works, but if I want to insert text into the picture, it is a problem. The application crashes due to an uninitialized font database.
    If the QFontDatabase constructor itself is called, it will fall too.
    The problem is that the font database is initialized somewhere in the QGuiApplication constructor. But I can't use it, because it will cause a different application crash on Android.
    Anybody know what to do with it?

    A 1 Reply Last reply
    1
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      You need QGuiApplication when you use QtGui classes - there is no way around this.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • J jiri.kochanek

        I need to create a library in Qt C ++ that will create image bitmaps. These images will be passed to render to the Android native application.
        I have it solved - everything works, but if I want to insert text into the picture, it is a problem. The application crashes due to an uninitialized font database.
        If the QFontDatabase constructor itself is called, it will fall too.
        The problem is that the font database is initialized somewhere in the QGuiApplication constructor. But I can't use it, because it will cause a different application crash on Android.
        Anybody know what to do with it?

        A Offline
        A Offline
        arsinte_andrei
        wrote on last edited by
        #3

        @jiri.kochanek said in How to create QFontDatabase without QGuiAppliaction ?:

        But I can't use it, because it will cause a different application crash on Android.

        can you try to solve this problem?? to see why is crashing? can you give us a bit of code to inspect it?? can you reproduce the crash? use the debugger and see what cause it... I think that is better to follow the proper way and to include the QGuiApplication

        J 1 Reply Last reply
        0
        • A arsinte_andrei

          @jiri.kochanek said in How to create QFontDatabase without QGuiAppliaction ?:

          But I can't use it, because it will cause a different application crash on Android.

          can you try to solve this problem?? to see why is crashing? can you give us a bit of code to inspect it?? can you reproduce the crash? use the debugger and see what cause it... I think that is better to follow the proper way and to include the QGuiApplication

          J Offline
          J Offline
          jiri.kochanek
          wrote on last edited by
          #4

          @arsinte_andrei

          Thank you for answer.

          The problem is that the QGuiApplication constructor invokes:

          2019-06-10 17:19:12.387 12129-12129/cz.cdis.nativetest W/XXX: qt.qpa.plugin: Could not find the Qt platform plugin "android" in ""
          2019-06-10 17:19:12.388 12129-12129/cz.cdis.nativetest A/XXX: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
          2019-06-10 17:19:12.388 12129-12129/cz.cdis.nativetest A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 12129 (cdis.nativetest), pid 12129 (cdis.nativetest)

          Pablo J. RoginaP jsulmJ 2 Replies Last reply
          0
          • J jiri.kochanek

            @arsinte_andrei

            Thank you for answer.

            The problem is that the QGuiApplication constructor invokes:

            2019-06-10 17:19:12.387 12129-12129/cz.cdis.nativetest W/XXX: qt.qpa.plugin: Could not find the Qt platform plugin "android" in ""
            2019-06-10 17:19:12.388 12129-12129/cz.cdis.nativetest A/XXX: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
            2019-06-10 17:19:12.388 12129-12129/cz.cdis.nativetest A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 12129 (cdis.nativetest), pid 12129 (cdis.nativetest)

            Pablo J. RoginaP Offline
            Pablo J. RoginaP Offline
            Pablo J. Rogina
            wrote on last edited by
            #5

            @jiri.kochanek

            I need to create a library in Qt C ++ that will create image bitmaps. These images will be passed to render to the Android native application.

            Could you please describe the goal of your project?

            At first sight, why a library dealing only with image bitmaps needs to know about the fonts database?

            Depending on your answer, the library could be built with Android NDK, without relying on Qt at all...

            Upvote the answer(s) that helped you solve the issue
            Use "Topic Tools" button to mark your post as Solved
            Add screenshots via postimage.org
            Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

            J 1 Reply Last reply
            0
            • Pablo J. RoginaP Pablo J. Rogina

              @jiri.kochanek

              I need to create a library in Qt C ++ that will create image bitmaps. These images will be passed to render to the Android native application.

              Could you please describe the goal of your project?

              At first sight, why a library dealing only with image bitmaps needs to know about the fonts database?

              Depending on your answer, the library could be built with Android NDK, without relying on Qt at all...

              J Offline
              J Offline
              jiri.kochanek
              wrote on last edited by
              #6

              @Pablo-J.-Rogina
              The purpose is to use an existing library in a native Android application.
              The library handles large XML files and transforms them into large set of images. But there are also texts in the images.
              Then I want to render the bitmaps of images directly into the Android application bitmap. This is already mastered.
              The only reason it doesn't work is that the library can't work without calling the QGuiApplication constructor because there is a font database created somewhere.
              When the QGuiApplication is called, the program crashes.

              1 Reply Last reply
              0
              • J jiri.kochanek

                @arsinte_andrei

                Thank you for answer.

                The problem is that the QGuiApplication constructor invokes:

                2019-06-10 17:19:12.387 12129-12129/cz.cdis.nativetest W/XXX: qt.qpa.plugin: Could not find the Qt platform plugin "android" in ""
                2019-06-10 17:19:12.388 12129-12129/cz.cdis.nativetest A/XXX: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
                2019-06-10 17:19:12.388 12129-12129/cz.cdis.nativetest A/libc: Fatal signal 6 (SIGABRT), code -6 in tid 12129 (cdis.nativetest), pid 12129 (cdis.nativetest)

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @jiri.kochanek said in How to create QFontDatabase without QGuiAppliaction ?:

                Could not find the Qt platform plugin "android" in ""

                Does this happen on Android?
                If so, then something went wrong while deploying your app.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                J 1 Reply Last reply
                1
                • jsulmJ jsulm

                  @jiri.kochanek said in How to create QFontDatabase without QGuiAppliaction ?:

                  Could not find the Qt platform plugin "android" in ""

                  Does this happen on Android?
                  If so, then something went wrong while deploying your app.

                  J Offline
                  J Offline
                  jiri.kochanek
                  wrote on last edited by
                  #8

                  @jsulm
                  Yes - this problem arises only when the QGuiApplication constructor is executed in the native Android application.There is the problem that there is no known path to the android plugin.If I look at APK of C++ application that is translated in pure Qt environment, it should be libplugins_platforms_android_libqtforandroid.so. I placed this library among other libraries loaded from native C ++ code. Nor will it help.

                  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