Skip to content

Instantly share code, notes, and snippets.

@Siecje Siecje/output.sh
Last active Dec 11, 2017

Embed
What would you like to do?
Complains about item already being in cell
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 0) already taken
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGridLayoutEngine::addItem: Cell (0, 1) already taken
QGridLayoutEngine::addItem: Cell (0, 1) already taken
import QtQuick 2.7
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.3 as Layouts
Item {
id: base
property var categories: ['one', 'two', 'three']
property var values: [1, 2, 3]
width: 800
height: 600
Column {
Button {
text: "Cause error output"
onClicked: {
base.categories = ['eleven', 'twelve']
base.values = [11, 12]
}
}
Button {
text: "DOES NOT Cause error output"
onClicked: {
base.categories = ['eleven']
base.values = [11]
}
}
}
Layouts.GridLayout {
anchors.fill: parent
columns: 2
// CATEGORY LABELS...
Repeater {
model: base.categories // modelData will be the categories
Item {
Layouts.Layout.row: index
Layouts.Layout.column: 0
Layouts.Layout.preferredWidth: _categoryLabel.width
Layouts.Layout.fillHeight: true
// The actual category label...
Text {
id: _categoryLabel
height: parent.height
anchors.right: parent.right
text: modelData
verticalAlignment: Text.AlignVCenter
font.pointSize: 27
leftPadding: 10
}
}
}
Repeater {
model: base.values // modelData will be the values
Item {
Layouts.Layout.row: index
Layouts.Layout.column: 1
Layouts.Layout.preferredWidth: _categoryLabel.width
Layouts.Layout.fillHeight: true
// The actual value label...
Text {
id: _categoryLabel
height: parent.height
anchors.right: parent.right
text: modelData
verticalAlignment: Text.AlignVCenter
font.pointSize: 27
leftPadding: 10
}
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.