QmlDesigner: introduce a real Theme class

- rename Theming -> Theme
 - made derived colors as Q_INVOKABLE methods available
 - rename registerIconProvider -> setupTheme
 - inside *.qml files use a singleton import instead of a context

Before this change, every request for a theme value copied the map into the
Qml context including the convert of values QVariant -> QJSString

Change-Id: I1c483fb591336b519d5adab8ad37b42bc5a06720
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Tim Jenssen
2017-03-07 16:06:02 +01:00
parent e6e71e385e
commit 1de5bbd378
41 changed files with 324 additions and 217 deletions

View File

@@ -26,10 +26,11 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import QtQuickDesignerTheme 1.0
ScrollViewStyle { ScrollViewStyle {
readonly property color scrollbarColor: creatorTheme.BackgroundColorDark readonly property color scrollbarColor: Theme.color(Theme.BackgroundColorDark)
readonly property color scrollBarHandleColor: creatorTheme.QmlDesignerButtonColor readonly property color scrollBarHandleColor: Theme.qmlDesignerButtonColor()
padding {left: 0; top: 0; right: 0; bottom: 0} padding {left: 0; top: 0; right: 0; bottom: 0}
@@ -52,6 +53,8 @@ ScrollViewStyle {
corner: Item {} corner: Item {}
//Even if the platform style reports touch support a scrollview should not be flickable. //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 transientScrollBars: false
} }

View File

@@ -26,6 +26,7 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
import QtQuickDesignerTheme 1.0
Item { Item {
Rectangle { Rectangle {
@@ -33,7 +34,7 @@ Item {
anchors.topMargin: 1 anchors.topMargin: 1
anchors.fill: parent anchors.fill: parent
color: creatorTheme.QmlDesignerButtonColor color: Theme.qmlDesignerButtonColor()
Image { Image {
id: itemIcon // to be set by model id: itemIcon // to be set by model
@@ -64,7 +65,7 @@ Item {
verticalAlignment: Qt.AlignVCenter verticalAlignment: Qt.AlignVCenter
horizontalAlignment: Qt.AlignHCenter horizontalAlignment: Qt.AlignHCenter
text: itemName // to be set by model text: itemName // to be set by model
color: creatorTheme.PanelTextColorLight color: Theme.color(Theme.PanelTextColorLight)
renderType: Text.NativeRendering renderType: Text.NativeRendering
} }

View File

@@ -31,6 +31,7 @@ import "../common"
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import "../propertyEditorQmlSources/HelperWidgets" import "../propertyEditorQmlSources/HelperWidgets"
import QtQuickDesignerTheme 1.0
/* The view displaying the item grid. /* The view displaying the item grid.
@@ -64,8 +65,8 @@ ScrollView {
Item { Item {
id: styleConstants id: styleConstants
readonly property color backgroundColor: creatorTheme.QmlDesignerBackgroundColorDarkAlternate readonly property color backgroundColor: Theme.qmlDesignerBackgroundColorDarkAlternate()
readonly property color lighterBackgroundColor: creatorTheme.FancyToolBarSeparatorColor readonly property color lighterBackgroundColor: Theme.color(Theme.FancyToolBarSeparatorColor)
property int textWidth: 58 property int textWidth: 58
property int textHeight: 22 property int textHeight: 22

View File

@@ -27,6 +27,7 @@ import QtQuick 2.1
import QtQuick.Controls 1.0 as Controls import QtQuick.Controls 1.0 as Controls
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Private 1.0
import QtQuickDesignerTheme 1.0
Item { Item {
id: buttonRowButton id: buttonRowButton
@@ -68,7 +69,7 @@ Item {
anchors.fill: parent anchors.fill: parent
visible: checked visible: checked
color: creatorTheme.QmlDesignerBackgroundColorDarker color: Theme.qmlDesignerBackgroundColorDarker()
} }
RoundedPanel { RoundedPanel {
@@ -76,7 +77,7 @@ Item {
anchors.fill: parent anchors.fill: parent
visible: !checked visible: !checked
color: creatorTheme.QmlDesignerButtonColor color: Theme.qmlDesignerButtonColor()
} }
} }

View File

@@ -26,21 +26,22 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.1 as Controls import QtQuick.Controls 1.1 as Controls
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
import QtQuickDesignerTheme 1.0
import "Constants.js" as Constants import "Constants.js" as Constants
QtObject { QtObject {
id: innerObject id: innerObject
property variant backendValue property variant backendValue
property color textColor: creatorTheme.PanelTextColorLight property color textColor: Theme.color(Theme.PanelTextColorLight)
property variant valueFromBackend: backendValue.value; property variant valueFromBackend: backendValue.value;
property bool baseStateFlag: isBaseState; property bool baseStateFlag: isBaseState;
property bool isInModel: backendValue.isInModel; property bool isInModel: backendValue.isInModel;
property bool isInSubState: backendValue.isInSubState; property bool isInSubState: backendValue.isInSubState;
property bool highlight: textColor === __changedTextColor property bool highlight: textColor === __changedTextColor
property color __defaultTextColor: creatorTheme.PanelTextColorLight property color __defaultTextColor: Theme.color(Theme.PanelTextColorLight)
readonly property color __changedTextColor: creatorTheme.QmlDesigner_HighlightColor readonly property color __changedTextColor: Theme.color(Theme.QmlDesigner_HighlightColor)
onBackendValueChanged: { onBackendValueChanged: {
evaluate(); evaluate();
@@ -70,12 +71,12 @@ QtObject {
if (innerObject.backendValue.isInModel) if (innerObject.backendValue.isInModel)
innerObject.textColor = __changedTextColor innerObject.textColor = __changedTextColor
else else
innerObject.textColor = creatorTheme.PanelTextColorLight innerObject.textColor = Theme.color(Theme.PanelTextColorLight)
} else { } else {
if (innerObject.backendValue.isInSubState) if (innerObject.backendValue.isInSubState)
innerObject.textColor = Constants.colorsChangedStateText innerObject.textColor = Constants.colorsChangedStateText
else else
innerObject.textColor = creatorTheme.PanelTextColorLight innerObject.textColor = Theme.color(Theme.PanelTextColorLight)
} }
} }

View File

@@ -26,6 +26,7 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.1 as Controls import QtQuick.Controls 1.1 as Controls
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import QtQuickDesignerTheme 1.0
CheckBoxStyle { CheckBoxStyle {
spacing: 24 spacing: 24
@@ -36,9 +37,9 @@ CheckBoxStyle {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: control.pressed color: control.pressed
? creatorTheme.FancyToolButtonHoverColor ? Theme.color(Theme.FancyToolButtonHoverColor)
: creatorTheme.FancyToolButtonSelectedColor : Theme.color(Theme.FancyToolButtonSelectedColor)
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
anchors.margins: 1 anchors.margins: 1
} }
Image { Image {

View File

@@ -26,9 +26,10 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.1 as Controls import QtQuick.Controls 1.1 as Controls
import QtQuick.Controls.Styles 1.2 import QtQuick.Controls.Styles 1.2
import QtQuickDesignerTheme 1.0
ComboBoxStyle { ComboBoxStyle {
property color textColor: creatorTheme.PanelTextColorLight property color textColor: Theme.color(Theme.PanelTextColorLight)
__editor: Item { __editor: Item {
} }
@@ -42,16 +43,16 @@ ComboBoxStyle {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
visible: !control.pressed visible: !control.pressed
color: creatorTheme.QmlDesignerButtonColor color: Theme.qmlDesignerButtonColor()
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
border.width: 1 border.width: 1
} }
Rectangle { Rectangle {
color: creatorTheme.QmlDesignerBackgroundColorDarker color: Theme.qmlDesignerBackgroundColorDarker()
anchors.fill: parent anchors.fill: parent
visible: control.pressed visible: control.pressed
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
border.width: 1 border.width: 1
} }

View File

@@ -26,10 +26,11 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.1 as Controls import QtQuick.Controls 1.1 as Controls
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import QtQuickDesignerTheme 1.0
SpinBoxStyle { SpinBoxStyle {
selectionColor: creatorTheme.PanelTextColorLight selectionColor: Theme.color(Theme.PanelTextColorLight)
selectedTextColor: creatorTheme.PanelTextColorMid selectedTextColor: Theme.color(Theme.PanelTextColorMid)
textColor: spinBox.textColor textColor: spinBox.textColor
@@ -67,7 +68,7 @@ SpinBoxStyle {
background: Rectangle { background: Rectangle {
implicitWidth: Math.max(64, styleData.contentWidth) implicitWidth: Math.max(64, styleData.contentWidth)
implicitHeight: 24 implicitHeight: 24
color: creatorTheme.QmlDesignerBackgroundColorDarker color: Theme.qmlDesignerBackgroundColorDarker()
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
} }
} }

View File

@@ -25,6 +25,7 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuickDesignerTheme 1.0
SpinBox { SpinBox {
id: spinBox id: spinBox
@@ -34,7 +35,7 @@ SpinBox {
minimumValue: 0 minimumValue: 0
maximumValue: 1 maximumValue: 1
property color textColor: creatorTheme.PanelTextColorLight property color textColor: Theme.color(Theme.PanelTextColorLight)
style: CustomSpinBoxStyle { style: CustomSpinBoxStyle {

View File

@@ -27,6 +27,7 @@ import QtQuick 2.1
import QtQuick.Controls 1.0 as Controls import QtQuick.Controls 1.0 as Controls
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import "Constants.js" as Constants import "Constants.js" as Constants
import QtQuickDesignerTheme 1.0
Controls.TextField { Controls.TextField {
@@ -69,12 +70,12 @@ Controls.TextField {
visible: textField.completionActive visible: textField.completionActive
delegate: Text { delegate: Text {
text: modelData text: modelData
color: creatorTheme.PanelTextColorLight color: Theme.color(Theme.PanelTextColorLight)
Rectangle { Rectangle {
visible: index === listView.currentIndex visible: index === listView.currentIndex
z: -1 z: -1
anchors.fill: parent anchors.fill: parent
color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate color: Theme.qmlDesignerBackgroundColorDarkAlternate()
} }
} }
@@ -89,8 +90,8 @@ Controls.TextField {
Rectangle { Rectangle {
visible: textField.fixedSize visible: textField.fixedSize
anchors.fill: parent anchors.fill: parent
color: creatorTheme.QmlDesignerBackgroundColorDarker color: Theme.qmlDesignerBackgroundColorDarker()
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
anchors.rightMargin: 12 anchors.rightMargin: 12
z: -1 z: -1
} }
@@ -165,17 +166,17 @@ Controls.TextField {
} }
style: TextFieldStyle { style: TextFieldStyle {
textColor: creatorTheme.PanelTextColorLight textColor: Theme.color(Theme.PanelTextColorLight)
padding.top: 6 padding.top: 6
padding.bottom: 2 padding.bottom: 2
padding.left: 6 padding.left: 6
placeholderTextColor: creatorTheme.PanelTextColorMid placeholderTextColor: Theme.color(Theme.PanelTextColorMid)
background: Rectangle { background: Rectangle {
implicitWidth: 100 implicitWidth: 100
implicitHeight: 23 implicitHeight: 23
radius: 2 radius: 2
color: creatorTheme.QmlDesignerBackgroundColorDarker color: Theme.qmlDesignerBackgroundColorDarker()
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
} }
} }
@@ -199,8 +200,8 @@ Controls.TextField {
Rectangle { Rectangle {
z: -1 z: -1
anchors.fill: parent anchors.fill: parent
color: control.pressed || control.hovered ? creatorTheme.QmlDesignerBackgroundColorDarker : creatorTheme.QmlDesignerButtonColor color: control.pressed || control.hovered ? Theme.qmlDesignerBackgroundColorDarker() : Theme.qmlDesignerButtonColor()
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
radius: 2 radius: 2
} }
} }
@@ -225,8 +226,8 @@ Controls.TextField {
Rectangle { Rectangle {
z: -1 z: -1
anchors.fill: parent anchors.fill: parent
color: control.pressed || control.hovered ? creatorTheme.QmlDesignerBackgroundColorDarker : creatorTheme.QmlDesignerButtonColor color: control.pressed || control.hovered ? Theme.qmlDesignerBackgroundColorDarker() : Theme.qmlDesignerButtonColor()
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
radius: 2 radius: 2
} }
} }

View File

@@ -28,6 +28,7 @@ import QtQuick.Controls 1.0 as Controls
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import "Constants.js" as Constants import "Constants.js" as Constants
import QtQuickDesignerTheme 1.0
Item { Item {
width: 14 width: 14
@@ -184,7 +185,7 @@ Item {
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
color: creatorTheme.QmlDesignerBackgroundColorDarker color: Theme.qmlDesignerBackgroundColorDarker()
opacity: 0.6 opacity: 0.6
} }
@@ -205,8 +206,8 @@ Item {
height: 260 height: 260
radius: 2 radius: 2
color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate color: Theme.qmlDesignerBackgroundColorDarkAlternate()
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
Label { Label {
x: 8 x: 8

View File

@@ -27,6 +27,7 @@ import QtQuick 2.1
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0 as Controls import QtQuick.Controls 1.0 as Controls
import QtQuickDesignerTheme 1.0
Section { Section {
id: fontSection id: fontSection
@@ -113,7 +114,7 @@ Section {
Controls.ComboBox { Controls.ComboBox {
id: sizeType id: sizeType
model: ["pixels", "points"] model: ["pixels", "points"]
property color textColor: creatorTheme.PanelTextColorLight property color textColor: Theme.color(Theme.PanelTextColorLight)
onCurrentIndexChanged: { onCurrentIndexChanged: {
if (sizeWidget.isSetup) if (sizeWidget.isSetup)
return; return;

View File

@@ -27,6 +27,7 @@ import QtQuick 2.1
import QtQuick.Controls 1.1 as Controls import QtQuick.Controls 1.1 as Controls
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls.Private 1.0 import QtQuick.Controls.Private 1.0
import QtQuickDesignerTheme 1.0
Controls.Label { Controls.Label {
id: label id: label
@@ -36,7 +37,7 @@ Controls.Label {
property alias toolTip: toolTipArea.tooltip property alias toolTip: toolTipArea.tooltip
width: Math.max(Math.min(240, parent.width - 220), 80) width: Math.max(Math.min(240, parent.width - 220), 80)
color: creatorTheme.PanelTextColorLight color: Theme.color(Theme.PanelTextColorLight)
elide: Text.ElideRight elide: Text.ElideRight
Layout.preferredWidth: width Layout.preferredWidth: width

View File

@@ -26,6 +26,7 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.1 as Controls import QtQuick.Controls 1.1 as Controls
import QtQuick.Controls.Styles 1.0 import QtQuick.Controls.Styles 1.0
import QtQuickDesignerTheme 1.0
Controls.TextField { Controls.TextField {
@@ -119,10 +120,10 @@ Controls.TextField {
style: TextFieldStyle { style: TextFieldStyle {
selectionColor: creatorTheme.PanelTextColorLight selectionColor: Theme.color(Theme.PanelTextColorLight)
selectedTextColor: creatorTheme.PanelTextColorMid selectedTextColor: Theme.color(Theme.PanelTextColorMid)
textColor: lineEdit.textColor textColor: lineEdit.textColor
placeholderTextColor: creatorTheme.PanelTextColorMid placeholderTextColor: Theme.color(Theme.PanelTextColorMid)
padding.top: 2 padding.top: 2
padding.bottom: 2 padding.bottom: 2
@@ -131,8 +132,8 @@ Controls.TextField {
background: Rectangle { background: Rectangle {
implicitWidth: 100 implicitWidth: 100
implicitHeight: 24 implicitHeight: 24
color: creatorTheme.QmlDesignerBackgroundColorDarker color: Theme.qmlDesignerBackgroundColorDarker()
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
} }
} }
@@ -185,8 +186,8 @@ Controls.TextField {
y: 1 y: 1
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
color: creatorTheme.QmlDesignerBackgroundColorDarker color: Theme.qmlDesignerBackgroundColorDarker()
opacity: control.hovered || control.pressed ? 1 : 0.75 opacity: control.hovered || control.pressed ? 1 : 0.75
} }
Image { Image {

View File

@@ -24,6 +24,7 @@
****************************************************************************/ ****************************************************************************/
import QtQuick 2.1 import QtQuick 2.1
import QtQuickDesignerTheme 1.0
Item { Item {
width: grid.width width: grid.width
@@ -33,12 +34,12 @@ Item {
property variant backendValue property variant backendValue
property color borderColorSelected: colorLogic.textColor property color borderColorSelected: colorLogic.textColor
property color borderColor: creatorTheme.QmlDesignerBorderColor property color borderColor: Theme.qmlDesignerBorderColor()
property bool showTranslateCheckBox: true property bool showTranslateCheckBox: true
readonly property color selectedColor: creatorTheme.QmlDesignerBackgroundColorDarkAlternate readonly property color selectedColor: Theme.qmlDesignerBackgroundColorDarkAlternate()
readonly property color unselectedColor: creatorTheme.QmlDesignerBackgroundColorDarker readonly property color unselectedColor: Theme.qmlDesignerBackgroundColorDarker()
ExtendedFunctionButton { ExtendedFunctionButton {
backendValue: originControl.backendValue backendValue: originControl.backendValue

View File

@@ -26,6 +26,7 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.0 as Controls import QtQuick.Controls 1.0 as Controls
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuickDesignerTheme 1.0
Rectangle { Rectangle {
id: panel id: panel
@@ -43,8 +44,8 @@ Rectangle {
*/ */
border.width: roundLeft || roundRight ? 1 : 0 border.width: roundLeft || roundRight ? 1 : 0
color: creatorTheme.QmlDesignerButtonColor color: Theme.qmlDesignerButtonColor()
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
@@ -71,7 +72,7 @@ Rectangle {
} }
Rectangle { Rectangle {
color: creatorTheme.QmlDesignerBorderColor color: Theme.qmlDesignerBorderColor()
anchors.top: parent.top anchors.top: parent.top
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
@@ -81,7 +82,7 @@ Rectangle {
} }
Rectangle { Rectangle {
color: creatorTheme.QmlDesignerBorderColor color: Theme.qmlDesignerBorderColor()
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right

View File

@@ -26,6 +26,7 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.1 as Controls import QtQuick.Controls 1.1 as Controls
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuickDesignerTheme 1.0
Item { Item {
id: section id: section
@@ -50,7 +51,7 @@ Item {
Controls.Label { Controls.Label {
id: label id: label
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: creatorTheme.PanelTextColorLight color: Theme.color(Theme.PanelTextColorLight)
x: 22 x: 22
font.bold: true font.bold: true
} }
@@ -72,7 +73,7 @@ Item {
} }
color: creatorTheme.BackgroundColorDark color: Theme.color(Theme.BackgroundColorDark)
Rectangle { Rectangle {
visible: false visible: false

View File

@@ -26,6 +26,7 @@
import QtQuick 2.1 import QtQuick 2.1
import QtQuick.Controls 1.0 as Controls import QtQuick.Controls 1.0 as Controls
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import QtQuickDesignerTheme 1.0
Controls.TabView { Controls.TabView {
id: root id: root
@@ -35,7 +36,7 @@ Controls.TabView {
frameOverlap: 0 frameOverlap: 0
frame: Item { } frame: Item { }
tab: Rectangle { tab: Rectangle {
color: styleData.selected ? creatorTheme.QmlDesignerTabLight : creatorTheme.QmlDesignerTabDark color: styleData.selected ? Theme.qmlDesignerTabLight() : Theme.qmlDesignerTabDark()
implicitWidth: root.width/root.count + 2 implicitWidth: root.width/root.count + 2
implicitHeight: 28 implicitHeight: 28
Text { Text {
@@ -45,11 +46,11 @@ Controls.TabView {
anchors.verticalCenterOffset: -1 anchors.verticalCenterOffset: -1
text: styleData.title text: styleData.title
renderType: Text.NativeRendering renderType: Text.NativeRendering
color: styleData.selected ? creatorTheme.QmlDesignerTabDark : creatorTheme.QmlDesignerTabLight color: styleData.selected ? Theme.qmlDesignerTabDark() : Theme.qmlDesignerTabLight()
} }
Rectangle { Rectangle {
color:creatorTheme.QmlDesignerTabLight color:Theme.qmlDesignerTabLight()
width: parent.width width: parent.width
height: 4 height: 4
anchors.bottom: parent.bottom anchors.bottom: parent.bottom

View File

@@ -27,6 +27,7 @@ import QtQuick 2.0
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0 as Controls import QtQuick.Controls 1.0 as Controls
import QtQuickDesignerTheme 1.0
RowLayout { RowLayout {
id: anchorRow id: anchorRow
@@ -58,7 +59,7 @@ RowLayout {
property alias buttonRow: buttonRow property alias buttonRow: buttonRow
readonly property color __defaultTextColor: creatorTheme.PanelTextColorLight readonly property color __defaultTextColor: Theme.color(Theme.PanelTextColorLight)
IconLabel { IconLabel {
id: icon id: icon

View File

@@ -26,12 +26,13 @@
import QtQuick 2.0 import QtQuick 2.0
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuickDesignerTheme 1.0
Rectangle { Rectangle {
id: itemPane id: itemPane
width: 320 width: 320
height: 400 height: 400
color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate color: Theme.qmlDesignerBackgroundColorDarkAlternate()
ScrollView { ScrollView {
anchors.fill: parent anchors.fill: parent

View File

@@ -26,12 +26,13 @@
import QtQuick 2.0 import QtQuick 2.0
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuickDesignerTheme 1.0
Rectangle { Rectangle {
id: itemPane id: itemPane
width: 320 width: 320
height: 400 height: 400
color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate color: Theme.qmlDesignerBackgroundColorDarkAlternate()
ScrollView { ScrollView {
anchors.fill: parent anchors.fill: parent

View File

@@ -27,11 +27,12 @@ import QtQuick 2.0
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0 as Controls import QtQuick.Controls 1.0 as Controls
import QtQuickDesignerTheme 1.0
Controls.ComboBox { Controls.ComboBox {
property string targetName: anchorBackend.topTarget property string targetName: anchorBackend.topTarget
property color textColor: creatorTheme.PanelTextColorLight property color textColor: Theme.color(Theme.PanelTextColorLight)
id: targetComboBox id: targetComboBox

View File

@@ -25,12 +25,13 @@
import QtQuick 2.1 import QtQuick 2.1
import HelperWidgets 2.0 import HelperWidgets 2.0
import QtQuickDesignerTheme 1.0
Rectangle { Rectangle {
id: itemPane id: itemPane
width: 320 width: 320
height: 400 height: 400
color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate color: Theme.qmlDesignerBackgroundColorDarkAlternate()
Section { Section {
y: -1 y: -1

View File

@@ -26,12 +26,13 @@
import QtQuick 2.2 import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import QtQuickDesignerTheme 1.0
TextFieldStyle { TextFieldStyle {
selectionColor: creatorTheme.PanelTextColorLight selectionColor: Theme.color(Theme.PanelTextColorLight)
selectedTextColor: creatorTheme.PanelTextColorDark selectedTextColor: Theme.color(Theme.PanelTextColorDark)
textColor: creatorTheme.PanelTextColorLight textColor: Theme.color(Theme.PanelTextColorLight)
placeholderTextColor: creatorTheme.PanelTextColorMid placeholderTextColor: Theme.color(Theme.PanelTextColorMid)
padding.top: 4 padding.top: 4
padding.bottom: 4 padding.bottom: 4
@@ -39,7 +40,7 @@ TextFieldStyle {
background: Rectangle { background: Rectangle {
implicitWidth: 100 implicitWidth: 100
implicitHeight: font.pixelSize + padding.top + padding.bottom implicitHeight: font.pixelSize + padding.top + padding.bottom
color: creatorTheme.FancyToolButtonSelectedColor color: Theme.color(Theme.FancyToolButtonSelectedColor)
border.color: creatorTheme.QmlDesignerBackgroundColorDarker border.color: Theme.qmlDesignerBackgroundColorDarker()
} }
} }

View File

@@ -27,6 +27,7 @@ import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import "../propertyEditorQmlSources/HelperWidgets" import "../propertyEditorQmlSources/HelperWidgets"
import QtQuickDesignerTheme 1.0
Rectangle { Rectangle {
z: expressionTextField.visible ? 5 : 0 z: expressionTextField.visible ? 5 : 0
@@ -41,7 +42,7 @@ Rectangle {
property string delegateWhenConditionString property string delegateWhenConditionString
color: baseColor color: baseColor
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
function autoComplete(text, pos, explicitComplete, filter) { function autoComplete(text, pos, explicitComplete, filter) {
var stringList = statesEditorModel.autoComplete(text, pos, explicitComplete) var stringList = statesEditorModel.autoComplete(text, pos, explicitComplete)
@@ -174,7 +175,7 @@ Rectangle {
anchors.margins: -1 anchors.margins: -1
anchors.fill: stateImage anchors.fill: stateImage
border.width: 1 border.width: 1
border.color: creatorTheme.QmlDesignerBackgroundColorDarker border.color: Theme.qmlDesignerBackgroundColorDarker()
} }
Image { Image {
id: stateImage id: stateImage

View File

@@ -27,6 +27,7 @@ import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import "../common" import "../common"
import QtQuickDesignerTheme 1.0
FocusScope { FocusScope {
id: root id: root
@@ -57,7 +58,7 @@ FocusScope {
Rectangle { Rectangle {
id: background id: background
anchors.fill: parent anchors.fill: parent
color: creatorTheme.QmlDesignerBackgroundColorDarkAlternate color: Theme.qmlDesignerBackgroundColorDarkAlternate()
} }
MouseArea { MouseArea {
@@ -109,9 +110,9 @@ FocusScope {
style: ButtonStyle { style: ButtonStyle {
background: Rectangle { 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 color: control.hovered ? Qt.lighter(buttonBaseColor, 1.2) : buttonBaseColor
border.color: creatorTheme.QmlDesignerBorderColor border.color: Theme.qmlDesignerBorderColor()
border.width: 1 border.width: 1
Image { Image {
source: "image://icons/plus" source: "image://icons/plus"
@@ -148,7 +149,7 @@ FocusScope {
height: delegateHeight height: delegateHeight
isBaseState: 0 == internalNodeId isBaseState: 0 == internalNodeId
isCurrentState: root.currentStateInternalId == internalNodeId isCurrentState: root.currentStateInternalId == internalNodeId
baseColor: isCurrentState ? creatorTheme.QmlDesigner_HighlightColor : background.color baseColor: isCurrentState ? Theme.color(Theme.QmlDesigner_HighlightColor) : background.color
delegateStateName: stateName delegateStateName: stateName
delegateStateImageSource: stateImageSource delegateStateImageSource: stateImageSource
delegateStateImageSize: stateImageSize delegateStateImageSize: stateImageSize

View File

@@ -2,7 +2,7 @@ VPATH += $$PWD
SOURCES += modelnodecontextmenu.cpp SOURCES += modelnodecontextmenu.cpp
SOURCES += changestyleaction.cpp SOURCES += changestyleaction.cpp
SOURCES += theming.cpp SOURCES += theme.cpp
SOURCES += findimplementation.cpp SOURCES += findimplementation.cpp
SOURCES += addsignalhandlerdialog.cpp SOURCES += addsignalhandlerdialog.cpp
SOURCES += layoutingridlayout.cpp SOURCES += layoutingridlayout.cpp
@@ -18,7 +18,7 @@ SOURCES += qmldesignericonprovider.cpp
HEADERS += modelnodecontextmenu.h HEADERS += modelnodecontextmenu.h
HEADERS += changestyleaction.h HEADERS += changestyleaction.h
HEADERS += theming.h HEADERS += theme.h
HEADERS += findimplementation.h HEADERS += findimplementation.h
HEADERS += addsignalhandlerdialog.h HEADERS += addsignalhandlerdialog.h
HEADERS += layoutingridlayout.h HEADERS += layoutingridlayout.h

View File

@@ -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 <qmldesignerplugin.h>
#include <utils/stylehelper.h>
#include <QRegExp>
#include <QPointer>
#include <qqml.h>
namespace {
QMap<QString, QColor> 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<Utils::Theme::Color>(i)).name();
}
qWarning() << "error while evaluate " << themeColorName;
return QColor();
}
Theme *Theme::instance()
{
static QPointer<Theme> qmldesignerTheme =
new Theme(Utils::creatorTheme(), QmlDesigner::QmlDesignerPlugin::instance());
return qmldesignerTheme;
}
QString Theme::replaceCssColors(const QString &input)
{
const QMap<QString, QColor> &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<Utils::Theme>("QtQuickDesignerTheme", 1, 0,
"Theme", [](QQmlEngine *, QJSEngine *) {
return qobject_cast<QObject*>(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

View File

@@ -25,17 +25,37 @@
#pragma once #pragma once
#include <QQmlEngine> #include <utils/theme/theme.h>
#include <QQmlPropertyMap>
#include <QColor>
#include <QMap>
QT_BEGIN_NAMESPACE
class QQmlEngine;
QT_END_NAMESPACE
namespace QmlDesigner { namespace QmlDesigner {
class Theming class Theme : public Utils::Theme
{ {
Q_OBJECT
public: public:
static const QVariantMap &theme(); static Theme *instance();
static QString replaceCssColors(const QString &input); 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<QString, QColor> m_derivedColors;
}; };
} // namespace QmlDesigner } // namespace QmlDesigner

View File

@@ -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 <utils/theme/theme.h>
#include <utils/stylehelper.h>
#include <QRegExp>
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

View File

@@ -32,7 +32,7 @@
#include "qmldesignericons.h" #include "qmldesignericons.h"
#include "viewmanager.h" #include "viewmanager.h"
#include <model.h> #include <model.h>
#include <theming.h> #include <theme.h>
#include <QWheelEvent> #include <QWheelEvent>
#include <QVBoxLayout> #include <QVBoxLayout>
@@ -59,7 +59,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
: QWidget(), : QWidget(),
m_formEditorView(view) 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); QVBoxLayout *fillLayout = new QVBoxLayout(this);
fillLayout->setMargin(0); fillLayout->setMargin(0);
@@ -167,7 +167,7 @@ FormEditorWidget::FormEditorWidget(FormEditorView *view)
m_graphicsView = new FormEditorGraphicsView(this); m_graphicsView = new FormEditorGraphicsView(this);
fillLayout->addWidget(m_graphicsView.data()); 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) void FormEditorWidget::changeTransformTool(bool checked)

View File

@@ -27,7 +27,7 @@
#include "customfilesystemmodel.h" #include "customfilesystemmodel.h"
#include <theming.h> #include <theme.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
#include <utils/qtcassert.h> #include <utils/qtcassert.h>
@@ -83,7 +83,6 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
rootContext->setContextProperty(QStringLiteral("itemLibraryIconWidth"), m_itemIconSize.width()); rootContext->setContextProperty(QStringLiteral("itemLibraryIconWidth"), m_itemIconSize.width());
rootContext->setContextProperty(QStringLiteral("itemLibraryIconHeight"), m_itemIconSize.height()); rootContext->setContextProperty(QStringLiteral("itemLibraryIconHeight"), m_itemIconSize.height());
rootContext->setContextProperty(QStringLiteral("rootView"), this); rootContext->setContextProperty(QStringLiteral("rootView"), this);
rootContext->setContextProperty(QLatin1String("creatorTheme"), Theming::theme());
m_itemViewQuickWidget->rootContext()->setContextProperty(QStringLiteral("highlightColor"), Utils::StyleHelper::notTooBrightHighlightColor()); m_itemViewQuickWidget->rootContext()->setContextProperty(QStringLiteral("highlightColor"), Utils::StyleHelper::notTooBrightHighlightColor());
@@ -93,7 +92,7 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
/* create image provider for loading item icons */ /* create image provider for loading item icons */
m_itemViewQuickWidget->engine()->addImageProvider(QStringLiteral("qmldesigner_itemlibrary"), new Internal::ItemLibraryImageProvider); m_itemViewQuickWidget->engine()->addImageProvider(QStringLiteral("qmldesigner_itemlibrary"), new Internal::ItemLibraryImageProvider);
Theming::registerIconProvider(m_itemViewQuickWidget->engine()); Theme::setupTheme(m_itemViewQuickWidget->engine());
/* other widgets */ /* other widgets */
QTabBar *tabBar = new QTabBar(this); QTabBar *tabBar = new QTabBar(this);
@@ -142,8 +141,8 @@ ItemLibraryWidget::ItemLibraryWidget(QWidget *parent) :
setSearchFilter(QString()); setSearchFilter(QString());
/* style sheets */ /* style sheets */
setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/stylesheet.css"))))); setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/stylesheet.css")))));
m_resourcesView->setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.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); m_qmlSourceUpdateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F5), this);
connect(m_qmlSourceUpdateShortcut, SIGNAL(activated()), this, SLOT(reloadQmlSource())); connect(m_qmlSourceUpdateShortcut, SIGNAL(activated()), this, SLOT(reloadQmlSource()));

View File

@@ -27,7 +27,7 @@
#include "navigatorview.h" #include "navigatorview.h"
#include "qmldesignerconstants.h" #include "qmldesignerconstants.h"
#include "qmldesignericons.h" #include "qmldesignericons.h"
#include <theming.h> #include <theme.h>
#include <QBoxLayout> #include <QBoxLayout>
#include <QToolButton> #include <QToolButton>
@@ -60,8 +60,8 @@ NavigatorWidget::NavigatorWidget(NavigatorView *view) :
setWindowTitle(tr("Navigator", "Title of navigator view")); setWindowTitle(tr("Navigator", "Title of navigator view"));
setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/stylesheet.css"))))); setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/stylesheet.css")))));
m_treeView->setStyleSheet(Theming::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css"))))); m_treeView->setStyleSheet(Theme::replaceCssColors(QString::fromUtf8(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css")))));
} }
void NavigatorWidget::setTreeModel(QAbstractItemModel* model) void NavigatorWidget::setTreeModel(QAbstractItemModel* model)

View File

@@ -35,7 +35,7 @@
#include <variantproperty.h> #include <variantproperty.h>
#include <bindingproperty.h> #include <bindingproperty.h>
#include <theming.h> #include <theme.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <qmljs/qmljssimplereader.h> #include <qmljs/qmljssimplereader.h>
@@ -106,8 +106,6 @@ PropertyEditorQmlBackend::PropertyEditorQmlBackend(PropertyEditorView *propertyE
m_contextObject->setModel(propertyEditor->model()); m_contextObject->setModel(propertyEditor->model());
m_contextObject->insertInQmlContext(context()); m_contextObject->insertInQmlContext(context());
context()->setContextProperty(QLatin1String("creatorTheme"), Theming::theme());
QObject::connect(&m_backendValuesPropertyMap, &DesignerPropertyMap::valueChanged, propertyEditor, &PropertyEditorView::changeValue); QObject::connect(&m_backendValuesPropertyMap, &DesignerPropertyMap::valueChanged, propertyEditor, &PropertyEditorView::changeValue);
} }

View File

@@ -40,7 +40,7 @@
#include <nodeabstractproperty.h> #include <nodeabstractproperty.h>
#include <theming.h> #include <theme.h>
#include <coreplugin/icore.h> #include <coreplugin/icore.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
@@ -82,7 +82,7 @@ PropertyEditorView::PropertyEditorView(QWidget *parent) :
m_updateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F3), m_stackedWidget); m_updateShortcut = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_F3), m_stackedWidget);
connect(m_updateShortcut, SIGNAL(activated()), this, SLOT(reloadQml())); 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"))))); QString::fromUtf8(Utils::FileReader::fetchQrc(QStringLiteral(":/qmldesigner/stylesheet.css")))));
m_stackedWidget->setMinimumWidth(320); m_stackedWidget->setMinimumWidth(320);
m_stackedWidget->move(0, 0); m_stackedWidget->move(0, 0);

View File

@@ -29,7 +29,7 @@
#include "fileresourcesmodel.h" #include "fileresourcesmodel.h"
#include "gradientmodel.h" #include "gradientmodel.h"
#include "qmlanchorbindingproxy.h" #include "qmlanchorbindingproxy.h"
#include "theming.h" #include "theme.h"
namespace QmlDesigner { namespace QmlDesigner {
@@ -37,7 +37,7 @@ Quick2PropertyEditorView::Quick2PropertyEditorView(QWidget *parent) :
QQuickWidget(parent) QQuickWidget(parent)
{ {
setResizeMode(QQuickWidget::SizeRootObjectToView); setResizeMode(QQuickWidget::SizeRootObjectToView);
Theming::registerIconProvider(engine()); Theme::setupTheme(engine());
} }
void Quick2PropertyEditorView::registerQmlTypes() void Quick2PropertyEditorView::registerQmlTypes()

View File

@@ -29,7 +29,7 @@
#include "stateseditorimageprovider.h" #include "stateseditorimageprovider.h"
#include <designersettings.h> #include <designersettings.h>
#include <theming.h> #include <theme.h>
#include <invalidqmlsourceexception.h> #include <invalidqmlsourceexception.h>
@@ -100,9 +100,7 @@ StatesEditorWidget::StatesEditorWidget(StatesEditorView *statesEditorView, State
rootContext()->setContextProperty(QLatin1String("canAddNewStates"), true); rootContext()->setContextProperty(QLatin1String("canAddNewStates"), true);
rootContext()->setContextProperty(QLatin1String("creatorTheme"), Theming::theme()); Theme::setupTheme(engine());
Theming::registerIconProvider(engine());
setWindowTitle(tr("States", "Title of Editor widget")); setWindowTitle(tr("States", "Title of Editor widget"));

View File

@@ -32,7 +32,7 @@
#include <qmldesignerplugin.h> #include <qmldesignerplugin.h>
#include <theming.h> #include <theme.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
@@ -61,7 +61,7 @@ TextEditorWidget::TextEditorWidget(TextEditorView *textEditorView)
m_updateSelectionTimer.setInterval(200); m_updateSelectionTimer.setInterval(200);
connect(&m_updateSelectionTimer, &QTimer::timeout, this, &TextEditorWidget::updateSelectionByCursorPosition); 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) void TextEditorWidget::setTextEditor(TextEditor::BaseTextEditor *textEditor)

View File

@@ -35,7 +35,7 @@
#include <texteditor/textdocument.h> #include <texteditor/textdocument.h>
#include <nodeinstanceview.h> #include <nodeinstanceview.h>
#include <itemlibrarywidget.h> #include <itemlibrarywidget.h>
#include <theming.h> #include <theme.h>
#include <coreplugin/outputpane.h> #include <coreplugin/outputpane.h>
#include <coreplugin/modemanager.h> #include <coreplugin/modemanager.h>
@@ -289,7 +289,7 @@ void DesignModeWidget::setup()
QByteArray sheet = Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css"); QByteArray sheet = Utils::FileReader::fetchQrc(":/qmldesigner/stylesheet.css");
sheet += Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css"); sheet += Utils::FileReader::fetchQrc(":/qmldesigner/scrollbar.css");
sheet += "QLabel { background-color: #4f4f4f; }"; 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<WidgetInfo> &widget
SwitchSplitTabWidget *switchSplitTabWidget = new SwitchSplitTabWidget(); SwitchSplitTabWidget *switchSplitTabWidget = new SwitchSplitTabWidget();
QString sheet = QString::fromUtf8(Utils::FileReader::fetchQrc(":/qmldesigner/centerwidget.css")); 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) { foreach (const WidgetInfo &widgetInfo, widgetInfos) {

View File

@@ -32,7 +32,7 @@
#include "bindingmodel.h" #include "bindingmodel.h"
#include "connectionmodel.h" #include "connectionmodel.h"
#include "dynamicpropertiesmodel.h" #include "dynamicpropertiesmodel.h"
#include "theming.h" #include "theme.h"
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <utils/fileutils.h> #include <utils/fileutils.h>
@@ -56,7 +56,7 @@ ConnectionViewWidget::ConnectionViewWidget(QWidget *parent) :
QStyle *style = QStyleFactory::create("fusion"); QStyle *style = QStyleFactory::create("fusion");
setStyle(style); 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); //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->addTab(tr("Backends", "Title of dynamic properties view"));
ui->tabBar->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::Fixed); 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"))))); 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"))))); 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"))))); 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"))))); QLatin1String(Utils::FileReader::fetchQrc(QLatin1String(":/qmldesigner/scrollbar.css")))));
connect(ui->tabBar, SIGNAL(currentChanged(int)), connect(ui->tabBar, SIGNAL(currentChanged(int)),

View File

@@ -386,8 +386,8 @@ Project {
"componentcore/findimplementation.h", "componentcore/findimplementation.h",
"componentcore/layoutingridlayout.cpp", "componentcore/layoutingridlayout.cpp",
"componentcore/layoutingridlayout.h", "componentcore/layoutingridlayout.h",
"componentcore/theming.cpp", "componentcore/theme.cpp",
"componentcore/theming.h", "componentcore/theme.h",
"componentcore/modelnodecontextmenu.cpp", "componentcore/modelnodecontextmenu.cpp",
"componentcore/modelnodecontextmenu.h", "componentcore/modelnodecontextmenu.h",
"componentcore/modelnodecontextmenu_helper.cpp", "componentcore/modelnodecontextmenu_helper.cpp",