diff --git a/share/qtcreator/qmldesigner/common/DesignerScrollViewStyle.qml b/share/qtcreator/qmldesigner/common/DesignerScrollViewStyle.qml index 0b21e2bbfb6..2cc16975b80 100644 --- a/share/qtcreator/qmldesigner/common/DesignerScrollViewStyle.qml +++ b/share/qtcreator/qmldesigner/common/DesignerScrollViewStyle.qml @@ -26,10 +26,11 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 +import QtQuickDesignerTheme 1.0 ScrollViewStyle { - readonly property color scrollbarColor: creatorTheme.BackgroundColorDark - readonly property color scrollBarHandleColor: creatorTheme.QmlDesignerButtonColor + readonly property color scrollbarColor: Theme.color(Theme.BackgroundColorDark) + readonly property color scrollBarHandleColor: Theme.qmlDesignerButtonColor() padding {left: 0; top: 0; right: 0; bottom: 0} @@ -52,6 +53,8 @@ ScrollViewStyle { corner: Item {} //Even if the platform style reports touch support a scrollview should not be flickable. - Component.onCompleted: control.flickableItem.interactive = false + Component.onCompleted: { + control.flickableItem.interactive = false + } transientScrollBars: false } diff --git a/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml b/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml index f7836ffdf5d..32c2f5a0c8f 100644 --- a/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml +++ b/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemDelegate.qml @@ -26,6 +26,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.0 +import QtQuickDesignerTheme 1.0 Item { Rectangle { @@ -33,7 +34,7 @@ Item { anchors.topMargin: 1 anchors.fill: parent - color: creatorTheme.QmlDesignerButtonColor + color: Theme.qmlDesignerButtonColor() Image { id: itemIcon // to be set by model @@ -64,7 +65,7 @@ Item { verticalAlignment: Qt.AlignVCenter horizontalAlignment: Qt.AlignHCenter text: itemName // to be set by model - color: creatorTheme.PanelTextColorLight + color: Theme.color(Theme.PanelTextColorLight) renderType: Text.NativeRendering } diff --git a/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml b/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml index ae427679f57..7a2061df131 100644 --- a/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml +++ b/share/qtcreator/qmldesigner/itemLibraryQmlSources/ItemsView.qml @@ -31,6 +31,7 @@ import "../common" import QtQuick.Layouts 1.0 import "../propertyEditorQmlSources/HelperWidgets" +import QtQuickDesignerTheme 1.0 /* The view displaying the item grid. @@ -64,8 +65,8 @@ ScrollView { Item { id: styleConstants - readonly property color backgroundColor: creatorTheme.QmlDesignerBackgroundColorDarkAlternate - readonly property color lighterBackgroundColor: creatorTheme.FancyToolBarSeparatorColor + readonly property color backgroundColor: Theme.qmlDesignerBackgroundColorDarkAlternate() + readonly property color lighterBackgroundColor: Theme.color(Theme.FancyToolBarSeparatorColor) property int textWidth: 58 property int textHeight: 22 diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml index 8b956fb6c40..8557552b535 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ButtonRowButton.qml @@ -27,6 +27,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 as Controls import QtQuick.Layouts 1.0 import QtQuick.Controls.Private 1.0 +import QtQuickDesignerTheme 1.0 Item { id: buttonRowButton @@ -68,7 +69,7 @@ Item { anchors.fill: parent visible: checked - color: creatorTheme.QmlDesignerBackgroundColorDarker + color: Theme.qmlDesignerBackgroundColorDarker() } RoundedPanel { @@ -76,7 +77,7 @@ Item { anchors.fill: parent visible: !checked - color: creatorTheme.QmlDesignerButtonColor + color: Theme.qmlDesignerButtonColor() } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorLogic.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorLogic.qml index f76a4becc45..97c03ea9215 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorLogic.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ColorLogic.qml @@ -26,21 +26,22 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 as Controls import QtQuick.Controls.Styles 1.0 +import QtQuickDesignerTheme 1.0 import "Constants.js" as Constants QtObject { id: innerObject property variant backendValue - property color textColor: creatorTheme.PanelTextColorLight + property color textColor: Theme.color(Theme.PanelTextColorLight) property variant valueFromBackend: backendValue.value; property bool baseStateFlag: isBaseState; property bool isInModel: backendValue.isInModel; property bool isInSubState: backendValue.isInSubState; property bool highlight: textColor === __changedTextColor - property color __defaultTextColor: creatorTheme.PanelTextColorLight - readonly property color __changedTextColor: creatorTheme.QmlDesigner_HighlightColor + property color __defaultTextColor: Theme.color(Theme.PanelTextColorLight) + readonly property color __changedTextColor: Theme.color(Theme.QmlDesigner_HighlightColor) onBackendValueChanged: { evaluate(); @@ -70,12 +71,12 @@ QtObject { if (innerObject.backendValue.isInModel) innerObject.textColor = __changedTextColor else - innerObject.textColor = creatorTheme.PanelTextColorLight + innerObject.textColor = Theme.color(Theme.PanelTextColorLight) } else { if (innerObject.backendValue.isInSubState) innerObject.textColor = Constants.colorsChangedStateText else - innerObject.textColor = creatorTheme.PanelTextColorLight + innerObject.textColor = Theme.color(Theme.PanelTextColorLight) } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomCheckBoxStyle.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomCheckBoxStyle.qml index b553c81d0d3..bb0759d3f35 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomCheckBoxStyle.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomCheckBoxStyle.qml @@ -26,6 +26,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 as Controls import QtQuick.Controls.Styles 1.1 +import QtQuickDesignerTheme 1.0 CheckBoxStyle { spacing: 24 @@ -36,9 +37,9 @@ CheckBoxStyle { Rectangle { anchors.fill: parent color: control.pressed - ? creatorTheme.FancyToolButtonHoverColor - : creatorTheme.FancyToolButtonSelectedColor - border.color: creatorTheme.QmlDesignerBorderColor + ? Theme.color(Theme.FancyToolButtonHoverColor) + : Theme.color(Theme.FancyToolButtonSelectedColor) + border.color: Theme.qmlDesignerBorderColor() anchors.margins: 1 } Image { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml index c335153de22..363ff65600c 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomComboBoxStyle.qml @@ -26,9 +26,10 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 as Controls import QtQuick.Controls.Styles 1.2 +import QtQuickDesignerTheme 1.0 ComboBoxStyle { - property color textColor: creatorTheme.PanelTextColorLight + property color textColor: Theme.color(Theme.PanelTextColorLight) __editor: Item { } @@ -42,16 +43,16 @@ ComboBoxStyle { Rectangle { anchors.fill: parent visible: !control.pressed - color: creatorTheme.QmlDesignerButtonColor - border.color: creatorTheme.QmlDesignerBorderColor + color: Theme.qmlDesignerButtonColor() + border.color: Theme.qmlDesignerBorderColor() border.width: 1 } Rectangle { - color: creatorTheme.QmlDesignerBackgroundColorDarker + color: Theme.qmlDesignerBackgroundColorDarker() anchors.fill: parent visible: control.pressed - border.color: creatorTheme.QmlDesignerBorderColor + border.color: Theme.qmlDesignerBorderColor() border.width: 1 } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomSpinBoxStyle.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomSpinBoxStyle.qml index 488634bccac..f0a808b1479 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomSpinBoxStyle.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/CustomSpinBoxStyle.qml @@ -26,10 +26,11 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 as Controls import QtQuick.Controls.Styles 1.1 +import QtQuickDesignerTheme 1.0 SpinBoxStyle { - selectionColor: creatorTheme.PanelTextColorLight - selectedTextColor: creatorTheme.PanelTextColorMid + selectionColor: Theme.color(Theme.PanelTextColorLight) + selectedTextColor: Theme.color(Theme.PanelTextColorMid) textColor: spinBox.textColor @@ -67,7 +68,7 @@ SpinBoxStyle { background: Rectangle { implicitWidth: Math.max(64, styleData.contentWidth) implicitHeight: 24 - color: creatorTheme.QmlDesignerBackgroundColorDarker - border.color: creatorTheme.QmlDesignerBorderColor + color: Theme.qmlDesignerBackgroundColorDarker() + border.color: Theme.qmlDesignerBorderColor() } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/DoubleSpinBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/DoubleSpinBox.qml index c80054b14ff..ca789fab43d 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/DoubleSpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/DoubleSpinBox.qml @@ -25,6 +25,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 +import QtQuickDesignerTheme 1.0 SpinBox { id: spinBox @@ -34,7 +35,7 @@ SpinBox { minimumValue: 0 maximumValue: 1 - property color textColor: creatorTheme.PanelTextColorLight + property color textColor: Theme.color(Theme.PanelTextColorLight) style: CustomSpinBoxStyle { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExpressionTextField.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExpressionTextField.qml index 441b648c0b5..697ec67adeb 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExpressionTextField.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExpressionTextField.qml @@ -27,6 +27,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 as Controls import QtQuick.Controls.Styles 1.1 import "Constants.js" as Constants +import QtQuickDesignerTheme 1.0 Controls.TextField { @@ -69,12 +70,12 @@ Controls.TextField { visible: textField.completionActive delegate: Text { text: modelData - color: creatorTheme.PanelTextColorLight + color: Theme.color(Theme.PanelTextColorLight) Rectangle { visible: index === listView.currentIndex z: -1 anchors.fill: parent - color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate + color: Theme.qmlDesignerBackgroundColorDarkAlternate() } } @@ -89,8 +90,8 @@ Controls.TextField { Rectangle { visible: textField.fixedSize anchors.fill: parent - color: creatorTheme.QmlDesignerBackgroundColorDarker - border.color: creatorTheme.QmlDesignerBorderColor + color: Theme.qmlDesignerBackgroundColorDarker() + border.color: Theme.qmlDesignerBorderColor() anchors.rightMargin: 12 z: -1 } @@ -165,17 +166,17 @@ Controls.TextField { } style: TextFieldStyle { - textColor: creatorTheme.PanelTextColorLight + textColor: Theme.color(Theme.PanelTextColorLight) padding.top: 6 padding.bottom: 2 padding.left: 6 - placeholderTextColor: creatorTheme.PanelTextColorMid + placeholderTextColor: Theme.color(Theme.PanelTextColorMid) background: Rectangle { implicitWidth: 100 implicitHeight: 23 radius: 2 - color: creatorTheme.QmlDesignerBackgroundColorDarker - border.color: creatorTheme.QmlDesignerBorderColor + color: Theme.qmlDesignerBackgroundColorDarker() + border.color: Theme.qmlDesignerBorderColor() } } @@ -199,8 +200,8 @@ Controls.TextField { Rectangle { z: -1 anchors.fill: parent - color: control.pressed || control.hovered ? creatorTheme.QmlDesignerBackgroundColorDarker : creatorTheme.QmlDesignerButtonColor - border.color: creatorTheme.QmlDesignerBorderColor + color: control.pressed || control.hovered ? Theme.qmlDesignerBackgroundColorDarker() : Theme.qmlDesignerButtonColor() + border.color: Theme.qmlDesignerBorderColor() radius: 2 } } @@ -225,8 +226,8 @@ Controls.TextField { Rectangle { z: -1 anchors.fill: parent - color: control.pressed || control.hovered ? creatorTheme.QmlDesignerBackgroundColorDarker : creatorTheme.QmlDesignerButtonColor - border.color: creatorTheme.QmlDesignerBorderColor + color: control.pressed || control.hovered ? Theme.qmlDesignerBackgroundColorDarker() : Theme.qmlDesignerButtonColor() + border.color: Theme.qmlDesignerBorderColor() radius: 2 } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExtendedFunctionButton.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExtendedFunctionButton.qml index bed14477620..82178c23a79 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExtendedFunctionButton.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/ExtendedFunctionButton.qml @@ -28,6 +28,7 @@ import QtQuick.Controls 1.0 as Controls import QtQuick.Window 2.0 import QtQuick.Controls.Styles 1.1 import "Constants.js" as Constants +import QtQuickDesignerTheme 1.0 Item { width: 14 @@ -184,7 +185,7 @@ Item { Rectangle { anchors.fill: parent - color: creatorTheme.QmlDesignerBackgroundColorDarker + color: Theme.qmlDesignerBackgroundColorDarker() opacity: 0.6 } @@ -205,8 +206,8 @@ Item { height: 260 radius: 2 - color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate - border.color: creatorTheme.QmlDesignerBorderColor + color: Theme.qmlDesignerBackgroundColorDarkAlternate() + border.color: Theme.qmlDesignerBorderColor() Label { x: 8 diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontSection.qml index f823a58ba8e..2af88020c6d 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/FontSection.qml @@ -27,6 +27,7 @@ import QtQuick 2.1 import HelperWidgets 2.0 import QtQuick.Layouts 1.0 import QtQuick.Controls 1.0 as Controls +import QtQuickDesignerTheme 1.0 Section { id: fontSection @@ -113,7 +114,7 @@ Section { Controls.ComboBox { id: sizeType model: ["pixels", "points"] - property color textColor: creatorTheme.PanelTextColorLight + property color textColor: Theme.color(Theme.PanelTextColorLight) onCurrentIndexChanged: { if (sizeWidget.isSetup) return; diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Label.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Label.qml index f58d2189aa1..8498f838ac6 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Label.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Label.qml @@ -27,6 +27,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 as Controls import QtQuick.Layouts 1.0 import QtQuick.Controls.Private 1.0 +import QtQuickDesignerTheme 1.0 Controls.Label { id: label @@ -36,7 +37,7 @@ Controls.Label { property alias toolTip: toolTipArea.tooltip width: Math.max(Math.min(240, parent.width - 220), 80) - color: creatorTheme.PanelTextColorLight + color: Theme.color(Theme.PanelTextColorLight) elide: Text.ElideRight Layout.preferredWidth: width diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml index 7073d01b5f9..aa62152eb0b 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/LineEdit.qml @@ -26,6 +26,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 as Controls import QtQuick.Controls.Styles 1.0 +import QtQuickDesignerTheme 1.0 Controls.TextField { @@ -119,10 +120,10 @@ Controls.TextField { style: TextFieldStyle { - selectionColor: creatorTheme.PanelTextColorLight - selectedTextColor: creatorTheme.PanelTextColorMid + selectionColor: Theme.color(Theme.PanelTextColorLight) + selectedTextColor: Theme.color(Theme.PanelTextColorMid) textColor: lineEdit.textColor - placeholderTextColor: creatorTheme.PanelTextColorMid + placeholderTextColor: Theme.color(Theme.PanelTextColorMid) padding.top: 2 padding.bottom: 2 @@ -131,8 +132,8 @@ Controls.TextField { background: Rectangle { implicitWidth: 100 implicitHeight: 24 - color: creatorTheme.QmlDesignerBackgroundColorDarker - border.color: creatorTheme.QmlDesignerBorderColor + color: Theme.qmlDesignerBackgroundColorDarker() + border.color: Theme.qmlDesignerBorderColor() } } @@ -185,8 +186,8 @@ Controls.TextField { y: 1 Rectangle { anchors.fill: parent - border.color: creatorTheme.QmlDesignerBorderColor - color: creatorTheme.QmlDesignerBackgroundColorDarker + border.color: Theme.qmlDesignerBorderColor() + color: Theme.qmlDesignerBackgroundColorDarker() opacity: control.hovered || control.pressed ? 1 : 0.75 } Image { diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/OriginControl.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/OriginControl.qml index 0aeaa9232a6..dab46aa0ce1 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/OriginControl.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/OriginControl.qml @@ -24,6 +24,7 @@ ****************************************************************************/ import QtQuick 2.1 +import QtQuickDesignerTheme 1.0 Item { width: grid.width @@ -33,12 +34,12 @@ Item { property variant backendValue property color borderColorSelected: colorLogic.textColor - property color borderColor: creatorTheme.QmlDesignerBorderColor + property color borderColor: Theme.qmlDesignerBorderColor() property bool showTranslateCheckBox: true - readonly property color selectedColor: creatorTheme.QmlDesignerBackgroundColorDarkAlternate - readonly property color unselectedColor: creatorTheme.QmlDesignerBackgroundColorDarker + readonly property color selectedColor: Theme.qmlDesignerBackgroundColorDarkAlternate() + readonly property color unselectedColor: Theme.qmlDesignerBackgroundColorDarker() ExtendedFunctionButton { backendValue: originControl.backendValue diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/RoundedPanel.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/RoundedPanel.qml index 2389de12f1e..5b9459804fd 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/RoundedPanel.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/RoundedPanel.qml @@ -26,6 +26,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 as Controls import QtQuick.Layouts 1.0 +import QtQuickDesignerTheme 1.0 Rectangle { id: panel @@ -43,8 +44,8 @@ Rectangle { */ border.width: roundLeft || roundRight ? 1 : 0 - color: creatorTheme.QmlDesignerButtonColor - border.color: creatorTheme.QmlDesignerBorderColor + color: Theme.qmlDesignerButtonColor() + border.color: Theme.qmlDesignerBorderColor() Rectangle { anchors.fill: parent @@ -71,7 +72,7 @@ Rectangle { } Rectangle { - color: creatorTheme.QmlDesignerBorderColor + color: Theme.qmlDesignerBorderColor() anchors.top: parent.top anchors.left: parent.left anchors.right: parent.right @@ -81,7 +82,7 @@ Rectangle { } Rectangle { - color: creatorTheme.QmlDesignerBorderColor + color: Theme.qmlDesignerBorderColor() anchors.bottom: parent.bottom anchors.left: parent.left anchors.right: parent.right diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml index 61224501acc..a4d01b64fe8 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/Section.qml @@ -26,6 +26,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.1 as Controls import QtQuick.Layouts 1.0 +import QtQuickDesignerTheme 1.0 Item { id: section @@ -50,7 +51,7 @@ Item { Controls.Label { id: label anchors.verticalCenter: parent.verticalCenter - color: creatorTheme.PanelTextColorLight + color: Theme.color(Theme.PanelTextColorLight) x: 22 font.bold: true } @@ -72,7 +73,7 @@ Item { } - color: creatorTheme.BackgroundColorDark + color: Theme.color(Theme.BackgroundColorDark) Rectangle { visible: false diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/TabView.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/TabView.qml index 7838ffc79a1..22c1923fad9 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/TabView.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/HelperWidgets/TabView.qml @@ -26,6 +26,7 @@ import QtQuick 2.1 import QtQuick.Controls 1.0 as Controls import QtQuick.Controls.Styles 1.1 +import QtQuickDesignerTheme 1.0 Controls.TabView { id: root @@ -35,7 +36,7 @@ Controls.TabView { frameOverlap: 0 frame: Item { } tab: Rectangle { - color: styleData.selected ? creatorTheme.QmlDesignerTabLight : creatorTheme.QmlDesignerTabDark + color: styleData.selected ? Theme.qmlDesignerTabLight() : Theme.qmlDesignerTabDark() implicitWidth: root.width/root.count + 2 implicitHeight: 28 Text { @@ -45,11 +46,11 @@ Controls.TabView { anchors.verticalCenterOffset: -1 text: styleData.title renderType: Text.NativeRendering - color: styleData.selected ? creatorTheme.QmlDesignerTabDark : creatorTheme.QmlDesignerTabLight + color: styleData.selected ? Theme.qmlDesignerTabDark() : Theme.qmlDesignerTabLight() } Rectangle { - color:creatorTheme.QmlDesignerTabLight + color:Theme.qmlDesignerTabLight() width: parent.width height: 4 anchors.bottom: parent.bottom diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnchorRow.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnchorRow.qml index 2e2446a03b4..567093359ce 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnchorRow.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/AnchorRow.qml @@ -27,6 +27,7 @@ import QtQuick 2.0 import HelperWidgets 2.0 import QtQuick.Layouts 1.0 import QtQuick.Controls 1.0 as Controls +import QtQuickDesignerTheme 1.0 RowLayout { id: anchorRow @@ -58,7 +59,7 @@ RowLayout { property alias buttonRow: buttonRow - readonly property color __defaultTextColor: creatorTheme.PanelTextColorLight + readonly property color __defaultTextColor: Theme.color(Theme.PanelTextColorLight) IconLabel { id: icon diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml index 0b5832796a6..5c7f0302a39 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/ItemPane.qml @@ -26,12 +26,13 @@ import QtQuick 2.0 import HelperWidgets 2.0 import QtQuick.Layouts 1.0 +import QtQuickDesignerTheme 1.0 Rectangle { id: itemPane width: 320 height: 400 - color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate + color: Theme.qmlDesignerBackgroundColorDarkAlternate() ScrollView { anchors.fill: parent diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml index 2581ab77f8e..c7e978a53ff 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/QtObjectPane.qml @@ -26,12 +26,13 @@ import QtQuick 2.0 import HelperWidgets 2.0 import QtQuick.Layouts 1.0 +import QtQuickDesignerTheme 1.0 Rectangle { id: itemPane width: 320 height: 400 - color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate + color: Theme.qmlDesignerBackgroundColorDarkAlternate() ScrollView { anchors.fill: parent diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TargetComboBox.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TargetComboBox.qml index f96b6304e5b..1e823bdeb02 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TargetComboBox.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TargetComboBox.qml @@ -27,11 +27,12 @@ import QtQuick 2.0 import HelperWidgets 2.0 import QtQuick.Layouts 1.0 import QtQuick.Controls 1.0 as Controls +import QtQuickDesignerTheme 1.0 Controls.ComboBox { property string targetName: anchorBackend.topTarget - property color textColor: creatorTheme.PanelTextColorLight + property color textColor: Theme.color(Theme.PanelTextColorLight) id: targetComboBox diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/emptyPane.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/emptyPane.qml index 0e74817de6f..abc99b429ee 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/emptyPane.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/emptyPane.qml @@ -25,12 +25,13 @@ import QtQuick 2.1 import HelperWidgets 2.0 +import QtQuickDesignerTheme 1.0 Rectangle { id: itemPane width: 320 height: 400 - color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate + color: Theme.qmlDesignerBackgroundColorDarkAlternate() Section { y: -1 diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/DesignerTextFieldStyle.qml b/share/qtcreator/qmldesigner/statesEditorQmlSources/DesignerTextFieldStyle.qml index 008c6e6392c..273614b1f07 100644 --- a/share/qtcreator/qmldesigner/statesEditorQmlSources/DesignerTextFieldStyle.qml +++ b/share/qtcreator/qmldesigner/statesEditorQmlSources/DesignerTextFieldStyle.qml @@ -26,12 +26,13 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 +import QtQuickDesignerTheme 1.0 TextFieldStyle { - selectionColor: creatorTheme.PanelTextColorLight - selectedTextColor: creatorTheme.PanelTextColorDark - textColor: creatorTheme.PanelTextColorLight - placeholderTextColor: creatorTheme.PanelTextColorMid + selectionColor: Theme.color(Theme.PanelTextColorLight) + selectedTextColor: Theme.color(Theme.PanelTextColorDark) + textColor: Theme.color(Theme.PanelTextColorLight) + placeholderTextColor: Theme.color(Theme.PanelTextColorMid) padding.top: 4 padding.bottom: 4 @@ -39,7 +40,7 @@ TextFieldStyle { background: Rectangle { implicitWidth: 100 implicitHeight: font.pixelSize + padding.top + padding.bottom - color: creatorTheme.FancyToolButtonSelectedColor - border.color: creatorTheme.QmlDesignerBackgroundColorDarker + color: Theme.color(Theme.FancyToolButtonSelectedColor) + border.color: Theme.qmlDesignerBackgroundColorDarker() } } diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml index b76c5155408..c4985ba9dff 100644 --- a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml +++ b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesDelegate.qml @@ -27,6 +27,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 import "../propertyEditorQmlSources/HelperWidgets" +import QtQuickDesignerTheme 1.0 Rectangle { z: expressionTextField.visible ? 5 : 0 @@ -41,7 +42,7 @@ Rectangle { property string delegateWhenConditionString color: baseColor - border.color: creatorTheme.QmlDesignerBorderColor + border.color: Theme.qmlDesignerBorderColor() function autoComplete(text, pos, explicitComplete, filter) { var stringList = statesEditorModel.autoComplete(text, pos, explicitComplete) @@ -174,7 +175,7 @@ Rectangle { anchors.margins: -1 anchors.fill: stateImage border.width: 1 - border.color: creatorTheme.QmlDesignerBackgroundColorDarker + border.color: Theme.qmlDesignerBackgroundColorDarker() } Image { id: stateImage diff --git a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesList.qml b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesList.qml index 5f28cc0ad01..a96db179e75 100644 --- a/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesList.qml +++ b/share/qtcreator/qmldesigner/statesEditorQmlSources/StatesList.qml @@ -27,6 +27,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Controls.Styles 1.1 import "../common" +import QtQuickDesignerTheme 1.0 FocusScope { id: root @@ -57,7 +58,7 @@ FocusScope { Rectangle { id: background anchors.fill: parent - color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate + color: Theme.qmlDesignerBackgroundColorDarkAlternate() } MouseArea { @@ -109,9 +110,9 @@ FocusScope { style: ButtonStyle { background: Rectangle { - property color buttonBaseColor: Qt.darker(creatorTheme.QmlDesignerBackgroundColorDarkAlternate, 1.1) + property color buttonBaseColor: Qt.darker(Theme.qmlDesignerBackgroundColorDarkAlternate(), 1.1) color: control.hovered ? Qt.lighter(buttonBaseColor, 1.2) : buttonBaseColor - border.color: creatorTheme.QmlDesignerBorderColor + border.color: Theme.qmlDesignerBorderColor() border.width: 1 Image { source: "image://icons/plus" @@ -148,7 +149,7 @@ FocusScope { height: delegateHeight isBaseState: 0 == internalNodeId isCurrentState: root.currentStateInternalId == internalNodeId - baseColor: isCurrentState ? creatorTheme.QmlDesigner_HighlightColor : background.color + baseColor: isCurrentState ? Theme.color(Theme.QmlDesigner_HighlightColor) : background.color delegateStateName: stateName delegateStateImageSource: stateImageSource delegateStateImageSize: stateImageSize diff --git a/src/plugins/qmldesigner/components/componentcore/componentcore.pri b/src/plugins/qmldesigner/components/componentcore/componentcore.pri index cab908f33cc..f2482dc289d 100644 --- a/src/plugins/qmldesigner/components/componentcore/componentcore.pri +++ b/src/plugins/qmldesigner/components/componentcore/componentcore.pri @@ -2,7 +2,7 @@ VPATH += $$PWD SOURCES += modelnodecontextmenu.cpp SOURCES += changestyleaction.cpp -SOURCES += theming.cpp +SOURCES += theme.cpp SOURCES += findimplementation.cpp SOURCES += addsignalhandlerdialog.cpp SOURCES += layoutingridlayout.cpp @@ -18,7 +18,7 @@ SOURCES += qmldesignericonprovider.cpp HEADERS += modelnodecontextmenu.h HEADERS += changestyleaction.h -HEADERS += theming.h +HEADERS += theme.h HEADERS += findimplementation.h HEADERS += addsignalhandlerdialog.h HEADERS += layoutingridlayout.h diff --git a/src/plugins/qmldesigner/components/componentcore/theme.cpp b/src/plugins/qmldesigner/components/componentcore/theme.cpp new file mode 100644 index 00000000000..fd7f321e22e --- /dev/null +++ b/src/plugins/qmldesigner/components/componentcore/theme.cpp @@ -0,0 +1,159 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#include "theme.h" +#include "qmldesignericonprovider.h" + +#include + +#include + +#include +#include +#include + +namespace { +QMap createDerivedDesignerColors() +{ + /* Define QmlDesigner colors and remove alpha channels */ + const QColor backgroundColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_BackgroundColor); + const QColor panelStatusBarBackgroundColor = Utils::creatorTheme()->color(Utils::Theme::PanelStatusBarBackgroundColor); + const QColor fancyToolButtonSelectedColor = Utils::creatorTheme()->color(Utils::Theme::FancyToolButtonSelectedColor); + const QColor darkerBackground = Utils::StyleHelper::alphaBlendedColors(panelStatusBarBackgroundColor, fancyToolButtonSelectedColor); + const QColor fancyToolButtonHoverColor = Utils::creatorTheme()->color(Utils::Theme::FancyToolButtonHoverColor); + const QColor buttonColor = Utils::StyleHelper::alphaBlendedColors(panelStatusBarBackgroundColor, fancyToolButtonHoverColor); + + QColor tabLight = Utils::creatorTheme()->color(Utils::Theme::PanelTextColorLight); + QColor tabDark = Utils::creatorTheme()->color(Utils::Theme::BackgroundColorDark); + + /* hack for light themes */ + /* The selected tab is always supposed to be lighter */ + if (tabDark.value() > tabLight.value()) { + tabLight = tabDark.darker(110); + tabDark = tabDark.darker(260); + } + return {{"QmlDesignerBackgroundColorDarker", darkerBackground}, + {"QmlDesignerBackgroundColorDarkAlternate", backgroundColor}, + {"QmlDesignerTabLight", tabLight}, + {"QmlDesignerTabDark", tabDark}, + {"QmlDesignerButtonColor", buttonColor}, + {"QmlDesignerBorderColor", Utils::creatorTheme()->color(Utils::Theme::SplitterColor)} + }; +} + +} // namespace + +namespace QmlDesigner { + +Theme::Theme(Utils::Theme *originTheme, QObject *parent) + : Utils::Theme(originTheme, parent) + , m_derivedColors(createDerivedDesignerColors()) +{ +} + +QColor Theme::evaluateColorAtThemeInstance(const QString &themeColorName) +{ + const QMetaObject &m = *metaObject(); + const QMetaEnum e = m.enumerator(m.indexOfEnumerator("Color")); + for (int i = 0, total = e.keyCount(); i < total; ++i) { + if (QString::fromLatin1(e.key(i)) == themeColorName) + return color(static_cast(i)).name(); + } + + qWarning() << "error while evaluate " << themeColorName; + return QColor(); +} + +Theme *Theme::instance() +{ + static QPointer qmldesignerTheme = + new Theme(Utils::creatorTheme(), QmlDesigner::QmlDesignerPlugin::instance()); + return qmldesignerTheme; +} + +QString Theme::replaceCssColors(const QString &input) +{ + const QMap &map = instance()->m_derivedColors; + QRegExp rx("creatorTheme\\.(\\w+);"); + + int pos = 0; + QString output = input; + + while ((pos = rx.indexIn(input, pos)) != -1) { + const QString themeColorName = rx.cap(1); + QColor color; + if (map.contains(themeColorName)) + color = map.value(themeColorName); + else + color = instance()->evaluateColorAtThemeInstance(themeColorName); + output.replace("creatorTheme." + rx.cap(1), color.name()); + pos += rx.matchedLength(); + } + + return output; +} + +void Theme::setupTheme(QQmlEngine *engine) +{ + static const int typeIndex = qmlRegisterSingletonType("QtQuickDesignerTheme", 1, 0, + "Theme", [](QQmlEngine *, QJSEngine *) { + return qobject_cast(new Theme(Utils::creatorTheme(), nullptr)); + }); + Q_UNUSED(typeIndex); + + engine->addImageProvider(QLatin1String("icons"), new QmlDesignerIconProvider()); +} + +QColor Theme::qmlDesignerBackgroundColorDarker() const +{ + return m_derivedColors.value("QmlDesignerBackgroundColorDarker"); +} + +QColor Theme::qmlDesignerBackgroundColorDarkAlternate() const +{ + return m_derivedColors.value("QmlDesignerBackgroundColorDarkAlternate"); +} + +QColor Theme::qmlDesignerTabLight() const +{ + return m_derivedColors.value("QmlDesignerTabLight"); +} + +QColor Theme::qmlDesignerTabDark() const +{ + return m_derivedColors.value("QmlDesignerTabDark"); +} + +QColor Theme::qmlDesignerButtonColor() const +{ + return m_derivedColors.value("QmlDesignerButtonColor"); +} + +QColor Theme::qmlDesignerBorderColor() const +{ + return m_derivedColors.value("QmlDesignerBorderColor"); +} + +} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/componentcore/theming.h b/src/plugins/qmldesigner/components/componentcore/theme.h similarity index 63% rename from src/plugins/qmldesigner/components/componentcore/theming.h rename to src/plugins/qmldesigner/components/componentcore/theme.h index d9a11ce7b53..cd8cce5ffa0 100644 --- a/src/plugins/qmldesigner/components/componentcore/theming.h +++ b/src/plugins/qmldesigner/components/componentcore/theme.h @@ -25,17 +25,37 @@ #pragma once -#include -#include +#include + +#include +#include + +QT_BEGIN_NAMESPACE +class QQmlEngine; +QT_END_NAMESPACE namespace QmlDesigner { -class Theming +class Theme : public Utils::Theme { + Q_OBJECT public: - static const QVariantMap &theme(); + static Theme *instance(); static QString replaceCssColors(const QString &input); - static void registerIconProvider(QQmlEngine *engine); + static void setupTheme(QQmlEngine *engine); + + Q_INVOKABLE QColor qmlDesignerBackgroundColorDarker() const; + Q_INVOKABLE QColor qmlDesignerBackgroundColorDarkAlternate() const; + Q_INVOKABLE QColor qmlDesignerTabLight() const; + Q_INVOKABLE QColor qmlDesignerTabDark() const; + Q_INVOKABLE QColor qmlDesignerButtonColor() const; + Q_INVOKABLE QColor qmlDesignerBorderColor() const; + +private: + Theme(Utils::Theme *originTheme, QObject *parent); + QColor evaluateColorAtThemeInstance(const QString &themeColorName); + + QMap m_derivedColors; }; } // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/componentcore/theming.cpp b/src/plugins/qmldesigner/components/componentcore/theming.cpp deleted file mode 100644 index e74a0561e86..00000000000 --- a/src/plugins/qmldesigner/components/componentcore/theming.cpp +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************** -** -** 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. -** -****************************************************************************/ - -#include "theming.h" -#include "qmldesignericonprovider.h" - -#include -#include - -#include - -namespace QmlDesigner { - -const QVariantMap &Theming::theme() -{ - static QVariantMap map; - if (!map.isEmpty()) - return map; - - map = Utils::creatorTheme()->values(); - - /* Define QmlDesigner colors and remove alpha channels */ - const QColor backgroundColor = Utils::creatorTheme()->color(Utils::Theme::QmlDesigner_BackgroundColor); - const QColor panelStatusBarBackgroundColor = Utils::creatorTheme()->color(Utils::Theme::PanelStatusBarBackgroundColor); - const QColor fancyToolButtonSelectedColor = Utils::creatorTheme()->color(Utils::Theme::FancyToolButtonSelectedColor); - const QColor darkerBackground = Utils::StyleHelper::alphaBlendedColors(panelStatusBarBackgroundColor, fancyToolButtonSelectedColor); - const QColor fancyToolButtonHoverColor = Utils::creatorTheme()->color(Utils::Theme::FancyToolButtonHoverColor); - const QColor buttonColor = Utils::StyleHelper::alphaBlendedColors(panelStatusBarBackgroundColor, fancyToolButtonHoverColor); - - Utils::creatorTheme()->color(Utils::Theme::PanelTextColorLight); - QColor tabLight = Utils::creatorTheme()->color(Utils::Theme::PanelTextColorLight); - QColor tabDark = Utils::creatorTheme()->color(Utils::Theme::BackgroundColorDark); - - /* hack for light themes */ - /* The selected tab is always supposed to be lighter */ - if (tabDark.value() > tabLight.value()) { - tabLight = tabDark.darker(110); - tabDark = tabDark.darker(260); - } - - map.insert("QmlDesignerBackgroundColorDarker", darkerBackground); - map.insert("QmlDesignerBackgroundColorDarkAlternate", backgroundColor); - map.insert("QmlDesignerTabLight", tabLight); - map.insert("QmlDesignerTabDark", tabDark); - map.insert("QmlDesignerButtonColor", buttonColor); - map.insert("QmlDesignerBorderColor", Utils::creatorTheme()->color(Utils::Theme::SplitterColor)); - return map; -} - -QString Theming::replaceCssColors(const QString &input) -{ - const QVariantMap &map = theme(); - QRegExp rx("creatorTheme\\.(\\w+);"); - - int pos = 0; - QString output = input; - - while ((pos = rx.indexIn(input, pos)) != -1) { - const QString color = rx.cap(1); - output.replace("creatorTheme." + rx.cap(1), map.value(color).toString()); - pos += rx.matchedLength(); - } - - return output; - -} - -void Theming::registerIconProvider(QQmlEngine *engine) -{ - engine->addImageProvider(QLatin1String("icons"), new QmlDesignerIconProvider()); -} - -} // namespace QmlDesigner diff --git a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp index 57c326b937e..582b6d0e07f 100644 --- a/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp +++ b/src/plugins/qmldesigner/components/formeditor/formeditorwidget.cpp @@ -32,7 +32,7 @@ #include "qmldesignericons.h" #include "viewmanager.h" #include -#include +#include #include #include @@ -59,7 +59,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) : QWidget(), m_formEditorView(view) { - setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/formeditorstylesheet.css"))))); + setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/formeditorstylesheet.css"))))); QVBoxLayout *fillLayout = new QVBoxLayout(this); fillLayout->setMargin(0); @@ -167,7 +167,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view) m_graphicsView = new FormEditorGraphicsView(this); fillLayout->addWidget(m_graphicsView.data()); - m_graphicsView.data()->setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); + m_graphicsView.data()->setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); } void FormEditorWidget::changeTransformTool(bool checked) diff --git a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp index 3aa5a0a216b..e4c7c5baf57 100644 --- a/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp +++ b/src/plugins/qmldesigner/components/itemlibrary/itemlibrarywidget.cpp @@ -27,7 +27,7 @@ #include "customfilesystemmodel.h" -#include +#include #include #include @@ -83,7 +83,6 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) : rootContext->setContextProperty(QStringLiteral("itemLibraryIconWidth"), m_itemIconSize.width()); rootContext->setContextProperty(QStringLiteral("itemLibraryIconHeight"), m_itemIconSize.height()); rootContext->setContextProperty(QStringLiteral("rootView"), this); - rootContext->setContextProperty(QLatin1String("creatorTheme"), Theming::theme()); m_itemViewQuickWidget->rootContext()->setContextProperty(QStringLiteral("highlightColor"), Utils::StyleHelper::notTooBrightHighlightColor()); @@ -93,7 +92,7 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) : /* create image provider for loading item icons */ m_itemViewQuickWidget->engine()->addImageProvider(QStringLiteral("qmldesigner_itemlibrary"), new Internal::ItemLibraryImageProvider); - Theming::registerIconProvider(m_itemViewQuickWidget->engine()); + Theme::setupTheme(m_itemViewQuickWidget->engine()); /* other widgets */ QTabBar *tabBar = new QTabBar(this); @@ -142,8 +141,8 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) : setSearchFilter(QString()); /* style sheets */ - setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/stylesheet.css"))))); - m_resourcesView->setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); + setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/stylesheet.css"))))); + m_resourcesView->setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F5), this); connect(m_qmlSourceUpdateShortcut, SIGNAL(activated()), this, SLOT(reloadQmlSource())); diff --git a/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp b/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp index 426b53cf380..d3b062b854c 100644 --- a/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp +++ b/src/plugins/qmldesigner/components/navigator/navigatorwidget.cpp @@ -27,7 +27,7 @@ #include "navigatorview.h" #include "qmldesignerconstants.h" #include "qmldesignericons.h" -#include +#include #include #include @@ -60,8 +60,8 @@ NavigatorWidget::NavigatorWidget(NavigatorView *view) : setWindowTitle(tr("Navigator", "Title of navigator view")); - setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/stylesheet.css"))))); - m_treeView->setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); + setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/stylesheet.css"))))); + m_treeView->setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); } void NavigatorWidget::setTreeModel(QAbstractItemModel* model) diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp index 0c13f54b573..41560014e4f 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorqmlbackend.cpp @@ -35,7 +35,7 @@ #include #include -#include +#include #include #include @@ -106,8 +106,6 @@ PropertyEditorQmlBackend::PropertyEditorQmlBackend(PropertyEditorView *propertyE m_contextObject->setModel(propertyEditor->model()); m_contextObject->insertInQmlContext(context()); - context()->setContextProperty(QLatin1String("creatorTheme"), Theming::theme()); - QObject::connect(&m_backendValuesPropertyMap, &DesignerPropertyMap::valueChanged, propertyEditor, &PropertyEditorView::changeValue); } diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp index 8c973533b51..14db61f8e32 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorview.cpp @@ -40,7 +40,7 @@ #include -#include +#include #include #include @@ -82,7 +82,7 @@ PropertyEditorView::PropertyEditorView(QWidget *parent) : m_updateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F3), m_stackedWidget); connect(m_updateShortcut, SIGNAL(activated()), this, SLOT(reloadQml())); - m_stackedWidget->setStyleSheet(Theming::replaceCssColors( + m_stackedWidget->setStyleSheet(Theme::replaceCssColors( QString::fromUtf8(Utils::FileReader::fetchQrc(QStringLiteral(":/qmldesigner/stylesheet.css"))))); m_stackedWidget->setMinimumWidth(320); m_stackedWidget->move(0, 0); diff --git a/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp b/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp index b567c6e7ae9..4e58374759e 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/quick2propertyeditorview.cpp @@ -29,7 +29,7 @@ #include "fileresourcesmodel.h" #include "gradientmodel.h" #include "qmlanchorbindingproxy.h" -#include "theming.h" +#include "theme.h" namespace QmlDesigner { @@ -37,7 +37,7 @@ Quick2PropertyEditorView::Quick2PropertyEditorView(QWidget *parent) : QQuickWidget(parent) { setResizeMode(QQuickWidget::SizeRootObjectToView); - Theming::registerIconProvider(engine()); + Theme::setupTheme(engine()); } void Quick2PropertyEditorView::registerQmlTypes() diff --git a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp index 828247b6f11..84550107876 100644 --- a/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp +++ b/src/plugins/qmldesigner/components/stateseditor/stateseditorwidget.cpp @@ -29,7 +29,7 @@ #include "stateseditorimageprovider.h" #include -#include +#include #include @@ -100,9 +100,7 @@ StatesEditorWidget::StatesEditorWidget(StatesEditorView *statesEditorView, State rootContext()->setContextProperty(QLatin1String("canAddNewStates"), true); - rootContext()->setContextProperty(QLatin1String("creatorTheme"), Theming::theme()); - - Theming::registerIconProvider(engine()); + Theme::setupTheme(engine()); setWindowTitle(tr("States", "Title of Editor widget")); diff --git a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp index cfbea84800f..646b43e47eb 100644 --- a/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp +++ b/src/plugins/qmldesigner/components/texteditor/texteditorwidget.cpp @@ -32,7 +32,7 @@ #include -#include +#include #include @@ -61,7 +61,7 @@ TextEditorWidget::TextEditorWidget(TextEditorView *textEditorView) m_updateSelectionTimer.setInterval(200); connect(&m_updateSelectionTimer, &QTimer::timeout, this, &TextEditorWidget::updateSelectionByCursorPosition); - setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); + setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); } void TextEditorWidget::setTextEditor(TextEditor::BaseTextEditor *textEditor) diff --git a/src/plugins/qmldesigner/designmodewidget.cpp b/src/plugins/qmldesigner/designmodewidget.cpp index 9da885fe03c..09f1d51cdd6 100644 --- a/src/plugins/qmldesigner/designmodewidget.cpp +++ b/src/plugins/qmldesigner/designmodewidget.cpp @@ -35,7 +35,7 @@ #include #include #include -#include +#include #include #include @@ -289,7 +289,7 @@ void DesignModeWidget::setup() QByteArray sheet = Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css"); sheet += Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css"); sheet += "QLabel { background-color: #4f4f4f; }"; - navigationView.widget->setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(sheet))); + navigationView.widget->setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(sheet))); } } @@ -484,7 +484,7 @@ static Core::MiniSplitter *createCentralSplitter(const QList &widget SwitchSplitTabWidget *switchSplitTabWidget = new SwitchSplitTabWidget(); QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/centerwidget.css")); - switchSplitTabWidget->setStyleSheet(Theming::replaceCssColors(sheet)); + switchSplitTabWidget->setStyleSheet(Theme::replaceCssColors(sheet)); foreach (const WidgetInfo &widgetInfo, widgetInfos) { diff --git a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.cpp b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.cpp index 30d1114f832..2ae56104951 100644 --- a/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.cpp +++ b/src/plugins/qmldesigner/qmldesignerextension/connectioneditor/connectionviewwidget.cpp @@ -32,7 +32,7 @@ #include "bindingmodel.h" #include "connectionmodel.h" #include "dynamicpropertiesmodel.h" -#include "theming.h" +#include "theme.h" #include #include @@ -56,7 +56,7 @@ ConnectionViewWidget::ConnectionViewWidget(QWidget *parent) : QStyle *style = QStyleFactory::create("fusion"); setStyle(style); - setStyleSheet(Theming::replaceCssColors(QLatin1String(Utils::FileReader::fetchQrc(QLatin1String(":/connectionview/stylesheet.css"))))); + setStyleSheet(Theme::replaceCssColors(QLatin1String(Utils::FileReader::fetchQrc(QLatin1String(":/connectionview/stylesheet.css"))))); //ui->tabWidget->tabBar()->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); @@ -69,16 +69,16 @@ ConnectionViewWidget::ConnectionViewWidget(QWidget *parent) : ui->tabBar->addTab(tr("Backends", "Title of dynamic properties view")); ui->tabBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); - ui->connectionView->setStyleSheet(Theming::replaceCssColors( + ui->connectionView->setStyleSheet(Theme::replaceCssColors( QLatin1String(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); - ui->bindingView->setStyleSheet(Theming::replaceCssColors( + ui->bindingView->setStyleSheet(Theme::replaceCssColors( QLatin1String(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); - ui->dynamicPropertiesView->setStyleSheet(Theming::replaceCssColors( + ui->dynamicPropertiesView->setStyleSheet(Theme::replaceCssColors( QLatin1String(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); - ui->backendView->setStyleSheet(Theming::replaceCssColors( + ui->backendView->setStyleSheet(Theme::replaceCssColors( QLatin1String(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); connect(ui->tabBar, SIGNAL(currentChanged(int)), diff --git a/src/plugins/qmldesigner/qmldesignerplugin.qbs b/src/plugins/qmldesigner/qmldesignerplugin.qbs index 63dc65b5de1..27473386b70 100644 --- a/src/plugins/qmldesigner/qmldesignerplugin.qbs +++ b/src/plugins/qmldesigner/qmldesignerplugin.qbs @@ -386,8 +386,8 @@ Project { "componentcore/findimplementation.h", "componentcore/layoutingridlayout.cpp", "componentcore/layoutingridlayout.h", - "componentcore/theming.cpp", - "componentcore/theming.h", + "componentcore/theme.cpp", + "componentcore/theme.h", "componentcore/modelnodecontextmenu.cpp", "componentcore/modelnodecontextmenu.h", "componentcore/modelnodecontextmenu_helper.cpp",