diff options
author | Olivier Tilloy <olivier.tilloy@canonical.com> | 2012-10-05 15:26:44 +0000 |
---|---|---|
committer | Tarmac <> | 2012-10-05 15:26:44 +0000 |
commit | a03e7e775a9751f87efb8fd7acf226b5eb25f4e3 (patch) | |
tree | 7ca7cfb2dd1e42c6c0d45918087c23fbf09dc5ae /libqmenumodel/QMenuModel | |
parent | c3fbab270f60fc374bae50e787e0b2046f127a07 (diff) | |
parent | 900b75e3528ea23b9158c52e43bca905a1ee5e5f (diff) | |
download | qmenumodel-a03e7e775a9751f87efb8fd7acf226b5eb25f4e3.tar.gz qmenumodel-a03e7e775a9751f87efb8fd7acf226b5eb25f4e3.tar.bz2 qmenumodel-a03e7e775a9751f87efb8fd7acf226b5eb25f4e3.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 if one wants to generate the API documentation using qdoc.. Approved by Renato Araujo Oliveira Filho, jenkins.
Diffstat (limited to 'libqmenumodel/QMenuModel')
-rw-r--r-- | libqmenumodel/QMenuModel/CMakeLists.txt | 22 | ||||
-rw-r--r-- | libqmenumodel/QMenuModel/plugin.cpp | 9 | ||||
-rw-r--r-- | libqmenumodel/QMenuModel/plugin.h | 8 | ||||
-rw-r--r-- | libqmenumodel/QMenuModel/qmldir | 2 |
4 files changed, 18 insertions, 23 deletions
diff --git a/libqmenumodel/QMenuModel/CMakeLists.txt b/libqmenumodel/QMenuModel/CMakeLists.txt index 5fb1d9f..8a7702f 100644 --- a/libqmenumodel/QMenuModel/CMakeLists.txt +++ b/libqmenumodel/QMenuModel/CMakeLists.txt @@ -4,41 +4,29 @@ set(QMLPLUGIN_SRC plugin.cpp ) -set(QMLPLUGIN_HEADERS - plugin.h -) - -qt4_wrap_cpp(QMLPLUGIN_MOC - ${QMLPLUGIN_HEADERS} -) - add_library(qmenumodel-qml MODULE ${QMLPLUGIN_SRC} - ${QMLPLUGIN_MOC} ) include_directories( - ${CMAKE_CURRENT_SOURCE_DIR} ${src_SOURCE_DIR} - ${QT_INCLUDE_DIR} - ${QT_QTCORE_INCLUDE_DIR} - ${QT_QTGUI_INCLUDE_DIR} - ${QT_QTDECLARATIVE_INCLUDE_DIR} ${GLIB_INCLUDE_DIRS} - ${GIO_INCLUDE_DIRS} ) target_link_libraries(qmenumodel-qml qmenumodel - ${QT_QTCORE_LIBRARY} - ${QT_QTDCLARATIVE_LIBRARY} ${GLIB_LDFLAGS} ${GIO_LDFLAGS} ) +qt5_use_modules(qmenumodel-qml Qml Widgets) + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/qmldir" "${CMAKE_CURRENT_BINARY_DIR}/qmldir") +# Apparently, QT_IMPORTS_DIR didn’t make it to Qt5. +# In want of a better solution, let’s hardcode it… +set(QT_IMPORTS_DIR /opt/qt5/imports) set(QMLPLUGIN_INSTALL_PREFIX "${QT_IMPORTS_DIR}/QMenuModel") install(TARGETS qmenumodel-qml DESTINATION ${QMLPLUGIN_INSTALL_PREFIX}) install(FILES qmldir DESTINATION ${QMLPLUGIN_INSTALL_PREFIX}) 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 + |