diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-10-06 11:49:09 +0000 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-10-06 16:58:43 +0200 |
commit | 07840524085bd1785b8f9142b03d942f678c5c51 (patch) | |
tree | 499c1674fdd1b3e0c07688d8e4e56748dfea2ca3 /src/Authoring/Studio/Palettes/controls |
Initial import
Diffstat (limited to 'src/Authoring/Studio/Palettes/controls')
9 files changed, 623 insertions, 0 deletions
diff --git a/src/Authoring/Studio/Palettes/controls/BrowserCombo.qml b/src/Authoring/Studio/Palettes/controls/BrowserCombo.qml new file mode 100644 index 00000000..0e8bcb55 --- /dev/null +++ b/src/Authoring/Studio/Palettes/controls/BrowserCombo.qml @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.8 +import QtQuick.Controls 2.1 +import QtQuick.Layouts 1.3 + +MouseArea { + id: root + + property alias value: value.text + property var activeBrowser + property bool blockShow: false + + signal showBrowser + + Layout.minimumHeight: _controlBaseHeight + Layout.preferredWidth: _valueWidth + + onPressed: { + // Block showBrowser event on the mouse press that makes the browser lose focus + if (activeBrowser && activeBrowser.visible) { + activeBrowser = null; + blockShow = true + } else { + blockShow = false + } + } + + onClicked: { + if (!blockShow) + root.showBrowser() + } + + Rectangle { + anchors.fill: parent + + color: _studioColor2 + + StyledLabel { + id: value + anchors.fill: parent + horizontalAlignment: Text.AlignLeft + rightPadding: 6 + img.width + leftPadding: 6 + } + Image { + id: img + x: parent.width - sourceSize.width - 2 + y: (parent.height - sourceSize.height) / 2 + source: _resDir + "arrow_down.png" + } + } +} diff --git a/src/Authoring/Studio/Palettes/controls/FloatTextField.qml b/src/Authoring/Studio/Palettes/controls/FloatTextField.qml new file mode 100644 index 00000000..bea65443 --- /dev/null +++ b/src/Authoring/Studio/Palettes/controls/FloatTextField.qml @@ -0,0 +1,98 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Layouts 1.3 + +/* Use for: Position, Rotation, Scale, Pivot ... */ + +TextField { + id: floatTextFieldId + property alias decimalValue: validator.decimals + + signal wheelEventFinished + + selectByMouse: true + text: "0.000" + Layout.preferredWidth: _valueWidth / 2 + Layout.preferredHeight: _controlBaseHeight + + topPadding: 0 + bottomPadding: 0 + rightPadding: 6 + + horizontalAlignment: TextInput.AlignRight + verticalAlignment: TextInput.AlignVCenter + validator: DoubleValidator { + id: validator + decimals: 3 + locale: "C" + } + + selectionColor: _selectionColor + selectedTextColor: _textColor + font.pixelSize: _fontSize + color: _textColor + background: Rectangle { + color: floatTextFieldId.enabled ? _studioColor2 : "transparent" + border.width: floatTextFieldId.activeFocus ? 1 : 0 + border.color: floatTextFieldId.activeFocus ? _selectionColor : _disabledColor + } + + MouseArea { + property int _clickedPos + id: mouseAreaBaseId + + anchors.fill: parent + onPressed: { + parent.forceActiveFocus() + _clickedPos = parent.positionAt(mouse.x, mouse.y) + parent.cursorPosition = _clickedPos + } + onDoubleClicked: parent.selectAll() + onPositionChanged: { + parent.cursorPosition = parent.positionAt(mouse.x, mouse.y) + parent.select(_clickedPos, parent.cursorPosition) + } + + onWheel: { + if (!floatTextFieldId.activeFocus) { + wheel.accepted = false + return + } + if (wheel.angleDelta.y > 0) { + floatTextFieldId.text++ + } else { + floatTextFieldId.text-- + } + wheel.accepted=true + floatTextFieldId.wheelEventFinished(); + } + } +} diff --git a/src/Authoring/Studio/Palettes/controls/StyledComboBox.qml b/src/Authoring/Studio/Palettes/controls/StyledComboBox.qml new file mode 100644 index 00000000..ff079f41 --- /dev/null +++ b/src/Authoring/Studio/Palettes/controls/StyledComboBox.qml @@ -0,0 +1,155 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.3 +import QtQuick.Window 2.2 + +ComboBox { + id: control + Layout.preferredHeight: _controlBaseHeight + Layout.preferredWidth: _valueWidth + topPadding: 0 + bottomPadding: 0 + + delegate: ItemDelegate { + id: itemDelegate + + property bool hasSeparator: itemDelegate.text.endsWith("|separator") + + width: parent.width + height: hasSeparator ? _controlBaseHeight + 6 : _controlBaseHeight + padding: 0 + spacing: 0 + text: { + control.textRole ? (Array.isArray(control.model) ? modelData[control.textRole] + : model[control.textRole]) + : modelData + } + highlighted: control.highlightedIndex === index + hoverEnabled: control.hoverEnabled + contentItem: ColumnLayout { + anchors.fill: itemDelegate + spacing: 0 + Rectangle { + Layout.fillWidth: true + Layout.preferredHeight: 1 + color: _studioColor3 + visible: itemDelegate.hasSeparator + } + StyledLabel { + Layout.fillWidth: true + rightPadding: control.indicator.width + 6 + leftPadding: 6 + text: { + hasSeparator ? itemDelegate.text.replace("|separator", "") + : itemDelegate.text + } + visible: itemDelegate.text + horizontalAlignment: Text.AlignLeft + } + } + background: Rectangle { + anchors.fill: itemDelegate + color: hovered ? _selectionColor : _studioColor2 + } + } + + indicator: Image { + x: control.width - width - 2 + y: control.topPadding + (control.availableHeight - height) / 2 + source: _resDir + "arrow_down.png" + sourceSize.width: width + sourceSize.height: height + } + + contentItem: StyledTextField { + text: { + var newText = control.editable ? control.editText : control.displayText; + var hasSeparator = newText.endsWith("|separator"); + hasSeparator ? newText.replace("|separator", "") : newText; + } + + enabled: control.editable + autoScroll: control.editable + readOnly: control.popup.visible + inputMethodHints: control.inputMethodHints + validator: control.validator + opacity: 1 + leftPadding: 6 + horizontalAlignment: Text.AlignLeft + } + + background: Rectangle { + color: control.enabled ? _studioColor2 : "transparent" + border.width: 0 + } + + popup: Popup { + y: control.height + width: control.width + height: Math.min(contentItem.implicitHeight, + control.Window.height - topMargin - bottomMargin) + topMargin: 6 + bottomMargin: 6 + padding: 0 + + contentItem: ListView { + clip: true + implicitHeight: contentHeight + model: control.popup.visible ? control.delegateModel : null + currentIndex: control.highlightedIndex + highlightRangeMode: ListView.ApplyRange + highlightMoveDuration: 0 + ScrollIndicator.vertical: ScrollIndicator { + id: scrollIndicator + contentItem: Rectangle { + id: indicator + + implicitWidth: 2 + implicitHeight: 2 + + color: _studioColor3 + visible: scrollIndicator.size < 1.0 + opacity: 0.75 + } + } + Rectangle { + z: 10 + anchors.fill: parent + color: "transparent" + border.color: _studioColor3 + } + } + + background: Rectangle { + color: _studioColor2 + } + } +} diff --git a/src/Authoring/Studio/Palettes/controls/StyledLabel.qml b/src/Authoring/Studio/Palettes/controls/StyledLabel.qml new file mode 100644 index 00000000..02016069 --- /dev/null +++ b/src/Authoring/Studio/Palettes/controls/StyledLabel.qml @@ -0,0 +1,41 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Layouts 1.3 + +Label { + id: styledLabelId + font.pixelSize: _fontSize + color: _textColor + Layout.preferredHeight: _controlBaseHeight + Layout.preferredWidth: _idWidth + verticalAlignment: Text.AlignVCenter + clip: true +} diff --git a/src/Authoring/Studio/Palettes/controls/StyledMenuItem.qml b/src/Authoring/Studio/Palettes/controls/StyledMenuItem.qml new file mode 100644 index 00000000..361d5876 --- /dev/null +++ b/src/Authoring/Studio/Palettes/controls/StyledMenuItem.qml @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Layouts 1.3 + +MenuItem { + id: control + hoverEnabled: true + + contentItem: StyledLabel { + text: control.text + visible: control.text + horizontalAlignment: Text.AlignLeft + color: control.enabled ? _textColor : _disabledColor + } + background: Rectangle { + implicitWidth: _valueWidth + implicitHeight: _controlBaseHeight + color: control.hovered ? _selectionColor : _studioColor1 + } +} diff --git a/src/Authoring/Studio/Palettes/controls/StyledMenuSeparator.qml b/src/Authoring/Studio/Palettes/controls/StyledMenuSeparator.qml new file mode 100644 index 00000000..532fee2c --- /dev/null +++ b/src/Authoring/Studio/Palettes/controls/StyledMenuSeparator.qml @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.1 + +MenuSeparator { + id: control + padding: 0 + topPadding: 4 + bottomPadding: 4 + leftPadding: 0 + rightPadding: 0 + contentItem: Rectangle { + width: control.width + implicitWidth: control.parent.width - control.leftPadding - control.rightPadding + implicitHeight: 1 + color: _studioColor3 + } +} diff --git a/src/Authoring/Studio/Palettes/controls/StyledTextField.qml b/src/Authoring/Studio/Palettes/controls/StyledTextField.qml new file mode 100644 index 00000000..da621314 --- /dev/null +++ b/src/Authoring/Studio/Palettes/controls/StyledTextField.qml @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.1 +import QtQuick.Layouts 1.3 + +TextField { + id: styledTextFieldId + + property alias backgroundColor: textBackground.color + + Layout.preferredWidth: _valueWidth + Layout.preferredHeight: _controlBaseHeight + horizontalAlignment: TextInput.AlignRight + verticalAlignment: TextInput.AlignVCenter + + topPadding: 0 + bottomPadding: 0 + rightPadding: 6 + + selectByMouse: true + selectionColor: _selectionColor + selectedTextColor: _textColor + + font.pixelSize: _fontSize + color: _textColor + background: Rectangle { + id: textBackground + color: styledTextFieldId.enabled ? _studioColor2 : "transparent" + border.width: styledTextFieldId.activeFocus ? 1 : 0 + border.color: styledTextFieldId.activeFocus ? _selectionColor : _disabledColor + } +} diff --git a/src/Authoring/Studio/Palettes/controls/StyledToolButton.qml b/src/Authoring/Studio/Palettes/controls/StyledToolButton.qml new file mode 100644 index 00000000..51654331 --- /dev/null +++ b/src/Authoring/Studio/Palettes/controls/StyledToolButton.qml @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.1 + +ToolButton { + id: control + + property string enabledImage + property string disabledImage + property alias toolTipText: toolTip.text + + hoverEnabled: true + + StyledTooltip { + id: toolTip + visible: control.hovered + } + + background: Rectangle { + color: control.pressed ? _selectionColor : (hovered ? _studioColor1 : "transparent") + border.color: _studioColor1 + } + + contentItem: Image { + source: control.enabled ? _resDir + enabledImage : _resDir + disabledImage + } +} diff --git a/src/Authoring/Studio/Palettes/controls/StyledTooltip.qml b/src/Authoring/Studio/Palettes/controls/StyledTooltip.qml new file mode 100644 index 00000000..cae9c59f --- /dev/null +++ b/src/Authoring/Studio/Palettes/controls/StyledTooltip.qml @@ -0,0 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2017 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt 3D Studio. +** +** $QT_BEGIN_LICENSE:GPL-EXCEPT$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.6 +import QtQuick.Controls 2.1 + +ToolTip { + id: control + delay: 500 + contentItem: StyledLabel { + text: control.text + } + + background: Rectangle { + border.color: _studioColor3 + color: _studioColor2 + radius: 2 + } +} |