1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
|
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtQuick.Controls
QtObject {
property var supportedStates: [
[],
["disabled"],
["pressed"],
["checkable", "checked"],
["checkable", "checked", "disabled"],
["checkable", "checked"],
["highlighted"],
["highlighted", "disabled"],
["highlighted", "pressed"],
["highlighted", "checkable"],
["highlighted", "checkable", "pressed"],
["highlighted", "checkable", "checked"],
["icon"],
["icon", "disabled"],
["icon", "pressed"],
["icon", "checkable", "checked"],
["icon", "checkable", "checked", "disabled"],
["icon", "checkable", "checked"],
["icon", "highlighted"],
["icon", "highlighted", "disabled"],
["icon", "highlighted", "pressed"],
["icon", "highlighted", "checkable"],
["icon", "highlighted", "checkable", "pressed"],
["icon", "highlighted", "checkable", "checked"],
["flat"],
["flat", "disabled"],
["flat", "pressed"],
["flat", "checkable"],
["flat", "checkable", "checked"],
["flat", "checkable", "pressed"],
["flat", "checkable", "checked", "pressed"],
["flat", "checkable", "highlighted"],
["flat", "checkable", "highlighted", "pressed"],
["flat", "checkable", "highlighted", "checked"],
["icon", "flat"],
["icon", "flat", "disabled"],
["icon", "flat", "pressed"],
["icon", "flat", "checkable"],
["icon", "flat", "checkable", "checked"],
["icon", "flat", "checkable", "pressed"],
["icon", "flat", "checkable", "checked", "pressed"],
["icon", "flat", "checkable", "highlighted"],
["icon", "flat", "checkable", "highlighted", "pressed"],
["icon", "flat", "checkable", "highlighted", "checked"]
]
property Component component: Button {
text: "Button"
enabled: !is("disabled")
flat: is("flat")
checkable: is("checkable")
checked: is("checked")
// Only set it if it's pressed, or the non-pressed examples will have no press effects
down: is("pressed") ? true : undefined
highlighted: is("highlighted")
icon.source: is("icon") ? "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/check.png" : ""
}
}
|