diff options
-rw-r--r-- | CMakeLists.txt | 7 | ||||
-rw-r--r-- | examples/README | 6 | ||||
-rw-r--r-- | examples/render-menumodel.qml | 4 | ||||
-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 | ||||
-rw-r--r-- | tests/client/CMakeLists.txt | 7 | ||||
-rw-r--r-- | tests/client/actiongrouptest.cpp | 5 | ||||
-rw-r--r-- | tests/client/menuchangestest.cpp | 5 | ||||
-rw-r--r-- | tests/client/modeltest.cpp | 5 | ||||
-rw-r--r-- | tests/client/servicetest.cpp | 5 | ||||
-rw-r--r-- | tests/script/CMakeLists.txt | 4 |
14 files changed, 56 insertions, 20 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cba967..0bffb4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,8 @@ project(qmenumodel) -cmake_minimum_required(VERSION 2.8.0) +cmake_minimum_required(VERSION 2.8.9) -find_package(Qt4 REQUIRED) +find_package(Qt5Core) include(FindPkgConfig) pkg_check_modules(GLIB REQUIRED glib-2.0>=2.32) @@ -39,7 +39,7 @@ endif() OPTION(GENERATE_DOC "Enable qdoc generation" OFF) if(GENERATE_DOC) message(STATUS "QDoc enabled.") - find_program(QDOC_BIN qdoc3) + find_program(QDOC_BIN qdoc) if(NOT QDOC_BIN) message(FATAL_ERROR "qdoc command not found") else() @@ -47,4 +47,3 @@ if(GENERATE_DOC) endif() endif() - diff --git a/examples/README b/examples/README index c2516e3..1ecac0e 100644 --- a/examples/README +++ b/examples/README @@ -4,8 +4,8 @@ QML binding in applications. To export an example menu model on the bus, run 'exportmenu.py'. To render this menu in a QML application, run 'render-menumodel.qml' in -qmlviewer. You will need to inform qmlviewer of the location of the QMenuModel -if it’s not installed system-wide, e.g.: +qmlscene. You will need to inform qmlscene of the location of the QMenuModel +plugin if it’s not installed system-wide, e.g.: - qmlviewer -I libqmenumodel examples/render-menumodel.qml + qmlscene -I libqmenumodel examples/render-menumodel.qml diff --git a/examples/render-menumodel.qml b/examples/render-menumodel.qml index 45daf0d..1ad41c5 100644 --- a/examples/render-menumodel.qml +++ b/examples/render-menumodel.qml @@ -2,7 +2,7 @@ // under the well-known name com.canonical.testmenu and at the object path // /com/canonical/testmenu. -import QtQuick 1.1 +import QtQuick 2.0 import QMenuModel 0.1 Item { @@ -129,7 +129,7 @@ Item { x: 5 y: 5 anchors.margins: 4 - font.pixelSize: 12 + font.pixelSize: 11 } } } 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} ) + diff --git a/tests/client/CMakeLists.txt b/tests/client/CMakeLists.txt index 2c48a07..e9de735 100644 --- a/tests/client/CMakeLists.txt +++ b/tests/client/CMakeLists.txt @@ -1,8 +1,9 @@ macro(declare_test testname)
set(TEST_MOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${testname}.moc)
- qt4_generate_moc(${testname}.cpp ${TEST_MOC_FILE})
+ qt5_generate_moc(${testname}.cpp ${TEST_MOC_FILE})
add_executable(${testname} ${testname}.cpp ${TEST_MOC_FILE})
+ qt5_use_modules(${testname} Core DBus Widgets Test)
target_link_libraries(${testname}
qmenumodel
dbusmenuscript
@@ -26,9 +27,10 @@ endmacro(declare_test testname) macro(declare_simple_test testname)
set(TEST_MOC_FILE ${CMAKE_CURRENT_BINARY_DIR}/${testname}.moc)
- qt4_generate_moc(${testname}.cpp ${TEST_MOC_FILE})
+ qt5_generate_moc(${testname}.cpp ${TEST_MOC_FILE})
add_executable(${testname} ${testname}.cpp ${TEST_MOC_FILE})
+ qt5_use_modules(${testname} Core Test)
target_link_libraries(${testname}
qmenumodel
${QT_QTTEST_LIBRARY}
@@ -67,3 +69,4 @@ declare_test(menuchangestest) declare_test(modeltest)
declare_test(actiongrouptest)
declare_simple_test(convertertest)
+
diff --git a/tests/client/actiongrouptest.cpp b/tests/client/actiongrouptest.cpp index 116bd44..958ddc7 100644 --- a/tests/client/actiongrouptest.cpp +++ b/tests/client/actiongrouptest.cpp @@ -17,6 +17,10 @@ * Renato Araujo Oliveira Filho <renato@canonical.com> */ +extern "C" { +#include <glib-object.h> +} + #include "qdbusmenumodel.h" #include "qdbusactiongroup.h" #include "dbusmenuscript.h" @@ -38,6 +42,7 @@ private: private Q_SLOTS: void initTestCase() { + g_type_init(); Q_ASSERT(m_script.connect()); } diff --git a/tests/client/menuchangestest.cpp b/tests/client/menuchangestest.cpp index 2015582..bc7dcbd 100644 --- a/tests/client/menuchangestest.cpp +++ b/tests/client/menuchangestest.cpp @@ -17,6 +17,10 @@ * Renato Araujo Oliveira Filho <renato@canonical.com> */ +extern "C" { +#include <glib-object.h> +} + #include "qdbusmenumodel.h" #include "dbusmenuscript.h" @@ -35,6 +39,7 @@ private: private Q_SLOTS: void initTestCase() { + g_type_init(); Q_ASSERT(m_script.connect()); } diff --git a/tests/client/modeltest.cpp b/tests/client/modeltest.cpp index 9f6ee76..542b38a 100644 --- a/tests/client/modeltest.cpp +++ b/tests/client/modeltest.cpp @@ -17,6 +17,10 @@ * Renato Araujo Oliveira Filho <renato@canonical.com> */ +extern "C" { +#include <glib-object.h> +} + #include "qdbusmenumodel.h" #include "dbusmenuscript.h" @@ -35,6 +39,7 @@ private: private Q_SLOTS: void initTestCase() { + g_type_init(); Q_ASSERT(m_script.connect()); } diff --git a/tests/client/servicetest.cpp b/tests/client/servicetest.cpp index a8b0c2a..d34ba79 100644 --- a/tests/client/servicetest.cpp +++ b/tests/client/servicetest.cpp @@ -17,6 +17,10 @@ * Renato Araujo Oliveira Filho <renato@canonical.com> */ +extern "C" { +#include <glib-object.h> +} + #include "qdbusmenumodel.h" #include "dbusmenuscript.h" @@ -42,6 +46,7 @@ private: private Q_SLOTS: void initTestCase() { + g_type_init(); Q_ASSERT(m_script.connect()); } diff --git a/tests/script/CMakeLists.txt b/tests/script/CMakeLists.txt index 11af44e..bf415f5 100644 --- a/tests/script/CMakeLists.txt +++ b/tests/script/CMakeLists.txt @@ -8,7 +8,7 @@ set(DBUSMENUSCRIPT_HEADERS dbusmenuscript.h ) -qt4_wrap_cpp(DBUSMENUSCRIPT_MOC +qt5_wrap_cpp(DBUSMENUSCRIPT_MOC ${DBUSMENUSCRIPT_HEADERS} ) @@ -27,6 +27,8 @@ include_directories( ${QT_QTDBUS_INCLUDE_DIR} ) +qt5_use_modules(dbusmenuscript Core DBus Test) + target_link_libraries(dbusmenuscript ${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} |