[solved] Qt Quick Designer not aware of exposed c++ defined QML types.
-
Hi,
I've created a few c++ classes that inherit from QQuickItem in order to expose some classes to our QML GUI.
Everything works great, every file gets detected perfectly during startup and updating the fields is fine too.However, when adding a specific class (SketchingModeler) to my main QML File and then trying to edit that main QML file in QtCreator's design tool, I get the following error :
@
"This QML file contains features which are not supported by Qt Quick Designer : Line:105 Unknown component. (M300)" @and then the main qml file is not editable anymore. The class DOES work when executing the program though.
This specific class was designed the same way as the others (which are found correctly by Qt Quick Designer) I'm using :
a c++ class defined like this :
@class QmlSketchingModeler : public QQuickItem, public SketchingModeler
{
Q_OBJECTQ_ENUMS(QMLSketchMode) Q_ENUMS(QMLSymmetryMode) Q_ENUMS(QMLDepthSelectionMode) Q_PROPERTY(QObject* engine READ engine WRITE set_engine) Q_PROPERTY(uint width READ width WRITE set_width) Q_PROPERTY(uint height READ height WRITE set_height) Q_PROPERTY(QMLSketchMode sketch_mode READ qml_sketch_mode WRITE set_qml_sketch_mode) Q_PROPERTY(QMLSymmetryMode symmetry_mode READ qml_symmetry_mode WRITE set_qml_symmetry_mode) Q_PROPERTY(QMLDepthSelectionMode depth_selection_mode READ qml_depth_selection_mode WRITE set_qml_depth_selection_mode) Q_PROPERTY(double brush_size READ brush_size WRITE set_brush_size) Q_PROPERTY(QColor color READ qcolor WRITE set_color)
...
@
Then I register it at startup :
@qmlRegisterType<SketchingModeler>("MyLib", 1, 0, "SketchingModeler");
@And import it in my qml file :
@
import Expressive 1.0Rectangle {
SketchingModeler { // < Unknown component. (M300)
...
}
}@cleaning, running qmake and rebuilding the project didn't help.
What should I do to make Qt Quick Designer aware of my qml class ?
Thanks in advance
A. -
Maybe "this":http://qt-project.org/doc/qt-4.8/designer-using-custom-widgets.html helps
-
I just found that just disabling the warning actually allows me to get the QML preview even though it doesn't find my class. This also solved another issue I had with "imperative code" not being handled by QtCreator
Anyway, thanks for replying dasRicardo :) !