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

Forums

OverviewFelgo 3 Support (Qt 5) › Integration whit my c++ backend

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #21422

    Paolo Mazzon

    Good day

    integrating the Backend an error when I open the Riparazioni page:

    https://imgur.com/1Sq83So

     

    
    If you want to remove the Felgo Splash & loading screen, or to use plugins for monetization, analytics, push notifications, social networks & more, generate a license key for your app here: https://felgo.com/licenseKey
    qrc:/qml/VPlayApps/navigation/NavigationItem.qml:401: Unable to assign QQuickText to Page_QMLTYPE_334
    qrc:/qml/VPlayApps/navigation/NavigationStack.qml:627: Unable to assign [undefined] to QQuickItem*
    qrc:/qml/VPlayApps/navigation/NavigationStack.qml:640: Unable to assign [undefined] to bool

     

     

    main:

    #include <QApplication>
    #include <FelgoApplication>
    #include <backend.h>
    
    #include <QQmlApplicationEngine>
    
    // uncomment this line to add the Live Client Module and use live reloading with your custom C++ code
    //#include <FelgoLiveClient>
    
    
    int main(int argc, char *argv[])
    {
        QApplication app(argc, argv);
        FelgoApplication felgo;
    
        // Use platform-specific fonts instead of Felgo's default font
        felgo.setPreservePlatformFonts(true);
    
        QQmlApplicationEngine engine;
        felgo.initialize(&engine);
    
         qmlRegisterType<Backend>("io.qt.Backend", 1, 0, "Backend");
    
        // use this during development
        // for PUBLISHING, use the entry point below
        felgo.setMainQmlFileName(QStringLiteral("qml/Main.qml"));
    
        // use this instead of the above call to avoid deployment of the qml files and compile them into the binary with qt's resource system qrc
        // this is the preferred deployment option for publishing games to the app stores, because then your qml files and js files are protected
        // to avoid deployment of your qml files and images, also comment the DEPLOYMENTFOLDERS command in the .pro file
        // also see the .pro file for more details
        // felgo.setMainQmlFileName(QStringLiteral("qrc:/qml/Main.qml"));
    
        engine.load(QUrl(felgo.mainQmlFileName()));
    
        // to start your project as Live Client, comment (remove) the lines "felgo.setMainQmlFileName ..." & "engine.load ...",
        // and uncomment the line below
        //FelgoLiveClient client (&engine);
    
        return app.exec();

     

    Main.qml

    import Felgo 3.0
    import QtQuick 2.5
    
     App {
    
         Navigation {
              // enable both tabs and drawer for this demo
              // by default, tabs are shown on iOS and a drawer on Android
              navigationMode: navigationModeDrawer
    
              NavigationItem {
                title: "Home"
                icon: IconType.home
    
    
      NavigationStack {
    
          id:navigationStack
    
        ListPage {
          id: page
          title: "App Paolo"
    
    
    
          ListPage {
                title: "List"
                model: ListModel {
    
                  ListElement {
                    name: "Riparazioni"
                    type1: "section1"
                    //icon: "../assets/Sprites/001.png"
                    page: "Riparazioni.qml"
                  }
                  ListElement {
                    name: "name2"
                    type1: "Magazzino"
                   // icon: "../assets/Sprites/002.png"
                    //page: "Page2.qml"
                  }
                }
                delegate: SimpleRow {
                  text: name
                  onSelected: navigationStack.push(Qt.resolvedUrl(page))
                }
              }
        }
      }
     }
         }
     }
    

    Page Riparazioni.qml

    import Felgo 3.0
    import QtQuick 2.0
    import io.qt.Backend 1.0
    
    
    Page {
    
        id:page
    
        title: "Riparazioni"
    
    
        Backend {
            id: backend
    
            onSendCode: txtCodice.text = code
    
            onSendPCosto:txtPCosto.text = p_pCosto
    
            onSendPPubblico:txtPPub.text = p_pPubblico
    
        }
    
        Row {
            id: row1
            height: 50
            anchors.right: parent.right
            anchors.rightMargin: 5
            anchors.left: parent.left
            anchors.leftMargin: 5
            anchors.top: parent.top
            anchors.topMargin: 3
    
            Rectangle {
                id: rectangle_Search
                height: 44
                color: "#4b4b4b"
                radius: 7
                anchors.top: parent.verticalCenter
                anchors.topMargin: -25
                anchors.left: parent.left
    
                anchors.right: parent.right
    
    
                AppText {
                    id:lbl_SearchCode
                    color: "#0a0808"
                    text: qsTr("Codice")
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.left: parent.left
                    anchors.leftMargin: 4
                    font.pixelSize: 12
                }
    
                AppTextEdit {
                    id: c_Txt_codice
                    y: 0
                    width: 50
                    height: 20
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.bottom: parent
                    anchors.bottomMargin: 0
                    anchors.left: lbl_SearchCode.right
                    anchors.leftMargin: 20
    
                }
    
                AppButton {
                    id: btnSearchKey
                    x: 583
                    y: 3
                    text: "S"
                    anchors.verticalCenter: parent.verticalCenter
                    anchors.right: parent.right
                    anchors.rightMargin: 5
                    anchors.top: parent.verticalCenter
                    anchors.topMargin: -22
                    onClicked: {
                        
                        backend.connectClicked()
                        backend.sendSearch(1,parseInt(c_Txt_codice.text))
    
                    }
                }
    
            }
        }
        Row {
            id: row2
            height: 200
            anchors.right: parent.right
            anchors.rightMargin: 3
            anchors.left: parent.left
            anchors.leftMargin: 3
            anchors.top: row1.bottom
            anchors.topMargin: 2
    
            Rectangle{
                id: rectangle_Articolo
                color: "#848484"
                radius: 18
                anchors.fill: parent
    
    
    
               AppText{
                    id: lbl_NBusta
                    color: "#ebedef"
                    text: "N°Busta"
                    anchors.left: parent.left
                    anchors.leftMargin: 5
                    anchors.top: parent.top
                    anchors.topMargin: 10
                }
    
                AppTextEdit {
                    id: txtCodice
                    width: 40
                    height: 18
                    anchors.top: parent.top
                    anchors.topMargin: 10
                    anchors.left: lbl_NBusta.right
                    anchors.leftMargin: 30
                }
    
                AppText {
                    id: lbl_PCosto
                    x: 5
                    y: -1
                    color: "#ebedef"
                    text: "Pr. Costo"
                    anchors.top: lbl_NBusta.bottom
                    anchors.topMargin: 18
                    anchors.left: parent.left
                    anchors.leftMargin: 5
                }
    
                AppTextEdit {
                    id: txtPCosto
                    y: 8
                    width: 40
                    height: 18
                    anchors.top: txtCodice.bottom
                    anchors.topMargin: 10
                    anchors.left: lbl_PCosto.right
                    anchors.leftMargin: 25
                }
    
                AppTextEdit {
                    id: txtPPub
                    x: -3
                    y: -47
                    width: 40
                    height: 18
                    anchors.top: txtPCosto.bottom
                    anchors.topMargin: 10
                    anchors.left: lbl_PCosto.right
                    anchors.leftMargin: 25
                }
    
                AppText {
                    id: lbl_pPubblioco
                    x: 2
                    y: -56
                    color: "#ebedef"
                    text: "Pr. Pub."
                    anchors.top: lbl_PCosto.bottom
                    anchors.topMargin: 17
                    anchors.left: parent.left
                    anchors.leftMargin: 5
                }
    
                AppButton {
                    id: btnSalva
                    x: 0
                    text: "SALVA"
                    anchors.top: parent.top
                    anchors.topMargin: 50
                    anchors.right: parent.right
                    anchors.rightMargin: 50
                    onClicked: {
    
                       backend.connectClicked()
                       backend.sendUpdateRiparazione(3,parseInt(txtCodice.text),parseFloat(txtPCosto.text),parseFloat(txtPPub.text));
    
    
                    }
                }
    
    
    
    
            }
    
        }
    
    }
    
    

     

    #21423

    Günther
    Felgo Team

    You Main.qml uses a ListPage {

    within another ListPage { 

     

    The Page is an essential core type of Felgo Apps, and can not contain other pages. Pages are used within a single NavigationStack or NavigationItem to present your content.

     

    you can see the Getting Started with Felgo and Qt Creator guide to learn more about Game Development with QML and Felgo. The documentation holds many similar guides and step-by-step tutorials to learn different aspects of the SDK. You can also browse through the source code of all the game demos and examples that are included.

     

    Best,
    Günther

    #21424

    Paolo Mazzon

    I did so:

     

    App {
    
        Navigation {
            // enable both tabs and drawer for this demo
            // by default, tabs are shown on iOS and a drawer on Android
            navigationMode: navigationModeDrawer
    
            NavigationItem {
                title: "Home"
                icon: IconType.home
    
    
    
                NavigationStack {
    
                    id:navigationStack
    
                    ListPage {
                        id: page
                        title: "App Paolo"
    
    
                        model: ListModel {
    
                            ListElement {
                                name: "Riparazioni"
                                type1: "section1"
                                //icon: "../assets/Sprites/001.png"
                                page: "Riparazioni.qml"
    
                            }
                            ListElement {
                                name: "Magazzino"
                                type1: "Magazzino"
                                // icon: "../assets/Sprites/002.png"
                                page: "Magazzino.qml"
                            }
                        }
                        delegate: SimpleRow {
                            text: name
                            onSelected: navigationStack.push(Qt.resolvedUrl(page))
                        }
    
                    }
                }
            }
        }
    }

     

    but if in the Riparazioni class is present it gives me error,if I don’t put it, it works quietly.

    import io.qt.Backend 1.0

    I have to do something like that but I can’t find an example with the code to understand where I’m wrong

    https://imgur.com/uvuO7mp

    #21425

    Günther
    Felgo Team

    You can see this guide to learn more about how to integrate C++ components with QML:

    https://felgo.com/cross-platform-development/how-to-expose-a-qt-cpp-class-with-signals-and-slots-to-qml

     

    Please note that custom C++ additions do not work with Felgo Live, which allows to preview QML code only. As an alternative, you can also compile your own Felgo Live Client for your project. You can then preview your QML code and have your C++ additions in the compiled binary as well:

    https://felgo.com/updates/release-2-16-1-live-code-reloading-with-custom-c-and-native-code-for-qt

    For a quick upgrade regarding V-Play vs Felgo, you can see the rebranding post: https://felgo.com/updates/felgo-release-and-roadmap

    Best,
    Günther

    #21426

    Paolo Mazzon

    GT said:

    You can see this guide to learn more about how to integrate C++ components with QML:

    https://felgo.com/cross-platform-development/how-to-expose-a-qt-cpp-class-with-signals-and-slots-to-qml

     

    Please note that custom C++ additions do not work with Felgo Live, which allows to preview QML code only. As an alternative, you can also compile your own Felgo Live Client for your project. You can then preview your QML code and have your C++ additions in the compiled binary as well:

    https://felgo.com/updates/release-2-16-1-live-code-reloading-with-custom-c-and-native-code-for-qt

    For a quick upgrade regarding V-Play vs Felgo, you can see the rebranding post: https://felgo.com/updates/felgo-release-and-roadmap

    Best,
    Günther

    I solved, the problem was on my backand I was testing the setting when before starting with mud and I hadn’t finished doing the tests. Thanks

Viewing 5 posts - 1 through 5 (of 5 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