Skip to content

Commit

Permalink
Add possibility to build QmlVlc as QML plugin
Browse files Browse the repository at this point in the history
QML plugins could be easily used with PyQt5 apps or
any other language bindings.

Build & Install QmlVlc as plugin:
qmake && make && make install

More info about Qt QML plugins:
http://doc.qt.io/qt-5/qtqml-modules-cppplugins.html
  • Loading branch information
uglide authored and RSATom committed May 28, 2015
1 parent c1fd28d commit 703797d
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 1 deletion.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
.DS_Store
*.o
*.so
moc_*.cpp
Makefile
2 changes: 1 addition & 1 deletion QmlVlc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#include "QmlVlcMmPlayer.h"
#endif

const char* qmlVlcUri = "QmlVlc";
const char* qmlVlcUri = "rsatom.qml.vlc";
const int QmlVlcVersionMajor = 0;
const int QmlVlcVersionMinor = 1;

Expand Down
2 changes: 2 additions & 0 deletions qmldir
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module rsatom.qml.vlc
plugin qmlvlcplugin
22 changes: 22 additions & 0 deletions qmlvlc.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
include(QmlVlc.pri)

CONFIG += c++11
LIBS += -lvlc
TARGET = qmlvlcplugin

PLUGIN_IMPORT_PATH = rsatom/qml/vlc

TEMPLATE = lib
CONFIG += qt plugin
QT += qml quick

target.path = $$[QT_INSTALL_QML]/$$PLUGIN_IMPORT_PATH
INSTALLS += target

qmldir.files += $$_PRO_FILE_PWD_/qmldir
qmldir.path += $$target.path
INSTALLS += qmldir

HEADERS += qmlvlc_plugin.h


21 changes: 21 additions & 0 deletions qmlvlc_plugin.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#pragma once

#include <QtQml>
#include <QQmlExtensionPlugin>

#include <QmlVlc.h>

#define QMLVLC_PLUGIN_ID "rsatom.qml.vlc"

class Q_DECL_EXPORT QmlVlcExtensionPlugin : public QQmlExtensionPlugin {
Q_OBJECT
Q_PLUGIN_METADATA(IID QMLVLC_PLUGIN_ID)

public:
virtual void initializeEngine(QQmlEngine *engine, const char *uri) {}
virtual void registerTypes(const char *uri)
{
Q_ASSERT(QString(QMLVLC_PLUGIN_ID) == uri);
RegisterQmlVlc();
}
};

0 comments on commit 703797d

Please sign in to comment.