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

Forums

OverviewFelgo 3 Support (Qt 5) › ListView for Open new View

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #21414

    Paolo Mazzon

    Good day I’m new to Felgo ,I wanted to ask you if you have an example of a list than to do others page qml,this is my Qml code why use in QT:

    import QtQuick 2.0
    import QtQuick.Controls 2.5
    import QtQuick.Layouts 1.12
    
    ApplicationWindow {
        id: window
           width: 500
           height: 500
    
        visible:true
    
        Rectangle {
            id: rectangle
            color: "#363636"
            anchors.fill: parent
        }
    
    
        header: ToolBar {
    
            background:Rectangle
            {
                implicitHeight: 40
                 color: "beige"
            }
    
    
    
            RowLayout {
                anchors.fill: parent
                ToolButton {
                    text: qsTr("‹")
                    onClicked: stackView.pop()
                }
                Label {
                    text: "App Paolo"
                    elide: Label.ElideRight
                    horizontalAlignment: Qt.AlignHCenter
                    verticalAlignment: Qt.AlignVCenter
                    Layout.fillWidth: true
                }
                ToolButton {
                    text: qsTr("⋮")
                    onClicked: {
                       // menu.x = 30//(window.width - menu.width) / 1
                        //menu.y = 10
                        menu.open()
                    }
                }
            }
        }
    
        ListModel {
            id: pageModel
            ListElement {
                title: "Riparazioni"
                page: "Riparazioni.qml"
            }
            ListElement {
                title: "Magazzino"
                page: "Magazzino.qml"
            }
        }
        StackView {
            id: stackView
            anchors.fill: parent
            // Implements back key navigation
            focus: true
    //        //Keys.onReleased: if (event.key === Qt.Key_Back && stackView.depth > 1) {
    //                             stackView.pop();
    //                             event.accepted = true;
    //                         }
    
            initialItem: Item {
                width: parent.width
                height: parent.height
                ListView {
                    model: pageModel
                    anchors.fill: parent
                    delegate: AndroidDelegate {
                        text: title
                        onClicked: stackView.push(Qt.resolvedUrl(page))
                    }
                }
            }
        }
    
        Loader{
                id : ld
            }
        StackView {
            id: stack
            anchors.fill: parent
        }
    
        Menu {
            id: menu
    
            MenuItem{
                text: "Settings"
                onClicked: {
    
                  // stackView.push("Settings.qml")
    
    
    
                }
    
    
            }
        }
    
    
    
    
    
    }
    
    

     

    #21419

    Günther
    Felgo Team
    #21421

    Paolo Mazzon

    GT said:

    Hi,

    you can see how to work with Felgo List Components here: https://felgo.com/doc/apps-howto-scrollview-and-listview/

    For a get started guide, check Get Started with Felgo Apps

    Best,
    Günther from Felgo

    Ok tanks I have do so:

     

    import Felgo 3.0
    import QtQuick 2.5
    
     App {
      NavigationStack {
    
          id:navigationStack
    
        ListPage {
          id: page
          title: "Append List Item Example"
    
    
    
          ListPage {
                title: "List"
                model: ListModel {
    
                  ListElement {
                    name: "name1"
                    type1: "section1"
                    //icon: "../assets/Sprites/001.png"
                    page: "Riparazioni.qml"
                  }
                  ListElement {
                    name: "name2"
                    type1: "section1"
                   // icon: "../assets/Sprites/002.png"
                    //page: "Page2.qml"
                  }
                }
                delegate: SimpleRow {
                  text: name
                  onSelected: navigationStack.push(Qt.resolvedUrl(page))
                }
              }
        }
      }
     }
    

     

     

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