diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ActionIndicator.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ActionIndicator.qml new file mode 100644 index 00000000000..8be58f0bed6 --- /dev/null +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ActionIndicator.qml @@ -0,0 +1,31 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of Qt Creator. +** +** 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. +** +****************************************************************************/ + +import QtQuick 2.1 +import StudioControls 1.0 as StudioControls +import QtQuick.Controls.Styles 1.1 + +StudioControls.ActionIndicator { +} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir index 007fb08d493..f72e226ba05 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir @@ -1,3 +1,4 @@ +ActionIndicator 2.0 ActionIndicator.qml AligmentHorizontalButtons 2.0 AligmentHorizontalButtons.qml AligmentVerticalButtons 2.0 AligmentVerticalButtons.qml AnchorButtons 2.0 AnchorButtons.qml diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml index c2a660228d1..6e4f44ae73e 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ActionIndicator.qml @@ -32,14 +32,14 @@ Rectangle { property Item myControl + property bool showBackground: true property alias icon: actionIndicatorIcon property bool hover: false property bool pressed: false - color: StudioTheme.Values.themeControlBackground - border.color: StudioTheme.Values.themeControlOutline - state: "default" + color: actionIndicator.showBackground ? StudioTheme.Values.themeControlBackground : "transparent" + border.color: actionIndicator.showBackground ? StudioTheme.Values.themeControlOutline : "transparent" implicitWidth: StudioTheme.Values.height implicitHeight: StudioTheme.Values.height @@ -55,6 +55,26 @@ Rectangle { font.pixelSize: StudioTheme.Values.myIconFontSize verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignHCenter + + states: [ + State { + name: "hovered" + when: actionIndicator.hover && !actionIndicator.pressed + && !myControl.edit && !myControl.drag && myControl.enabled + PropertyChanges { + target: actionIndicatorIcon + scale: 1.2 + } + }, + State { + name: "disabled" + when: !myControl.enabled + PropertyChanges { + target: actionIndicatorIcon + color: StudioTheme.Values.themeTextColorDisabled + } + } + ] } MouseArea { @@ -70,27 +90,18 @@ Rectangle { name: "default" when: myControl.enabled && !actionIndicator.hover && !actionIndicator.pressed && !myControl.hover - && !myControl.edit && !myControl.drag + && !myControl.edit && !myControl.drag && actionIndicator.showBackground PropertyChanges { target: actionIndicator color: StudioTheme.Values.themeControlBackground border.color: StudioTheme.Values.themeControlOutline } }, - State { - name: "hovered" - when: actionIndicator.hover && !actionIndicator.pressed - && !myControl.edit && !myControl.drag - PropertyChanges { - target: actionIndicatorIcon - scale: 1.2 - } - }, State { name: "globalHover" when: myControl.hover && !actionIndicator.hover && !actionIndicator.pressed && !myControl.edit - && !myControl.drag + && !myControl.drag && actionIndicator.showBackground PropertyChanges { target: actionIndicator color: StudioTheme.Values.themeHoverHighlight @@ -99,7 +110,7 @@ Rectangle { }, State { name: "edit" - when: myControl.edit + when: myControl.edit && actionIndicator.showBackground PropertyChanges { target: actionIndicator color: StudioTheme.Values.themeFocusEdit @@ -108,7 +119,7 @@ Rectangle { }, State { name: "drag" - when: myControl.drag + when: myControl.drag && actionIndicator.showBackground PropertyChanges { target: actionIndicator color: StudioTheme.Values.themeFocusDrag @@ -117,16 +128,12 @@ Rectangle { }, State { name: "disabled" - when: !myControl.enabled + when: !myControl.enabled && actionIndicator.showBackground PropertyChanges { target: actionIndicator color: StudioTheme.Values.themeControlBackgroundDisabled border.color: StudioTheme.Values.themeControlOutlineDisabled } - PropertyChanges { - target: actionIndicatorIcon - color: StudioTheme.Values.themeTextColorDisabled - } } ] } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml index 2f2ebb0541d..cbbf52972e0 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBox.qml @@ -87,7 +87,8 @@ T.ComboBox { color: StudioTheme.Values.themeControlOutline border.color: StudioTheme.Values.themeControlOutline border.width: StudioTheme.Values.border - width: myComboBox.width + x: actionIndicator.width - (actionIndicatorVisible ? StudioTheme.Values.border : 0) + width: myComboBox.width - actionIndicator.width height: myComboBox.height } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBoxInput.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBoxInput.qml index 2ea123f90d2..3485316c3e7 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBoxInput.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/ComboBoxInput.qml @@ -74,8 +74,8 @@ TextInput { if (myControl.popup.opened) { myControl.popup.close() } else { - myControl.popup.open() myControl.forceActiveFocus() + myControl.popup.open() } } else { textInput.forceActiveFocus() @@ -106,6 +106,10 @@ TextInput { color: StudioTheme.Values.themeControlBackground border.color: StudioTheme.Values.themeControlOutline } + PropertyChanges { + target: tapHandler + enabled: true + } PropertyChanges { target: mouseArea cursorShape: Qt.PointingHandCursor diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml index 3c1faec2d8c..d1d738efb4d 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBox.qml @@ -151,7 +151,8 @@ T.SpinBox { color: StudioTheme.Values.themeControlOutline border.color: StudioTheme.Values.themeControlOutline border.width: StudioTheme.Values.border - width: mySpinBox.width + x: actionIndicator.width - (actionIndicatorVisible ? StudioTheme.Values.border : 0) + width: mySpinBox.width - actionIndicator.width height: mySpinBox.height } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxIndicator.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxIndicator.qml index 3ff6b3b3e0f..7cebe1cd262 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxIndicator.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/RealSpinBoxIndicator.qml @@ -53,7 +53,7 @@ Rectangle { pressAndHoldTimer.stop() } - // This function is meant to synchronize enabled with realEnable to avoid + // This function is meant to synchronize enabled with realEnabled to avoid // the internal logic messing with the actual state. function invalidateEnabled() { spinBoxIndicator.enabled = spinBoxIndicator.realEnabled @@ -191,6 +191,14 @@ Rectangle { target: spinBoxIndicator color: StudioTheme.Values.themeFocusDrag } + }, + State { + name: "disabled" + when: !myControl.enabled + PropertyChanges { + target: spinBoxIndicator + color: StudioTheme.Values.themeControlBackgroundDisabled + } } ] } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/SpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/SpinBox.qml index c60e7002f26..60d35ac51f5 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/SpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/SpinBox.qml @@ -143,7 +143,8 @@ T.SpinBox { color: StudioTheme.Values.themeControlOutline border.color: StudioTheme.Values.themeControlOutline border.width: StudioTheme.Values.border - width: mySpinBox.width + x: actionIndicator.width - (actionIndicatorVisible ? StudioTheme.Values.border : 0) + width: mySpinBox.width - actionIndicator.width height: mySpinBox.height } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml index 80ca6fd1c7b..7c14e833b96 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioControls/TextField.qml @@ -58,9 +58,9 @@ T.TextField { persistentSelection: focus // QTBUG-73807 clip: true + width: StudioTheme.Values.height * 5 height: StudioTheme.Values.height implicitHeight: StudioTheme.Values.height - width: StudioTheme.Values.height * 5 leftPadding: StudioTheme.Values.inputHorizontalPadding + actionIndicator.width - (actionIndicatorVisible ? StudioTheme.Values.border : 0) @@ -108,7 +108,9 @@ T.TextField { color: StudioTheme.Values.themeControlBackground border.color: StudioTheme.Values.themeControlOutline border.width: StudioTheme.Values.border - anchors.fill: parent + x: actionIndicator.width - (actionIndicatorVisible ? StudioTheme.Values.border : 0) + width: myTextField.width - actionIndicator.width + height: myTextField.height } TranslationIndicator {