Important: Please read the Qt Code of Conduct -

Convert from custom type to string

  • Hi. I'm register converter for my type, but in qml I get error: Error: Cannot assign QObject* to QString.

    QString convert( const IServer* srv )
    return srv->name();
    qmlRegisterUncreatableType<IServer>( "plugin", 1, 0, "IServer", "" );
    QMetaType::registerConverter<IServer*, QString>( convert );

    Is it possible convert my type to string in qml?

Log in to reply