Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. To import pulgin in qml(Qt 4.7.4)
Forum Updated to NodeBB v4.3 + New Features

To import pulgin in qml(Qt 4.7.4)

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    bts-007
    wrote on last edited by
    #1

    (opencv-camera-capture-with-qml) I am using this plugin from the below link

    http://f24h.altervista.org/blog/opencv-camera-capture-with-qml/

    Here is the steps what I followed
    @
    step 1

    Under Qt Quick Project->Qt Quick Ui

    Name : main
    Create in: /home/bts-007/QtSDK/work/

    step 2

    Extracted the(plugin) tar file with in the folder main

    step 3

    edited main.qml from the use case

    import opencv.components 1.0

    CvCamView {
        id: camView
        width: 800
        height: 600
        camera: 0
        cameraState: CvCamView.ActiveState //unneeded because this is the default state
        resolution: CvCamResolution {
                        width: 800
                        height: 600
                    }
        onNewFrame: {
            console.log("new frame recived");
            consumer.detectSomething(iplWidth, iplHeight, iplData);
        }
    
    }
    

    step 4
    changed main.qmlproject

    import QmlProject 1.1

    Project {
    mainFile: "main.qml"

    /* Include .qml, .js, and image files from current directory and subdirectories */
    QmlFiles {
        directory: "."
    }
    JavaScriptFiles {
        directory: "."
    }
    ImageFiles {
        directory: "."
    }
    /* List of plugin directories passed to QML runtime */
    importPaths: [ "." ]  // this is the change what I made(set to current path)
    

    }

    step 5
    run the program.
    @

    cvcamview_plugin.cpp

    @
    #include "cvcamview_plugin.h"
    #include "cvcamview.h"
    #include "cvcamresolution.h"
    #include "cvhaardetector.h"

    #include <QApplication>
    #include <QtDeclarative/qdeclarative.h>

    void CvCamViewPlugin::registerTypes(const char *uri)
    {
    // @uri opencv.components
    qmlRegisterType<CvCamResolution>(uri, 1, 0, "CvCamResolution");
    qmlRegisterType<CvCamView>(uri, 1, 0, "CvCamView");
    qmlRegisterType<CvHaarDetector>(uri, 1, 0, "CvHaarDetector");

    }

    Q_EXPORT_PLUGIN2(CvCamView, CvCamViewPlugin)
    @

    uri - opencv.components

    I am getting an error message module "opencv.components" is not installed
    import opencv.components 1.0 .

    I can access the properties but I don't know why it is showing the error message

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Gennon
      wrote on last edited by
      #2

      What you probably need is this little piece of code:

      http://qt-project.org/doc/qt-5.0/qtqml/qqmlengine.html#addImportPath

      You need to do this in the main.cpp file. Or where ever you have access to the engine/viewer. Should work in 4.7.4 as well, I think. ;)

      For more information:
      http://qt-project.org/doc/qt-5.0/qtqml/qtqml-syntax-imports.html#qml-import-path

      http://qt-project.org/doc/qt-5.0/qtqml/qtqml-modules-identifiedmodules.html

      /Gen

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved