Warning, /maui/booth/src/widgets/CameraPropertyPopup.qml is written in an unsupported language. File is not indexed.
0001 /****************************************************************************
0002 **
0003 ** Copyright (C) 2017 The Qt Company Ltd.
0004 ** Contact: https://www.qt.io/licensing/
0005 **
0006 ** This file is part of the examples of the Qt Toolkit.
0007 **
0008 ** $QT_BEGIN_LICENSE:BSD$
0009 ** Commercial License Usage
0010 ** Licensees holding valid commercial Qt licenses may use this file in
0011 ** accordance with the commercial license agreement provided with the
0012 ** Software or, alternatively, in accordance with the terms contained in
0013 ** a written agreement between you and The Qt Company. For licensing terms
0014 ** and conditions see https://www.qt.io/terms-conditions. For further
0015 ** information use the contact form at https://www.qt.io/contact-us.
0016 **
0017 ** BSD License Usage
0018 ** Alternatively, you may use this file under the terms of the BSD license
0019 ** as follows:
0020 **
0021 ** "Redistribution and use in source and binary forms, with or without
0022 ** modification, are permitted provided that the following conditions are
0023 ** met:
0024 ** * Redistributions of source code must retain the above copyright
0025 ** notice, this list of conditions and the following disclaimer.
0026 ** * Redistributions in binary form must reproduce the above copyright
0027 ** notice, this list of conditions and the following disclaimer in
0028 ** the documentation and/or other materials provided with the
0029 ** distribution.
0030 ** * Neither the name of The Qt Company Ltd nor the names of its
0031 ** contributors may be used to endorse or promote products derived
0032 ** from this software without specific prior written permission.
0033 **
0034 **
0035 ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0036 ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0037 ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0038 ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0039 ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0040 ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0041 ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0042 ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0043 ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0044 ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0045 ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
0046 **
0047 ** $QT_END_LICENSE$
0048 **
0049 ****************************************************************************/
0050
0051 import QtQuick 2.0
0052
0053 Popup {
0054 id: propertyPopup
0055
0056 property alias model : view.model
0057 property variant currentValue
0058 property variant currentItem : model.get(view.currentIndex)
0059
0060 property int itemWidth : 100
0061 property int itemHeight : 70
0062 property int columns : 2
0063
0064 width: columns*itemWidth + view.anchors.margins*2
0065 height: Math.ceil(model.count/columns)*itemHeight + view.anchors.margins*2 + 25
0066
0067 signal selected
0068
0069 function indexForValue(value) {
0070 for (var i = 0; i < view.count; i++) {
0071 if (model.get(i).value == value) {
0072 return i;
0073 }
0074 }
0075
0076 return 0;
0077 }
0078
0079 GridView {
0080 id: view
0081 anchors.fill: parent
0082 anchors.margins: 5
0083 cellWidth: propertyPopup.itemWidth
0084 cellHeight: propertyPopup.itemHeight
0085 snapMode: ListView.SnapOneItem
0086 highlightFollowsCurrentItem: true
0087 highlight: Rectangle { color: "gray"; radius: 5 }
0088 currentIndex: indexForValue(propertyPopup.currentValue)
0089
0090 delegate: Item {
0091 width: propertyPopup.itemWidth
0092 height: 70
0093
0094 Image {
0095 anchors.centerIn: parent
0096 source: icon
0097 }
0098 MouseArea {
0099 anchors.fill: parent
0100 onClicked: {
0101 propertyPopup.currentValue = value
0102 propertyPopup.selected(value)
0103 }
0104 }
0105 }
0106 }
0107
0108 Text {
0109 anchors.bottom: parent.bottom
0110 anchors.bottomMargin: 8
0111 anchors.left: parent.left
0112 anchors.leftMargin: 16
0113
0114 color: "#ffffff"
0115 font.bold: true
0116 style: Text.Raised;
0117 styleColor: "black"
0118 font.pixelSize: 14
0119
0120 text: view.model.get(view.currentIndex).text
0121 }
0122 }