Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Catch C++ signal

Tagged: , , ,

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #17793

    Felgo User

    I’m currently porting a C++ application to Felgo. One problem I’m facing is the communication between C++ and QML, because it just won’t work. I’ve read all of the official tutorials and other examples there is.

    main.cpp

    ...
    qmlRegisterType<tile>("io.qt.examples.tile", 1, 0, "Tile");
    
    QQmlContext *context = engine.rootContext();
    tile t;
    context->setContextProperty(QStringLiteral("tile"), &t);
    ...

    tile.h

     

    public:

    signals:

    void tileChanged(QString number, QString name, QString color, QString status);

    tile.cpp

    ...
    emit tileChanged();
    ...
    

    page.qml

     

    import io.qt.examples.tile 1.0

    Page {

    Connections{

    target: tile

    onTileChanged: { console.log(“HELLO WORLD!”) }

    }

    Tile{

    onTileChanged: { console.log(“HELLO WORLD!”) }

    }

    }

     

     

    But nothing seems to be on the console. And yes, the function is emitted properly – I checked it with the debugger. Any help would be appreciated.

    #17804

    Günther
    Felgo Team
    #19698

    Manuel

    Hello

    I feel like a grave digger but currently this sample and the one provided with the SDK and any attempt to get this to work throws this error:

     

     

    QQmlComponent: Component is not ready
    file:/VPlayCppQML//qml/Main.qml:6: module "com.yourcompany.xyz" is not installed

     

     

    Something seems broken. Tried it with a normal Qt5 project, it works without any problem.

    #19702

    Alex
    Felgo Team
    #19709

    Manuel

    Hello Alex

    I tried both ways, it always logs:

     

    QQmlComponent: Component is not ready

    file:/lamada//qml/Main.qml:42: Type SamplePage unavailable
    file:/lamada//qml/SamplePage.qml:4: module “samplecpp” is not installed

    My test project is here: https://www.file-upload.net/download-13251613/lamada_usecasetesting.zip.html

    Don’t know if something is horrible wrong with my system (win 10) but I having also troubles with simple REST-Requests which are working with normal Qt.

     

    Greets

    Manuel

     

     

    #19749

    Manuel

    Hello again!

    Seems to work now, I think there was a mistake in my qml. Deleted the file and wrote it from scratch new. Works now.

    Sorry for the false alert.

    Greets

    Manuel

Viewing 6 posts - 1 through 6 (of 6 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded