diff options
Diffstat (limited to 'tests/manual/examples/quick/customdialogs/forms/ColorPicker.qml')
-rw-r--r-- | tests/manual/examples/quick/customdialogs/forms/ColorPicker.qml | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/manual/examples/quick/customdialogs/forms/ColorPicker.qml b/tests/manual/examples/quick/customdialogs/forms/ColorPicker.qml new file mode 100644 index 000000000..63269ddff --- /dev/null +++ b/tests/manual/examples/quick/customdialogs/forms/ColorPicker.qml @@ -0,0 +1,31 @@ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick + +ColorPickerForm { + property QtObject request + signal closeForm() + + okButton.onClicked: { + request.dialogAccept(colorPicker.color); + closeForm(); + } + + cancelButton.onClicked: { + request.dialogReject(); + closeForm(); + } + + function createCallback(color) { + return function() { colorPicker.color = color }; + } + + Component.onCompleted:{ + for (var i = 0; i < grid.children.length; i++) { + var cell = grid.children[i]; + cell.clicked.connect(createCallback(cell.color)); + } + colorPicker.color = request.color; + } +} |