2022-06-03 11:26:02 +00:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause
|
2013-04-19 13:38:08 +00:00
|
|
|
|
2020-12-01 13:13:32 +00:00
|
|
|
import QtQuick
|
2013-04-19 13:38:08 +00:00
|
|
|
|
|
|
|
Rectangle {
|
|
|
|
|
|
|
|
//![0]
|
2025-02-17 13:40:18 +00:00
|
|
|
Rectangle {
|
|
|
|
color: "blue"
|
|
|
|
width: parent.width / 3
|
|
|
|
}
|
2013-04-19 13:38:08 +00:00
|
|
|
//![0]
|
|
|
|
|
|
|
|
//![1]
|
|
|
|
Rectangle {
|
|
|
|
color: "blue"
|
|
|
|
width: {
|
2023-09-10 18:34:22 +00:00
|
|
|
var w = parent.width / 3;
|
|
|
|
console.debug(w);
|
|
|
|
return w;
|
2013-04-19 13:38:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//![1]
|
|
|
|
|
|
|
|
//![2]
|
2021-08-31 15:54:22 +00:00
|
|
|
function calculateWidth(object : Item) : double
|
2013-04-19 13:38:08 +00:00
|
|
|
{
|
2023-09-10 18:34:22 +00:00
|
|
|
var w = object.width / 3;
|
2013-04-19 13:38:08 +00:00
|
|
|
// ...
|
|
|
|
// more javascript code
|
|
|
|
// ...
|
2023-09-10 18:34:22 +00:00
|
|
|
console.debug(w);
|
|
|
|
return w;
|
2013-04-19 13:38:08 +00:00
|
|
|
}
|
|
|
|
|
2025-02-17 13:40:18 +00:00
|
|
|
Rectangle {
|
|
|
|
color: "blue"
|
|
|
|
width: calculateWidth(parent)
|
|
|
|
}
|
2013-04-19 13:38:08 +00:00
|
|
|
//![2]
|
|
|
|
}
|