Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage inside CMake Qt project #92

Closed
igor-krawczuk opened this issue Jun 10, 2019 · 3 comments
Closed

Usage inside CMake Qt project #92

igor-krawczuk opened this issue Jun 10, 2019 · 3 comments

Comments

@igor-krawczuk
Copy link

Hi,this is probably related #55 , although to be honest I didn't understand how to solve my problem from reading the thread (i.e. how to deploy as a plugin).

Is there any place I can check in order to get QuickQanava integrated into a CMakeLists.txt qt project? I currently use the following lines in my CmakeLists.txt

include_directories("/usr/local/include/quickqanava")
include_directories("/usr/local/include/quickcontainers")
add_library(QuickQanava STATIC IMPORTED)
set_target_properties(QuickQanava PROPERTIES IMPORTED_LOCATION "/usr/local/lib/libQuickQanava.a")
add_library(QuickContainers STATIC IMPORTED)
set_target_properties(QuickContainers PROPERTIES IMPORTED_LOCATION "/usr/local/lib/libQuickContainers.a")

And then the example from the docs

import QtQuick 2.0
import QuickQanava 2.0 as Qan
//import "qrc:/QuickQanava" as Qan

Item {
    anchors.fill: parent
    //Image{
    //    anchors.fill: parent
    //    source: "./dummy_graph.png"
    //}
    Qan.Graph {
        id: graph
        anchors.fill: parent
        Component.onCompleted: {
            var n1 = graph.insertNode()
            n1.label = "Hello World"
        }
    }

}

but I get the following error (sample always the same cause):

)
qan::Graph::createFromComponent():  (qrc:/QuickQanava/VisualConnector.qml:30:1: module ":.QuickQanava" plugin "quickqanavaplugin" not found)
Component error:  (qrc:/QuickQanava/Node.qml:39:1: module ":.QuickQanava" plugin "quickqanavaplugin" not found)

If I understand #55 correctly I need to deploy as a plugin and do dynamic linking? Is there anywhere I can look to figure out how to do it?

@igor-krawczuk
Copy link
Author

Small update: I have changed the CMakeLists.txt entry to

find_package(QuickQanava  REQUIRED)
target_link_libraries(${PROJECT_NAME} PRIVATE QuickQanava )

and have verified that make install placed the qmldir in the correct folder.
I still get errors ala

qan::Graph::createComponent(): Error while creating component from URL  "qrc:/QuickQanava/SelectionItem.qml"
	QML Component status= QQmlComponent::Error
	QML Component errors= (file::/QuickQanava/qmldir: module ":.QuickQanava" plugin "quickqanavaplugin" not found)

as well as the following trace (excerpted) using QML_IMPORT_TRACE=1 and QT_DEBUG_PLUGINS=1

QQmlImports(qrc:/QuickQanava/Group.qml)::addLibraryImport: "QuickQanava" 2.0 as "Qan"
QQmlImports(qrc:/QuickQanava/Group.qml)::importExtension: loaded "/usr/lib/qt/qml/QuickQanava/qmldir"
QQmlImports(qrc:/QuickQanava/Group.qml)::addFileImport: "qrc:/QuickQanava" -1.-1 as "Qan"
QQmlImports(qrc:/QuickQanava/Group.qml)::importExtension: loaded ":/QuickQanava/qmldir"
QQmlImportDatabase::resolvePlugin: Could not resolve plugin "quickqanavaplugin" in ":/QuickQanava"
qan::Graph::createComponent(): Error while creating component from URL  "qrc:/QuickQanava/Group.qml"
	QML Component status= QQmlComponent::Error
	QML Component errors= (qrc:/QuickQanava/Group.qml:40:1: module ":.QuickQanava" plugin "quickqanavaplugin" not found)

QQmlImports(qrc:/QuickQanava/Edge.qml)::addLibraryImport: "QuickQanava" 2.0 as "Qan"
QQmlImports(qrc:/QuickQanava/Edge.qml)::importExtension: loaded "/usr/lib/qt/qml/QuickQanava/qmldir"
QQmlImports(qrc:/QuickQanava/Edge.qml)::addFileImport: "qrc:/QuickQanava" -1.-1 as "Qan"
QQmlImports(qrc:/QuickQanava/Edge.qml)::importExtension: loaded ":/QuickQanava/qmldir"
QQmlImportDatabase::resolvePlugin: Could not resolve plugin "quickqanavaplugin" in ":/QuickQanava"
qan::Graph::createComponent(): Error while creating component from URL  "qrc:/QuickQanava/Edge.qml"
	QML Component status= QQmlComponent::Error
	QML Component errors= (qrc:/QuickQanava/Edge.qml:39:1: module ":.QuickQanava" plugin "quickqanavaplugin" not found)
