How to create QFontDatabase without QGuiAppliaction ?
-
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? -
You need QGuiApplication when you use QtGui classes - there is no way around this.
-
@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
-
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) -
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...
-
@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. -
@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. -
@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.