Not entirely sure how to do this but:
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Window 2.0
import QtQuick.Controls.Styles 1.2
ApplicationWindow {
id: theGui
property int appHeight: theGui.height
objectName: "mainWindow"
visible: true
visibility: "Maximized"
title: qsTr("Map")
Repeater {
id: mapRepeater
model: mapModel
Rectangle { width: xSize * model.modelData.scale; height: ySize * model.modelData.scale
color: ((xIndex % 2 == 1 && yIndex % 2 == 0) || (xIndex % 2 == 0 && yIndex % 2 == 1)) && (xIndex < 90) ? "white" : "black"
x: xPos * model.modelData.scale
y: yPos * model.modelData.scale
Text { text: (yIndex == 10 || xIndex == 14) ? "" : "(" + xIndex + ", " + yIndex + ")"
anchors.right: parent.right
anchors.top: parent.top
font.pointSize: 25 * model.modelData.scale
color: (xIndex % 2 == 1 && yIndex % 2 == 0) || (xIndex % 2 == 0 && yIndex % 2 == 1) ? "black" : "white"
}
}
}
}
}
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Window 2.0
import QtQuick.Controls.Styles 1.2
ApplicationWindow {
id: theGui
property int appHeight: theGui.height
objectName: "mainWindow"
visible: true
visibility: "Maximized"
title: qsTr("Map")
Repeater {
id: mapRepeater
model: mapModel
Rectangle { width: xSize * model.modelData.scale; height: ySize * model.modelData.scale
color: ((xIndex % 2 == 1 && yIndex % 2 == 0) || (xIndex % 2 == 0 && yIndex % 2 == 1)) && (xIndex < 90) ? "white" : "black"
x: xPos * model.modelData.scale
y: yPos * model.modelData.scale
Text { text: (yIndex == 10 || xIndex == 14) ? "" : "(" + xIndex + ", " + yIndex + ")"
anchors.right: parent.right
anchors.top: parent.top
font.pointSize: 25 * model.modelData.scale
color: (xIndex % 2 == 1 && yIndex % 2 == 0) || (xIndex % 2 == 0 && yIndex % 2 == 1) ? "black" : "white"
}
}
}
}
}
To copy to clipboard, switch view to plain text mode
From the rectangle component of the Repeater how would I access the "ApplicationWindow" height (i.e. appHeight). I tried with global variables (Qt.appHeight) but couldn't get that to work.
Essentially I want the rectangle to be able to access the dimensions of the ApplicationWindow.
Thanks
Bookmarks