Qt World Summit: Register Today!

Moving camera or complete screen in QML

  • Greetings All,

    I am new in QML. I want to create a screen transition similar to Android home screen. For example on Android home screen there are total 3 or 5 home screens which can be changed by dragging your finger towards left or right. My question is

    Is this possible in QML
    Any pointer to start is highly appreciated.

    Best Regards,
    Farrukh Arshad.

  • Try with a ListView containing all the Pages you need on it, and add a Animation

  • Agreed. ListView (orientation: ListView.Horizontal) with possibly a VisualItemModel.
    Create each of your pages as a separate "delegate" in the model.

  • Thanks guys, This ListView + VisualItemModel does seems to provide what I am looking for. VisualItemModel also has a similar example. I will update the thread once I will implement it.

  • I have tried the ListView with ListViewModel and that is giving me what I want. An example is shown at this link as well


    My second question is that "Is it possible to dynamically change the orientation of the ListView" ?

    The reason is, I am trying to achieve screen scrolling at vertical as well as horizontal direction. What I want to achieve is that suppose I have three screens 1, 2, 3 & 3 more screens A, B, C. If I scroll in Horizontal (X direction) only the I should switch between 1,2,3 and if scroll in Vertical (Y direction) I should switch between A, B, C.

    From ListViewModel perspective I think I can place these 6 six screens in one model and depending on the index I can show what screen I want, but I can not seems to change orientation on the go (say I have calculated a line points in mouse movement and if the slope of the line is horizontal I decided to scroll in orientation = ListView.Horizontal and if the slope of the line is vertical I decide to scroll in orientation = ListView.Vertical.

    Does that seems to make sense. To simplify my question, Can I change orientation of ListView dynamically ?

    I have tried having two ListView both attached with their own ListViewModel (one for horizontal and one for vertical), and I hide and show respective ListView in my scroll movement, that does not seems to help either.

    Do you think this is possible at all ?

    Best Regards

  • Maybe you can put a ListBox for vertical srolling as item inside the listbox which scrolls horizontally. If you want to scroll vertical in each horizontal item, you have to put a vertical scrolling ListBox in each item of the horizontal scrolling ListBox. Have you tried using the GridView?

  • Thanks Rocken, Though in broken condition but this does seems to have potential to work. I have created a component of ListViewModel & ListView for horizontal scrolling, then created another ListViewModel & ListView for vertical scrolling. The vertical scrolling ListViewModel contains the component of horizontal scrolling ListView. Let me refine it then post the solution here.

    Again thanks.

Log in to reply