Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. how to make button push to another qml file
Forum Updated to NodeBB v4.3 + New Features

how to make button push to another qml file

Scheduled Pinned Locked Moved General and Desktop
sgaist
8 Posts 4 Posters 4.3k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    trustman
    wrote on last edited by
    #1

    im new in qt creator , how i can make a button event on click , push or navigate to other qml file without stackview , only button navigate to another qml file

    p3c0P vishnuV 2 Replies Last reply
    0
    • T trustman

      im new in qt creator , how i can make a button event on click , push or navigate to other qml file without stackview , only button navigate to another qml file

      p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      Hi @trustman and Welcome
      If you do not want a container like StackView then you can do it simply by using a Loader. It has source property which you can use to load a particular QML file. Changing the url will unload the previous component and load the new one. Check out the example there.
      Now to make this work with Button you just have to set the Loader's source on Button's click event. Eg.

      Button {
          text: "MyButton"
          onClicked: loader.source = "MyFile.qml" //loader = id of Loader
      }
      

      157

      T 1 Reply Last reply
      1
      • T trustman

        im new in qt creator , how i can make a button event on click , push or navigate to other qml file without stackview , only button navigate to another qml file

        vishnuV Offline
        vishnuV Offline
        vishnu
        wrote on last edited by
        #3

        @trustman
        Hi and welcome !!
        As @p3c0 said you can do using Loader. you can also do using visible property .
        Eg:

        Button{
        onClick{
        file1.visible=true;
        }
        }
        qmlFile1{
        id:file1
        visible:false
        }
        

        if you want to come back just make file1.visible=false;

        1 Reply Last reply
        0
        • T Offline
          T Offline
          trustman
          wrote on last edited by
          #4

          Thank you every body

          1 Reply Last reply
          0
          • T Offline
            T Offline
            trustman
            wrote on last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • T Offline
              T Offline
              trustman
              wrote on last edited by
              #6

              But this method load the page on previous page , i want method to navigate to second page

              vishnuV 1 Reply Last reply
              0
              • T trustman

                But this method load the page on previous page , i want method to navigate to second page

                vishnuV Offline
                vishnuV Offline
                vishnu
                wrote on last edited by
                #7

                @trustman
                then you have use Loader since you don't want to use StackView.
                Or implement you own stack.

                1 Reply Last reply
                0
                • p3c0P p3c0

                  Hi @trustman and Welcome
                  If you do not want a container like StackView then you can do it simply by using a Loader. It has source property which you can use to load a particular QML file. Changing the url will unload the previous component and load the new one. Check out the example there.
                  Now to make this work with Button you just have to set the Loader's source on Button's click event. Eg.

                  Button {
                      text: "MyButton"
                      onClicked: loader.source = "MyFile.qml" //loader = id of Loader
                  }
                  
                  T Offline
                  T Offline
                  trupti007
                  wrote on last edited by trupti007
                  #8
                  This post is deleted!
                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved