Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business

Forums

OverviewFelgo 3 Support (Qt 5) › Custom delegate in ListPag

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #16757

    Wojciech

    I have problem with passing data from model (it is simple array as in PropertyCross example) to custom delegate:

      delegate: Component {
          AppImage {
              source: item.image 
              width: parent.width/2
              height: 100
              fillMode:Image.PreserveAspectFit; clip:true
          }
      }

    item is not visible, image alone naither. How should I read values from array model?

    Regards,
    Wojciech

    #16759

    Günther
    Felgo Team

    Hi!

    The item property is only available with the SimpleRow delegate (we added it to make working with the model easier). For custom delegates, the usable identifier to access an array-model is modelData:

    model: [
    { image: "<image-path>" }
    ]
    delegate: Component {
      AppImage {
        source: modelData.image
        // ...
      }
    }

    Best,
    Günther

    #16762

    Wojciech

    Ok, thank you. Could you advice me how to make delegates to layout in two columns? Now the delegate components renders nice, but in rows: one under one, despite that I set their width for less than parent.width/2.

    I would like to show it in 2 (or more) colums as ‘float: left;’ layout for divs in html  – is it possible?

    #16763

    Günther
    Felgo Team

    Hi!

    It depends on what you are using to render your delegates. There are several QML types available for your layouts.

    For the AppListView, it is possible to define the list as horizontal or vertical with the AppListView::orientation property. You can also have look at other layout types like Row, Column or GridLayout.

    To dynamically fill e.g. a Row with Items based on a model/delegate, you can add a Repeater as a child, which in turn fills the row with dynamically created objects then.

    For more details about creating layouts in QML and available components, please have a look at the Qt docs and Felgo docs. You can also have a look at the code of all our app demos and examples to see how things are implemented there.

    Cheers,
    Günther

Viewing 4 posts - 1 through 4 (of 4 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded