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. Possible to update/refresh Flow QML component when item has been removed?
Forum Updated to NodeBB v4.3 + New Features

Possible to update/refresh Flow QML component when item has been removed?

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 2.5k Views
  • 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.
  • P Offline
    P Offline
    Phataas
    wrote on 24 Jan 2017, 18:06 last edited by Phataas
    #1

    I have a Flow layout where I add items dynamically on user actions. In the same way I remove these items on user actions. The Flow QML component seems to work as expected until an item is removed. The item itself is removed, but the space it occupied is just blank. My intuition tells me the graphical item itself got deleted, but the view is not updating when items are removed.

    Is the dynamical deletion of child items outside the scope of the Flow Component? Is there any other layout that behaves equally? GridLayout seems to be the closest, but it does not automatically wrap child items when the layout is resized.

    Is there any non-hack way to enable Flow to rearrange when child item is disabled? If not, and if GridLayout is my best shot, how to make it wrap its child items like Flow does?

    R 1 Reply Last reply 25 Jan 2017, 07:24
    0
    • P Phataas
      24 Jan 2017, 18:06

      I have a Flow layout where I add items dynamically on user actions. In the same way I remove these items on user actions. The Flow QML component seems to work as expected until an item is removed. The item itself is removed, but the space it occupied is just blank. My intuition tells me the graphical item itself got deleted, but the view is not updating when items are removed.

      Is the dynamical deletion of child items outside the scope of the Flow Component? Is there any other layout that behaves equally? GridLayout seems to be the closest, but it does not automatically wrap child items when the layout is resized.

      Is there any non-hack way to enable Flow to rearrange when child item is disabled? If not, and if GridLayout is my best shot, how to make it wrap its child items like Flow does?

      R Offline
      R Offline
      Roumed
      wrote on 25 Jan 2017, 07:24 last edited by Roumed
      #2

      @Phataas

      If I understand you right, it is definitely not so for me.
      E.g. this works fine:
      Qt 5.7.1

      
      ListModel {
          id: mm
      }
      
      Flow {
          width: parent.width
          spacing: 10
      
          Repeater {
              model:mm
              delegate: Rectangle {
                  width: 100
                  height: 50
                  color: "grey"
              }
          }
      }
      
      Column {
          anchors.right: parent.right
      
          Button {
              text: "Add"
              onClicked: {
                  mm.insert(0, { "name": "Item " + mm.count })
              }
          }
      
          Button {
              text: "Remove"
              onClicked: {
                  mm.remove(1, 1)
              }
          }
      
          Button {
              text: "Move"
              onClicked: {
                  mm.move(1, 3, 1)
      
              }
          }
      }
      
      1 Reply Last reply
      0
      • P Offline
        P Offline
        Phataas
        wrote on 26 Jan 2017, 10:48 last edited by
        #3

        Roumed is correct as far as I can see. I also posted this question on StackOverflow.com and the answer provided there can be helpful as well: StackOverflow Question

        1 Reply Last reply
        0

        1/3

        24 Jan 2017, 18:06

        • Login

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