Eliminate elementsNb() function in main.qml
beroset opened this issue · comments
The current main.qml contains this code:
Flickable {
function elementsNb() {
var nb = 13;
if(DeviceInfo.hasSpeaker) nb ++
return nb;
}
contentHeight: elementsNb()*Dims.h(16) + (DeviceInfo.hasRoundScreen ? Dims.h(20) : 0)
The intent is to add some padding at the top (and the bottom, not shown) if it's a round screen. However, it uses a function elementsNb
which requires human programmers to count how many items are in the list, which is inherently fragile.
Better would be to use an approach which does not require accurate human counting, but lets the computer do that. This would make the code easier to maintain and probably easier to understand.