diff options
author | Olivier Tilloy <olivier.tilloy@canonical.com> | 2012-10-05 11:59:50 +0200 |
---|---|---|
committer | Olivier Tilloy <olivier.tilloy@canonical.com> | 2012-10-05 11:59:50 +0200 |
commit | 81dbf09d988d87f82496ba106b5f1dd2aad7967d (patch) | |
tree | d1fed43374afcd9be379998526b7de11d591e271 /libqmenumodel | |
parent | 696fba50395807c344325af11e71ec74cf370c3d (diff) | |
download | qmenumodel-81dbf09d988d87f82496ba106b5f1dd2aad7967d.tar.gz qmenumodel-81dbf09d988d87f82496ba106b5f1dd2aad7967d.tar.bz2 qmenumodel-81dbf09d988d87f82496ba106b5f1dd2aad7967d.zip |
Port to Qt5.
To compile and test, one needs to install the qt5-meta-minimal package from the Canonical Qt5 Edgers PPA (https://launchpad.net/~canonical-qt5-edgers/+archive/qt5-beta1). This installs Qt5 in /opt/qt5/. cmake needs to be invoked with CMAKE_PREFIX_PATH=/opt/qt5/lib/cmake, and /opt/qt5/bin needs to be added to $PATH.
Diffstat (limited to 'libqmenumodel')
-rw-r--r-- | libqmenumodel/QMenuModel/CMakeLists.txt | 4 | ||||
-rw-r--r-- | libqmenumodel/QMenuModel/plugin.cpp | 9 | ||||
-rw-r--r-- | libqmenumodel/QMenuModel/plugin.h | 8 | ||||
-rw-r--r-- | libqmenumodel/QMenuModel/qmldir | 2 | ||||
-rw-r--r-- | libqmenumodel/src/CMakeLists.txt | 5 |
5 files changed, 20 insertions, 8 deletions
diff --git a/libqmenumodel/QMenuModel/CMakeLists.txt b/libqmenumodel/QMenuModel/CMakeLists.txt index 5fb1d9f..1a52ea0 100644 --- a/libqmenumodel/QMenuModel/CMakeLists.txt +++ b/libqmenumodel/QMenuModel/CMakeLists.txt @@ -8,7 +8,7 @@ set(QMLPLUGIN_HEADERS plugin.h ) -qt4_wrap_cpp(QMLPLUGIN_MOC +qt5_wrap_cpp(QMLPLUGIN_MOC ${QMLPLUGIN_HEADERS} ) @@ -28,6 +28,8 @@ include_directories( ${GIO_INCLUDE_DIRS} ) +qt5_use_modules(qmenumodel-qml Qml Widgets) + target_link_libraries(qmenumodel-qml qmenumodel ${QT_QTCORE_LIBRARY} diff --git a/libqmenumodel/QMenuModel/plugin.cpp b/libqmenumodel/QMenuModel/plugin.cpp index ec51ae9..26650eb 100644 --- a/libqmenumodel/QMenuModel/plugin.cpp +++ b/libqmenumodel/QMenuModel/plugin.cpp @@ -17,17 +17,21 @@ * Renato Araujo Oliveira Filho <renato@canonical.com> */ +extern "C" { +#include <glib-object.h> +} + #include "plugin.h" #include "qmenumodel.h" #include "qdbusmenumodel.h" #include "qdbusactiongroup.h" #include "qstateaction.h" -#include <QtDeclarative> - +#include <QtQml> void QMenuModelQmlPlugin::registerTypes(const char *uri) { + g_type_init(); qmlRegisterUncreatableType<QMenuModel>(uri, 0, 1, "QMenuModel", "QMenuModel is a interface"); qmlRegisterUncreatableType<QStateAction>(uri, 0, 1, "QStateAction", @@ -40,4 +44,3 @@ void QMenuModelQmlPlugin::registerTypes(const char *uri) } -Q_EXPORT_PLUGIN2(qmenumodel, QMenuModelQmlPlugin) diff --git a/libqmenumodel/QMenuModel/plugin.h b/libqmenumodel/QMenuModel/plugin.h index e9d6850..fc732d2 100644 --- a/libqmenumodel/QMenuModel/plugin.h +++ b/libqmenumodel/QMenuModel/plugin.h @@ -20,14 +20,16 @@ #ifndef QMENUMODELQMLPLUGIN_H #define QMENUMODELQMLPLUGIN_H -#include <QDeclarativeExtensionPlugin> +#include <QQmlExtensionPlugin> - -class QMenuModelQmlPlugin : public QDeclarativeExtensionPlugin +class QMenuModelQmlPlugin : public QQmlExtensionPlugin { Q_OBJECT + Q_PLUGIN_METADATA(IID "com.canonical.qmenumodel") + public: void registerTypes(const char *uri); }; #endif + diff --git a/libqmenumodel/QMenuModel/qmldir b/libqmenumodel/QMenuModel/qmldir index 32de804..5cb4fcd 100644 --- a/libqmenumodel/QMenuModel/qmldir +++ b/libqmenumodel/QMenuModel/qmldir @@ -1 +1,3 @@ +module QMenuModel plugin qmenumodel-qml + diff --git a/libqmenumodel/src/CMakeLists.txt b/libqmenumodel/src/CMakeLists.txt index 17d11f1..7e31941 100644 --- a/libqmenumodel/src/CMakeLists.txt +++ b/libqmenumodel/src/CMakeLists.txt @@ -19,7 +19,7 @@ set(QMENUMODEL_HEADERS qstateaction.h ) -qt4_wrap_cpp(QMENUMODEL_MOC +qt5_wrap_cpp(QMENUMODEL_MOC ${QMENUMODEL_HEADERS} ) @@ -39,8 +39,11 @@ include_directories( ${GIO_INCLUDE_DIRS} ) +qt5_use_modules(qmenumodel Core Widgets) + target_link_libraries(qmenumodel ${QT_QTCORE_LIBRARY} ${GLIB_LDFLAGS} ${GIO_LDFLAGS} ) + |