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
|
|
|
|
|
|
|
//! [0]
|
|
|
|
Rectangle {
|
|
|
|
id: photo // id on the first line makes it easy to find an object
|
|
|
|
|
|
|
|
property bool thumbnail: false // property declarations
|
|
|
|
property alias image: photoImage.source
|
|
|
|
|
|
|
|
signal clicked // signal declarations
|
|
|
|
|
|
|
|
function doSomething(x) // javascript functions
|
|
|
|
{
|
|
|
|
return x + photoImage.width
|
|
|
|
}
|
|
|
|
|
|
|
|
color: "gray" // object properties
|
2018-07-16 08:56:09 +00:00
|
|
|
x: 20 // try to group related properties together
|
|
|
|
y: 20
|
|
|
|
height: 150
|
2013-04-19 13:38:08 +00:00
|
|
|
width: { // large bindings
|
|
|
|
if (photoImage.width > 200) {
|
|
|
|
photoImage.width;
|
|
|
|
} else {
|
|
|
|
200;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-19 14:41:40 +00:00
|
|
|
states: [
|
|
|
|
State {
|
|
|
|
name: "selected"
|
|
|
|
PropertyChanges { target: border; color: "red" }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
transitions: [
|
|
|
|
Transition {
|
|
|
|
from: ""
|
|
|
|
to: "selected"
|
|
|
|
ColorAnimation { target: border; duration: 200 }
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
2013-04-19 13:38:08 +00:00
|
|
|
Rectangle { // child objects
|
|
|
|
id: border
|
|
|
|
anchors.centerIn: parent; color: "white"
|
|
|
|
|
2018-07-16 08:56:09 +00:00
|
|
|
Image {
|
|
|
|
id: photoImage
|
|
|
|
anchors.centerIn: parent
|
|
|
|
}
|
2013-04-19 13:38:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
//! [0]
|