Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Regarding Loader
Qt 6.11 is out! See what's new in the release blog

Regarding Loader

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 1.3k Views 2 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.
  • Naveen_DN Offline
    Naveen_DN Offline
    Naveen_D
    wrote on last edited by
    #1

    Hi all,
    I have two separate files notificationBar.qml and MusicPlayer.qml in my project. i am loading these files using Loader in main.qml and initially i have made the musicplayer.qml as active=false and visible= false.while loading the notificationBar.qml i am setting a label text = "AAAA". Now when i get the output everything is fine i get the label as expected. Based onClicked event i am making the musicplayer.qml as active=true and visible=true but at this point i also want to change the label which already loaded as "AAAA" how can i do this ?
    I tried to create an object of notificationBar with an id in musicplayer.qml and in onClicked event i tried to change the label but didn't get the output.
    Thanks

    Naveen_D

    1 Reply Last reply
    0
    • Naveen_DN Offline
      Naveen_DN Offline
      Naveen_D
      wrote on last edited by
      #2

      Hello, can anyone please guide me to solve the above issue, Thanks

      Naveen_D

      Marco PellinM 1 Reply Last reply
      0
      • Naveen_DN Naveen_D

        Hello, can anyone please guide me to solve the above issue, Thanks

        Marco PellinM Offline
        Marco PellinM Offline
        Marco Pellin
        wrote on last edited by
        #3

        @Naveen_D
        Sorry, I didn't get much out of your question.
        That's what I understood so far:

        • you have two files called notificationBar.qml and MusicPlayer.qml
        • you load them both in your main.qml using two different Loader components
        • you have a label with text "AAAAA"
        • you have a Button used to enable the MusicPlayer and put it visibile
        • with the same click signal on the same button you want to change the label

        The problem is that you are not able to change the label by clicking on the button?
        Or what else?
        Could you please provide us some snippet of code?

        Naveen_DN 1 Reply Last reply
        0
        • Marco PellinM Marco Pellin

          @Naveen_D
          Sorry, I didn't get much out of your question.
          That's what I understood so far:

          • you have two files called notificationBar.qml and MusicPlayer.qml
          • you load them both in your main.qml using two different Loader components
          • you have a label with text "AAAAA"
          • you have a Button used to enable the MusicPlayer and put it visibile
          • with the same click signal on the same button you want to change the label

          The problem is that you are not able to change the label by clicking on the button?
          Or what else?
          Could you please provide us some snippet of code?

          Naveen_DN Offline
          Naveen_DN Offline
          Naveen_D
          wrote on last edited by
          #4

          @Marco-Pellin Thanks for the reply.

          ya exactly when i am making the music player visible with a click event i want to change the label to some other text. but the notificationBar.qml wil be already loaded so i am not able to change the label text.

          in main.qml i am loading both :

          Loader {
                  id: notificationBarLoader
                  visible: true
                  anchors.top: parent.top
                  anchors.left: parent.left
                  anchors.right: parent.right
                  active: true
                  source: notificationBarSource
                  onLoaded: {
                      if(item){
                        item.mainText= "Infotainment Solutions"
                      }
                  }
              }
          
          Loader {
                  id: musicContentLoader
                  visible: false
                  anchors.top: notificationBarLoader.bottom
                  active: false
                  source: musicplayerContentScreen
              }
          

          code where i am making the musicplayer visible with click event, here i have created an object of notificationBar.qml as notification:

          Commonrectangle{
                                  id:musicrectangle
                                  imageSource:"qrc:/images/music.png"
                                  MouseArea {
                                      id: musicmousearea
                                      anchors.fill: parent
                                      onClicked: {
                                          initialContentLoader.visible= false
                                          shortcuticonbarLoader.visible= true
                                          shortcuticonbarLoader.active= true
                                          musicContentLoader.active= true
                                          musicContentLoader.visible= true
          //                                notification.mainText= "Music Player"  // i tried to change the label text here but didn't work for me //
                                      }
                                  }
          

          Naveen_D

          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