- 
    
Bug
 - 
    Resolution: Fixed
 - 
    
P1: Critical
 - 
    6.0
 
 slate-old-type-reg.zip
 uses qmlRegisterType and friends to register types:
void Application::registerQmlTypes()
{
    qmlRegisterType<CanvasPaneItem>("App", 1, 0, "CanvasPaneItem");
    qmlRegisterType<ImageCanvas>();
    qmlRegisterType<ImageCanvas>("App", 1, 0, "ImageCanvas");
    qmlRegisterUncreatableType<CanvasPane>("App", 1, 0, "CanvasPane", "Can't create instances of CanvasPane");
    qRegisterMetaType<CanvasPane*>();
    qRegisterMetaType<CanvasPaneItem*>();
    qRegisterMetaType<ImageCanvas*>();
}
import QtQuick 2.13 import QtQuick.Controls 2.13 import App 1.0 ApplicationWindow { id: window width: 1200 height: 800 CanvasPaneItem { id: paneItem pane: canvas.paneAt(0) // pane: theCanvas.paneAt(0) anchors.fill: parent } }
It fails with:
QMetaProperty::read: Unable to handle unregistered datatype 'ImageCanvas*' for property 'CanvasPaneItem::canvas' qrc:/qml/main.qml:32: TypeError: Cannot call method 'paneAt' of undefined
You can also uncomment the context property code (and comment out pane: canvas.paneAt(0)) to get this error message:
qrc:/qml/main.qml:33:9: Unable to assign CanvasPane to [unknown property type]
The same result can be seen with slate-new-type-reg.zip
, which uses the new type registration macros.
It works as expected (with no errors) in 5.15.
- is required for
 - 
                    
QTBUG-82922 Register types declaratively
-         
 - Closed
 
 -