Hi, I've made a library with a couple of QObject-derived classes.
I want to create a qml module to import in QML files (with the unique beta-release of QtDeclarative for Qt 4.6.0).
I've used QML_DECLARE_TYPE and QML_DEFINE_TYPE to export my classes.
myclass.h
class MYLIBSHARED_EXPORT MyClass
: public QObject{
Q_OBJECT
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged)
// ...
};
QML_DECLARE_TYPE(MyClass)
class MYLIBSHARED_EXPORT MyClass : public QObject
{
Q_OBJECT
Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY checkableChanged)
// ...
};
QML_DECLARE_TYPE(MyClass)
To copy to clipboard, switch view to plain text mode
myclass.cpp
#include "myclass.h"
// ...
QML_DEFINE_TYPE(MyLibrary, 1,0, MyClass, MyClass)
#include "myclass.h"
// ...
QML_DEFINE_TYPE(MyLibrary, 1,0, MyClass, MyClass)
To copy to clipboard, switch view to plain text mode
mylibrary.pro
QT += declarative
TEMPLATE = lib
DEFINES += MYLIBSHARED_LIBRARY
HEADERS += myclass.h
SOURCES += myclass.cpp
QT += declarative
TEMPLATE = lib
DEFINES += MYLIBSHARED_LIBRARY
HEADERS += myclass.h
SOURCES += myclass.cpp
To copy to clipboard, switch view to plain text mode
Now i want to link this library in another project and write something like this:
example.qml
import MyLibrary 1.0
MyClass {
}
import MyLibrary 1.0
MyClass {
}
To copy to clipboard, switch view to plain text mode
How can i do this?
Thanks!
Bookmarks