Hi all,
I still manage to build properly a custom QML lib, so I built an extension plugin.
Everything works fine except…code completion within QtCreator. But it works during execution.
My custom QML type (defined in a QML file, not a QML binding from C++) isn’t recognized by the QML editor. It’s very frustrating.
I tried many things…it never works.
Here’s my project’s structure :
src
— app
—— some things
—— qml.qrc
——— main.qml // error M300
— libs
—— customquick // Folder of QML plugins
——— controls // my extension plugin
———— customquickcontrolsplugin.(h/cpp)
———— gridmenulogic.(h/cpp) // C++ binding class
———— GridMenu.qml // the type which isn’t recognized in main.qml
———— qmldir
My qmldir :
module customquick.controls
GridMenu 1.0 GridMenu.qml
plugin customquickcontrolsplugin
classname CustomQuickControlsPlugin
main.qml
import QtQuick 2.2
import QtQuick.Window 2.1
import customquick.controls 1.0
Window {
visible: true
width: 360
height: 360
GridMenu { *// <-- M300 error*
id: menu
anchors.fill: parent
}
}
GridMenu.qml
import QtQuick 2.0
import customquick.controls 1.0
Item {
width: 100
height: 80
GridMenuLogic {
}
}
And my CustomQuickControlsPlugin class :
void CustomQuickControlsPlugin::registerTypes(const char *uri)
{
// @uri controls
Q_ASSERT(uri == QLatin1String("customquick.controls"));
qmlRegisterType<GridMenuLogic>(uri, 1, 0, "GridMenuLogic");
}
The project copies the .qml files to the build directory and I setted the “QML2_IMPORT_PATH” environment var. But GridMenu is still underlined in main.qml…
I works with QtCreator 3.2.0 and Ubuntu 14.04.
Thanks for your help.
↧