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 7 Oct 2015, 12:45 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

    P V 2 Replies Last reply 8 Oct 2015, 06:40
    0
    • T trustman
      7 Oct 2015, 12:45

      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

      P Offline
      P Offline
      p3c0
      Moderators
      wrote on 8 Oct 2015, 06:40 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 18 Jun 2020, 02:29
      1
      • T trustman
        7 Oct 2015, 12:45

        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

        V Offline
        V Offline
        vishnu
        wrote on 8 Oct 2015, 07:50 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 9 Oct 2015, 06:09 last edited by
          #4

          Thank you every body

          1 Reply Last reply
          0
          • T Offline
            T Offline
            trustman
            wrote on 12 Oct 2015, 09:20 last edited by
            #5
            This post is deleted!
            1 Reply Last reply
            0
            • T Offline
              T Offline
              trustman
              wrote on 12 Oct 2015, 09:35 last edited by
              #6

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

              V 1 Reply Last reply 13 Oct 2015, 12:41
              0
              • T trustman
                12 Oct 2015, 09:35

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

                V Offline
                V Offline
                vishnu
                wrote on 13 Oct 2015, 12:41 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
                • P p3c0
                  8 Oct 2015, 06:40

                  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 18 Jun 2020, 02:29 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