How to center a gridview in the parent element?
Solved
QML and Qt Quick
-
Hello.
I have a GridView and a model, but it looks ugly https://yadi.sk/i/lfrJRoCbqDV5k
Of course I can calculate values of the margins, may be is there a better way?import QtQuick 2.3 import QtQuick.Controls 1.2 ApplicationWindow { visible: true height: 480 width: 320 GridView { cellHeight: 120 cellWidth: 120 anchors.fill: parent anchors.centerIn: parent model: MenuModel{} delegate: delegate } }
-
Doing calculations is the best way. Please, see:
https://forum.qt.io/topic/64977/alignment-questions-for-qml-gridview