Important: Please read the Qt Code of Conduct -

Add item outside of model to GridView

  • Hi,

    I use a GridView to display a model, which creates buttons. However, I need to add another item (a button of a different type, outside of the model, created in qml) to this GridView. Is this possible?

    I tried using a Grid as Child of a Flickable, but there I don't know how to make it snap to rows.

  • Qt Champions 2017

    Both can't be done. Now any reason you would like add the different button to view ? Can you tell us what you wanted to achieve ? It may help us give you solution with GridView itself.

  • Basically it is for controlling a machine via a touch screen. The machine has several programs. I have a model for these programs which I display through my own ProgramButton delegate in a GridView. As there are many programs, the GridView has several columns and rows and it is possible to flick through the columns. The design team demanded, that we also add some general buttons into the GridView which can perform other actions not related to the programs. The problem is, that these additional buttons have nothing in common with my ProgramButton, so incorporating them into the model seems like evil hacking.

    This is why a Grid would be appropriate. I could simply make a Repeater for my ProgramButtons and add the other buttons after the Repeater. But as I said, there I would have the problem of snapping

  • Qt Champions 2017

    When you say 'additional buttons', I'm assuming that all have similar characterstics. For this can try making the conditional delagates.

Log in to reply