QQmlImports(qrc:/QuickQanava/SelectionItem.qml)::addLibraryImport: "QtQuick" 2.7 as ""
QQmlImports(qrc:/QuickQanava/SelectionItem.qml)::importExtension: loaded "/usr/lib/qt/qml/QtQuick.2/qmldir"
QQmlImports(qrc:/QuickQanava/SelectionItem.qml)::resolveType: "NumberAnimation" => "QQuickNumberAnimation" TYPE
QQmlImports(qrc:/QuickQanava/SelectionItem.qml)::resolveType: "Rectangle" => "QQuickRectangle" TYPE
QQmlImports(qrc:/QuickQanava/SelectionItem.qml)::resolveType: "ParallelAnimation" => "QQuickParallelAnimation" TYPE
QQmlImports(qrc:/QuickQanava/SelectionItem.qml)::resolveType: "SequentialAnimation" => "QQuickSequentialAnimation" TYPE
QQmlImports(qrc:/QuickQanava/SelectionItem.qml)::resolveType: "Transition" => "QQuickTransition" TYPE
QQmlImports(qrc:/QuickQanava/SelectionItem.qml)::resolveType: "PropertyChanges" => "QQuickPropertyChanges" TYPE
QQmlImports(qrc:/QuickQanava/SelectionItem.qml)::resolveType: "ScriptAction" => "QQuickScriptAction" TYPE
QQmlImports(qrc:/QuickQanava/SelectionItem.qml)::resolveType: "State" => "QQuickState" TYPE
QQmlImports(qrc:/QuickQanava/SelectionItem.qml)::addImplicitImport
QQmlImports(qrc:/QuickQanava/SelectionItem.qml)::importExtension: loaded ":/QuickQanava/qmldir"
QQmlImportDatabase::resolvePlugin: Could not resolve plugin "quickqanavaplugin" in ":/QuickQanava"
qan::Graph::createComponent(): Error while creating component from URL  "qrc:/QuickQanava/SelectionItem.qml"
	QML Component status= QQmlComponent::Error
	QML Component errors= (file::/QuickQanava/qmldir: module ":.QuickQanava" plugin "quickqanavaplugin" not found)
QQmlImports(qrc:/QuickQanava/Node.qml)::addLibraryImport: "QtQuick" 2.7 as ""
QQmlImports(qrc:/QuickQanava/Node.qml)::importExtension: loaded "/usr/lib/qt/qml/QtQuick.2/qmldir"
QQmlImports(qrc:/QuickQanava/Node.qml)::addLibraryImport: "QtQuick.Layouts" 1.3 as ""
QQmlImports(qrc:/QuickQanava/Node.qml)::importExtension: loaded "/usr/lib/qt/qml/QtQuick/Layouts/qmldir"
QQmlImports(qrc:/QuickQanava/Node.qml)::addLibraryImport: "QuickQanava" 2.0 as "Qan"
QQmlImports(qrc:/QuickQanava/Node.qml)::importExtension: loaded "/usr/lib/qt/qml/QuickQanava/qmldir"
QQmlImports(qrc:/QuickQanava/Node.qml)::addFileImport: "qrc:/QuickQanava" -1.-1 as "Qan"
QQmlImports(qrc:/QuickQanava/Node.qml)::importExtension: loaded ":/QuickQanava/qmldir"
QQmlImportDatabase::resolvePlugin: Could not resolve plugin "quickqanavaplugin" in ":/QuickQanava"
QQmlImports(qrc:/QuickQanava/VisualConnector.qml)::addLibraryImport: "QtQuick" 2.7 as ""
QQmlImports(qrc:/QuickQanava/VisualConnector.qml)::importExtension: loaded "/usr/lib/qt/qml/QtQuick.2/qmldir"
QQmlImports(qrc:/QuickQanava/VisualConnector.qml)::addLibraryImport: "QuickQanava" 2.0 as "Qan"
QQmlImports(qrc:/QuickQanava/VisualConnector.qml)::importExtension: loaded "/usr/lib/qt/qml/QuickQanava/qmldir"
QQmlImports(qrc:/QuickQanava/VisualConnector.qml)::addFileImport: "qrc:/QuickQanava" -1.-1 as "Qan"
QQmlImports(qrc:/QuickQanava/VisualConnector.qml)::importExtension: loaded ":/QuickQanava/qmldir"
QQmlImportDatabase::resolvePlugin: Could not resolve plugin "quickqanavaplugin" in ":/QuickQanava"
qan::Graph::createFromComponent():  (qrc:/QuickQanava/VisualConnector.qml:30:1: module ":.QuickQanava" plugin "quickqanavaplugin" not found)

@emmenlau
Copy link
Contributor

I had this same error, but everything started working when I set -DQUICK_QANAVA_BUILD_STATIC_QRC=ON as a cmake option. Can you try with the latest release 2.2.0?

@emmenlau
Copy link
Contributor

We tested this in combination with the PR #191 that may be required (or not, I'm not sure).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants