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. Multiple items qml
Qt 6.11 is out! See what's new in the release blog

Multiple items qml

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 2.3k Views 1 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.
  • M Offline
    M Offline
    mititelud
    wrote on last edited by
    #1

    hello,

    i've created a qml file named FileBrowser.qml which is an Item.
    in main.qml i created 4 FileBrowser items, but when I do something in a FileBrowser the rest are updating also.

    main.qml
    @
    Rectangle
    {
    id: main
    width: 1248
    height: 1024
    FileBrowser
    {
    id:fileBrowser1
    width:624
    height: 512
    }
    FileBrowser
    {
    id:fileBrowser2
    x:parent.width/2+1
    width:main.width/2
    height: main.height/2
    }
    FileBrowser
    {
    id:fileBrowser3
    x:parent.width/2+1
    y:parent.height/2+1
    width:main.width/2
    height: main.height/2
    }
    FileBrowser
    {
    id:fileBrowser4
    y:parent.height/2+1
    width:main.width/2
    height: main.height/2
    }
    }
    @

    what can i do so each filebrowser could be independent?

    :)

    1 Reply Last reply
    0
    • sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      Please define "when I do something".

      Normally, those 4 instances should be totally independent.

      (Z(:^

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mititelud
        wrote on last edited by
        #3

        for example when i open a folder, all filebrowsers open the same folder.

        the filebrowser uses 2 abstract list models.
        so....when i fill the main.qml with tons of filebrowsers...they shold be dynamicly created and independent of one another.
        how can i create a qml item dynamicly?

        filebrowser.qml is something like
        @
        Item
        {
        Component:myDelegate
        {
        //items of the first list
        }
        }

        Item
        {
        Component:otherDelegate
        {
        //items of the secondlist
        }
        }

        ListView
        {
        delegate:mydelegate
        model:mymodel
        }

        ListView
        {
        delegate:otherdelegate
        model:othermodel
        }
        @

        :)

        1 Reply Last reply
        0
        • sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          I still don't know how you open a folder and in what way you are populating the lists. Maybe you are using a Singleton for that? Or you are, by mistake, opening the same path on all browsers?

          (Z(:^

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mititelud
            wrote on last edited by
            #5

            the list are populated like this
            @
            QList<QFileInfo> m_list;
            m_list<<m_dir.entryInfoList(); //or any path
            @

            i don't think a singleton could work for what i'm trying to do.
            indeed, all browsers are opening the same path.

            :)

            1 Reply Last reply
            0
            • sierdzioS Offline
              sierdzioS Offline
              sierdzio
              Moderators
              wrote on last edited by
              #6

              Man, it's sure are hard to get relevant information from you.

              Where does this "m_dir" come from? How do you set it? Where? If you set it once in your C++ code, and then don't modify that path anywhere in QML (after the objects are instantiated), then that path will be the same for all instances.

              (Z(:^

              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