Add comments and use better variable names

This commit is contained in:
Matti Viljanen 2022-08-10 21:40:18 +03:00
parent 143d9b376a
commit 22ae3974a6
No known key found for this signature in database
GPG key ID: CF32A1495158F888

View file

@ -20,12 +20,12 @@ import Sailfish.Silica 1.0
import "../components" import "../components"
Page { Page {
id: logPage
allowedOrientations: Orientation.Portrait | Orientation.Landscape | Orientation.LandscapeInverted allowedOrientations: Orientation.Portrait | Orientation.Landscape | Orientation.LandscapeInverted
// Invisible; used to determine
// the ColumnView delegate size.
Label { Label {
id: labelMetrics id: metrics
text: "X" text: "X"
font.pixelSize: Theme.fontSizeTiny font.pixelSize: Theme.fontSizeTiny
opacity: 0 opacity: 0
@ -33,7 +33,7 @@ Page {
} }
SilicaFlickable { SilicaFlickable {
id: logFlickable id: flickable
anchors.fill: parent anchors.fill: parent
contentHeight: header.height contentHeight: header.height
+ flow.height + flow.height
@ -41,7 +41,7 @@ Page {
+ logView.height + logView.height
ScrollDecorator { ScrollDecorator {
flickable: logFlickable flickable: flickable
} }
PageHeader { PageHeader {
@ -49,6 +49,9 @@ Page {
title: qsTr("View log") title: qsTr("View log")
} }
// Layout the ComboBox and the buttons either
// on top each other (portait) or
// next to each other (landscape)
Flow { Flow {
id: flow id: flow
anchors.top: header.bottom anchors.top: header.bottom
@ -101,7 +104,7 @@ Page {
right: parent.right right: parent.right
leftMargin: Theme.horizontalPageMargin leftMargin: Theme.horizontalPageMargin
} }
itemHeight: labelMetrics.height itemHeight: metrics.height
clip: true clip: true
model: ListModel {} model: ListModel {}
delegate: Component { delegate: Component {
@ -131,6 +134,9 @@ Page {
} }
} }
} }
// ColumnView only instantiates and renders delegates
// as they are about to be shown, so we can
// simply dump the full log at it.
Component.onCompleted: updateText() Component.onCompleted: updateText()
property string text: "" property string text: ""
function updateText() { function updateText() {