Using Colibri as a QML module



  • I need help turning Colibri into a module that I can use in a QML project. I've tried following the directions from "the Colibri wiki":https://projects.developer.nokia.com/colibri/wiki/InstallationAndUsage but I've been completely unsuccessful at the second step:

    • Open Qt Creator and start a new project by importing library root directory to a new project.

    I made the new project in Qt Creator. How do I "import library root directory"? My version of Qt Creator doesn't support importing directories. It supports adding an existing file to a project. That's about it. I could add the files one by one but that's so tedious that it feels wrong.

    FWIW, I'm using Qt Creator 2.2.0 on 64-bit Kubuntu.



  • David just place the colibri folder in the same directory as your qml file.
    Then go into Qt Creator, and make sure you have the following lines
    at the top of your qml file.

    @
    import Qt 4.7
    import "colibri"
    @

    Now when you click on the Design button in Qt Creator you should see the following.

    !http://i52.tinypic.com/53k3l4.png!

    There are also other plugins you can play with to.

    Desktop Components

    1. http://qt.gitorious.org/qt-components/desktop
      Screenshots -> http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/

    Canvas for Drawing

    1. http://qt.gitorious.org/qt-labs/qmlcanvas
      HTML5 canvas-like API for QML

    2D Physics

    1. http://gitorious.org/qml-box2d
      Screenshots-> http://labs.qt.nokia.com/2010/02/26/qt-box2d-is-easy/

    Hope that helps ;)



  • Thanks, zester. It works!

    I also tried using a symbolic link to my local copy of Colibri. That also worked until I build for Maemo. Upon rebuilding, I discovered that QtCreator deleted not only the link but also the directory it pointed to. Yuck.

    It seems a shame to have to make a copy for each project that might use Colibri.



  • David you can place the colibri directory in any location, you would just have to change
    the import function to reflect the location.

    @
    import "../colibri"

    or

    import "/projects/qml/colibri"
    @

    If your developing just one application place the colibri directory in the same location
    as your project.

    If your developing multiple applications then I would create a parent directory
    put the colibri folder in that directory and then your different application directory's in
    the same directory as your colibri folder..

    Example:
    @
    /Talmage
    - colibri
    - TalmageCalender
    - images
    - main.qml
    - TalmageContacts
    - images
    - main.qml
    @

    and then in each main.qml file

    @
    import "../colibri"
    @



  • That takes care of colibri as a local module. What must I do to make it an installed module?

    I tried creating a Qt Quick Application project for colibri. That gave me a main.cpp and a qmlapplicationviewer that I don't think I need. I think this is deployable but it will have unnecessary extra things with it.

    I tried creating a Qt Quick UI project for colibri. That gave me "Hello, world" like colibri.qml and a colibri.qmlproject file. Even though I put the colibri source code in the project directory, there isn't any way to deploy this project.

    I did not try to create a Custom QML Extension Plugin for colibri. The description tells me that it's a C++ class with magic to make it visible to QML. That seems like more than I need here.



  • bq. What must I do to make it an installed module?

    As in where others can install your application on there phone?
    If thats what you mean I think you have to go threw the http://store.ovi.com/

    or you can just package it as a zip or whatever and they can just unpack it and
    upload it to there phone via the usb cable.

    bq. I tried creating a Qt Quick Application project for colibri

    If your creating an application for a phone that uses c++ then you need main.cpp
    and qmlapplicationviewer for it to work on the phone. If it's all QML and javascript I
    think you can just deploy your QML/Javascript files on the phone as is and they should
    use the internal QML viewer.

    bq. I tried creating a Qt Quick UI project for colibri

    If you want to open an existing project that you have created in Qt Creator just
    open the .pro file with Qt Creator and everything will load as normal.

    bq. I did not try to create a Custom QML Extension Plugin for colibri.

    I believe that's only for creating a Hybrid QML/C++ extension.
    If your trying to build or extend QML components see
    http://doc.qt.nokia.com/4.7.1/qml-extending-types.html

    Have you read http://doc.qt.nokia.com/4.7-snapshot/qtquick.html ?



  • Thanks, zester, for helping me. I don't think we're understanding each other. I could have been clearer. I'm sorry for that.

    I want for someone else to be able to use Colibri as an installed QML module. I want other applications to be able to declare that they depend on Colibri and to have the platform package manager download and install Colibri if it isn't there already.

    As I see it, I have three problems to solve before others can use Colibri as I want.

    The first is to choose one of the three types of QML projects that Qt Creator can make. None of them are exactly what I need. Of the three options, Qt Quick Application, Qt Quick UI, and Custom QML Extension Plugin, the Qt Quick Application is probably the easiest to hack into what I want.

    The second problem is where to install my QML module. When I make a Maemo application, I install it in /opt/appname. When I make a Symbian application, I let Symbian install it wherever it wants. (There is a lot about Symbian that is magical to me.) I don't know where QML modules are supposed to go. That doesn't seem to be documented anywhere.

    The third problem is how to tell a QML application where my QML module resides. The environment variable QML_IMPORT_PATH tells the QML runtime where to look for modules. I don't know how to set that in a platform-independent way. This isn't documented in anything I've read so far.

    I've read all of the documentation I can find, including the fine manual you referenced above. This just isn't documented anywhere. It's frustrating.



  • [quote author="David Talmage" date="1308598470"]That takes care of colibri as a local module. What must I do to make it an installed module?

    I tried creating a Qt Quick Application project for colibri. That gave me a main.cpp and a qmlapplicationviewer that I don't think I need. I think this is deployable but it will have unnecessary extra things with it.

    I tried creating a Qt Quick UI project for colibri. That gave me "Hello, world" like colibri.qml and a colibri.qmlproject file. Even though I put the colibri source code in the project directory, there isn't any way to deploy this project.

    I did not try to create a Custom QML Extension Plugin for colibri. The description tells me that it's a C++ class with magic to make it visible to QML. That seems like more than I need here.
    [/quote]

    I think I understand you, David. I'm in the same situation.
    Is there anybody who solved the problem?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.