Centering of GridView and wrap around



  • Hi there,

    I'm quite new to QtQuick and experimenting a little bit for now. I have a GridView which displays nine Rectangles in a 3x3 matrix. As a default the middle element is set as active focus. Now I want to achieve two things (and really don't know how to do that):

    1. I want the Grid to be centered so that the focus item is always at the middle of my screen. Is there some easy way instead of doing this with a lot of Javascript and x and y shifting?

    2. I want to have a wrap around so that the elements which are out of screen i.e. at the left side reappear on the right side of my screen like this:

    1 2 3
    4 5 6
    7 8 9

    ->

    2 3 1
    5 6 4
    8 9 7

    That application only has to be controlled with keys...

    I'm really running out of ideas (which are quite few for now).

    Thanks in advance!



  • Hi,

    Do you use C++ and qml, or only QML.
    in the first case, you can just setGeometry(...
    in the second, i don't know.... but you can try the first environnement :)

    For ther second question, i cannot imagine something else than some code to write...



  • You could use Repeater for each set of GridView 3x3


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.