displaying multiple columns using grid view
Solved
QML and Qt Quick
-
Hey,
I'm having some trouble with the grid view component displaying multiple columns. What I'm trying to do is display 2 columns with each column taking up half of the display. This is sort of a newbie question, but I'm not able to find examples of this or documentation that describes what I'm trying to do.
Here's the code:
import QtQuick 2.5
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.2
import QtQuick.Dialogs 1.2ApplicationWindow {
id: mainWindow
visible: true
width: 640
height: 480
title: qsTr("Block Explorer")Component { id: gridComp Row { Column { Text { text: blocknum MouseArea { anchors.fill: parent onClicked: { list.currentIndex = index; var component = Qt.createComponent("qrc:/detail.qml") var window = component.createObject(mainWindow) window.show() mainWindow.hide() } } } } Column { Text { text: time } } } } GridView { id: list model: mc anchors.fill: parent cellWidth: parent.width; cellHeight: 15 delegate: gridComp highlight: Rectangle { color: 'grey' } focus: true Keys.onPressed: { var pageDown = currentIndex+10; var pageUp = currentIndex-10; if (event.key === Qt.Key_PageDown && event.modifiers === Qt.NoModifier) { currentIndex = pageDown >= count ? count-1 : pageDown; event.accepted = true; } if (event.key === Qt.Key_PageUp && event.modifiers === Qt.NoModifier) { currentIndex = pageUp < 0 ? 0 : pageUp; event.accepted = true; } } }
}
Thanks,
Ryan