Skip to content

Commit

Permalink
Merge pull request wang-bin#1028 from oKcerG/fix-ios-qmlplugin
Browse files Browse the repository at this point in the history
Fix QML plugin not being found on iOS
wang-bin authored Jan 9, 2018
2 parents 65483f5 + e00c0d8 commit c180c21
Showing 3 changed files with 26 additions and 4 deletions.
15 changes: 11 additions & 4 deletions qml/libQmlAV.pro
Original file line number Diff line number Diff line change
@@ -13,10 +13,17 @@ PROJECTROOT = $$PWD/..
preparePaths($$OUT_PWD/../out)
#https://github.com/wang-bin/QtAV/issues/368#issuecomment-73246253
#http://qt-project.org/forums/viewthread/38438
# mkspecs/features/qml_plugin.prf
URI = QtAV #uri used in QtAVQmlPlugin::registerTypes(uri)
qtAtLeast(5, 3): QMAKE_MOC_OPTIONS += -Muri=$$URI # not sure what moc does
#DESTDIR = $$BUILD_DIR/bin/QtAV
# mkspecs/features/qml_plugin.prf mkspecs/features/qml_module.prf
TARGETPATH = QtAV
URI = $$replace(TARGETPATH, "/", ".")
qtAtLeast(5, 3): QMAKE_MOC_OPTIONS += -Muri=$$URI

static: CONFIG += builtin_resources

builtin_resources {
RESOURCES += libQmlAV.qrc
}

qtav_qml.files = qmldir Video.qml plugins.qmltypes
!static { #static lib copy error before ranlib. copy only in sdk_install
plugin.files = $$DESTDIR/$$qtSharedLib($$NAME)
6 changes: 6 additions & 0 deletions qml/libQmlAV.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<RCC>
<qresource prefix="/qt-project.org/imports/QtAV">
<file>qmldir</file>
<file>Video.qml</file>
</qresource>
</RCC>
9 changes: 9 additions & 0 deletions qml/plugin.cpp
Original file line number Diff line number Diff line change
@@ -32,13 +32,22 @@
#include "QmlAV/QuickFBORenderer.h"
#endif

inline void initResources() {
#ifdef BUILD_QMLAV_STATIC
Q_INIT_RESOURCE(libQmlAV);
#endif
}

namespace QtAV {

class QtAVQmlPlugin : public QQmlExtensionPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface")
public:
QtAVQmlPlugin() {
initResources();
}
void registerTypes(const char *uri)
{
Q_ASSERT(QLatin1String(uri) == QLatin1String("QtAV"));

0 comments on commit c180c21

Please sign in to comment.