[Solved] [Qt5] How register my own QIODevice (replacement of QAbstractFileEngineHandler)
-
You should note have such includes. Either use
@#include <QtCore/QObject>@
or just
@#include <QObject>@
But no version number
-
Thank you a lot, it's much better now.
May have you an idea on what can cause the qml engine not finding components?
Here is my logs :
@
D/Qt ( 5463): ....\Source\GUI_QML\ResourcesDevice.cpp:279 (virtual void qml::ResourcesEngine::setFileName(const QString&)): ResourcesEngine::setFileName : "main.1.fr.anuman.HomeDesign3D.obb/qml/Main.qml"
D/Qt ( 5463): ....\Source\GUI_QML\ResourcesDevice.cpp:279 (virtual void qml::ResourcesEngine::setFileName(const QString&)): ResourcesEngine::setFileName : "main.1.fr.anuman.HomeDesign3D.obb/qml/Utils.js"
D/Qt ( 5463): ....\Source\GUI_QML\ResourcesDevice.cpp:279 (virtual void qml::ResourcesEngine::setFileName(const QString&)): ResourcesEngine::setFileName : "main.1.fr.anuman.HomeDesign3D.obb/qml"
W/Qt ( 5463): file:///data/data/fr.anuman.HomeDesign3D/files/main.1.fr.anuman.HomeDesign3D.obb/qml/Main.qml:17 ((null)): file:///data/data/fr.anuman.HomeDesign3D/files/main.1.fr.anuman.HomeDesign3D.obb/qml/Main.qml:17:5: ProjectInfo is not a type
@ProjectInfo component is in the "main.1.fr.anuman.HomeDesign3D.obb/qml" folder for which I return fileFlags : All read permissions, exists, directory and all execution permissions.
I got the error just after the last call of my QAbstractFileEngine::fileFlags(FileFlags type) implementation. -
We also using cmake, do you know how I import a private module with it?
I tried that :
find_package(Qt5Core ${QT_MIN_VERSION} REQUIRED Private)without success.
My header #include <QtCore/private/qabstractfileengine_p.h> can't be found.
-
Without any code, initialization etc… I can't tell
-
I finally made it work on Windows, but not Android that is my main target for the moment.
The issue was my read implementation that didn't return the correct size cause I mess the check of the end of file.
I am using the same code and package file on android but I still have the same issue.What part of code do you need?
Is there a way to associate Qt code to the debugger to be able to understand where it failed to load the component and for what condition? That was the method I used to find the issue on read implementation.
-
You can use the debugger the same way
The implementation of your custom file engine handler, however it might be easier if the code is big to either use a pastbin site or if you have a repository to look at
-
I had try to add mapping to Qt sources to the debugger, but I am not able to see it, QtCreator always show me the asm of Qt.
I have found a little workaround, I can load qml files from the user backup directory and images from my package, so the issue seems to be specific of the way qml files are loaded. I certainly do something wrong with text file that cause some parsing issues, but it strange in this case that it's works on Windows.
Here is my implementation of the QAbstractFileEngine :
http://pastebin.com/ZnMFVdDV
http://pastebin.com/rf9wuein -
@mCurrentDir = QDir::current().path() + "/";@
Looks dangerous to me, it's probably not what you assume it is on android
-
I have a question about the QFileInfo QAbstractFileEngineIterator::currentFileInfo() const method.
How the implementation made in my derived class can generate a QFileInfo with right properties? Like if the entry is a file or a directory? -
[quote author="SGaist" date="1410898531"]@mCurrentDir = QDir::current().path() + "/";@
Looks dangerous to me, it's probably not what you assume it is on android[/quote]
You are right, it's certainly better for my to check if the path contains my package name then removing everything before to clean file path.
-
If you want you own application folder your can use Q(Gui)Application for that.
-
[quote author="SGaist" date="1410986525"]If you want you own application folder your can use Q(Gui)Application for that.[/quote]
Yes we already use it for some other things.
Thank you a lot for all of your help.
How I can mark this thread a resolved?
-
You're welcome !
Just edit your original post and update the thread title :)