Commit f088c395 authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner.propertyEditor: cleanup buttons for alignment and colors

This commit cleans up the design of the buttons and fixes
BAUHAUS-612
parent f8b8c3a9
......@@ -3,6 +3,56 @@ import Bauhaus 1.0
QGroupBox {
id: aligmentHorizontalButtons
property variant theValue: backendValues.horizontalAlignment.value;
property bool blueHigh: false
property bool baseStateFlag: isBaseState;
property variant backendValue: backendValues.horizontalAlignment;
onBaseStateFlagChanged: {
evaluate();
}
property bool isInModel: backendValue.isInModel;
onIsInModelChanged: {
evaluate();
}
property bool isInSubState: backendValue.isInSubState;
onIsInSubStateChanged: {
evaluate();
}
onTheValueChanged: {
if (theValue != undefined) {
leftButton.checked = theValue == "AlignLeft";
centerButton.checked = theValue == "AlignHCenter";
rightButton.checked = theValue == "AlignRight";
}
evaluate();
}
function evaluate() {
if (!enabled) {
fontSelector.setStyleSheet("color: "+scheme.disabledColor);
} else {
if (baseStateFlag) {
if (backendValue != null && backendValue.isInModel)
blueHigh = true;
else
blueHigh = false;
} else {
if (backendValue != null && backendValue.isInSubState)
blueHigh = true;
else
blueHigh = false;
}
}
}
layout: HorizontalLayout {
topMargin: 6
......@@ -11,12 +61,18 @@ QGroupBox {
QPushButton {
id: leftButton
checkable: true
fixedWidth: 32
iconSize.width: 24;
iconSize.height: 24;
fixedWidth: 52
width: fixedWidth
fixedHeight: 32
fixedHeight: 28
height: fixedHeight
styleSheetFile: "alignmentleftbutton.css";
styleSheetFile: "styledbuttonleft.css";
iconFromFile: blueHigh ? "images/alignmentleft-h-icon.png" : "images/alignmentleft-icon.png"
checked: backendValues.horizontalAlignment.value == "AlignLeft"
onClicked: {
......@@ -26,17 +82,27 @@ QGroupBox {
rightButton.checked = false;
}
ExtendedFunctionButton {
backendValue: backendValues.horizontalAlignment;
y: 7
x: 2
}
}
QPushButton {
id: centerButton
x: 32
x: 52
checkable: true
fixedWidth: 32
iconSize.width: 24;
iconSize.height: 24;
fixedWidth: 31
width: fixedWidth
fixedHeight: 32
fixedHeight: 28
height: fixedHeight
styleSheetFile: "styledbuttonmiddle.css";
iconFromFile: blueHigh ? "images/alignmentcenterh-h-icon.png" : "images/alignmentcenterh-icon.png"
styleSheetFile: "alignmentcenterhbutton.css";
checked: backendValues.horizontalAlignment.value == "AlignHCenter"
onClicked: {
......@@ -49,14 +115,18 @@ QGroupBox {
}
QPushButton {
id: rightButton
x: 64
x: 83
checkable: true
fixedWidth: 32
iconSize.width: 24;
iconSize.height: 24;
fixedWidth: 31
width: fixedWidth
fixedHeight: 32
fixedHeight: 28
height: fixedHeight
styleSheetFile: "styledbuttonright.css";
iconFromFile: blueHigh ? "images/alignmentright-h-icon.png" : "images/alignmentright-icon.png"
styleSheetFile: "alignmentrightbutton.css";
checked: backendValues.horizontalAlignment.value == "AlignRight"
onClicked: {
......
......@@ -3,6 +3,56 @@ import Bauhaus 1.0
QGroupBox {
id: alignmentVerticalButtons
property variant theValue: backendValues.verticalAlignment.value;
property bool blueHigh: false
property bool baseStateFlag: isBaseState;
property variant backendValue: backendValues.verticalAlignment;
onBaseStateFlagChanged: {
evaluate();
}
property bool isInModel: backendValue.isInModel;
onIsInModelChanged: {
evaluate();
}
property bool isInSubState: backendValue.isInSubState;
onIsInSubStateChanged: {
evaluate();
}
onTheValueChanged: {
if (theValue != undefined) {
topButton.checked = theValue == "AlignTop";
centerButton.checked = theValue == "AlignVCenter";
bottomButton.checked = theValue == "AlignBottom";
}
evaluate();
}
function evaluate() {
if (!enabled) {
fontSelector.setStyleSheet("color: "+scheme.disabledColor);
} else {
if (baseStateFlag) {
if (backendValue != null && backendValue.isInModel)
blueHigh = true;
else
blueHigh = false;
} else {
if (backendValue != null && backendValue.isInSubState)
blueHigh = true;
else
blueHigh = false;
}
}
}
layout: HorizontalLayout {
topMargin: 6
......@@ -12,11 +62,16 @@ QGroupBox {
QPushButton {
id: topButton;
checkable: true
fixedWidth: 32
fixedHeight: 32
iconSize.width: 24;
iconSize.height: 24;
fixedWidth: 41
width: fixedWidth
fixedHeight: 28
height: fixedHeight
styleSheetFile: "alignmenttopbutton.css";
styleSheetFile: "styledbuttonleft.css";
iconFromFile: blueHigh ? "images/alignmenttop-h-icon.png" : "images/alignmenttop-icon.png"
checked: backendValues.verticalAlignment.value == "AlignTop"
onClicked: {
......@@ -26,17 +81,27 @@ QGroupBox {
centerButton.checked = false;
}
ExtendedFunctionButton {
backendValue: backendValues.verticalAlignment;
y: 7
x: 2
}
}
QPushButton {
x: 32
x: 41
id: centerButton;
checkable: true
fixedWidth: 32
fixedHeight: 32
iconSize.width: 24;
iconSize.height: 24;
fixedWidth: 31
width: fixedWidth
fixedHeight: 28
height: fixedHeight
styleSheetFile: "styledbuttonmiddle.css";
iconFromFile: blueHigh ? "images/alignmentmiddle-h-icon.png" : "images/alignmentmiddle-icon.png"
styleSheetFile: "alignmentcentervbutton.css";
checked: backendValues.verticalAlignment.value == "AlignVCenter"
onClicked: {
......@@ -48,15 +113,19 @@ QGroupBox {
}
QPushButton {
x: 64
x: 72
id: bottomButton;
checkable: true
fixedWidth: 32
fixedHeight: 32
iconSize.width: 24;
iconSize.height: 24;
fixedWidth: 31
width: fixedWidth
fixedHeight: 28
height: fixedHeight
styleSheetFile: "styledbuttonright.css";
iconFromFile: blueHigh ? "images/alignmentbottom-h-icon.png" : "images/alignmentbottom-icon.png"
styleSheetFile: "alignmentbottombutton.css";
checked: backendValues.verticalAlignment.value == "AlignBottom"
onClicked: {
......@@ -65,6 +134,7 @@ QGroupBox {
centerButton.checked = false;
topButton.checked = false;
}
}
}
......
......@@ -46,8 +46,10 @@ QWidget {
checked: true
fixedWidth: 31
fixedHeight: 28
styleSheetFile: "solidcolorbutton.css";
styleSheetFile: "styledbuttonleft.css"
iconFromFile: "images/icon_color_solid.png"
onToggled: {
if (checked) {
......@@ -70,8 +72,8 @@ QWidget {
fixedWidth: 31
fixedHeight: 28
styleSheetFile: "gradientcolorbutton.css";
styleSheetFile: "styledbuttonmiddle.css"
iconFromFile: "images/icon_color_gradient.png"
onToggled: {
if (checked) {
......@@ -93,7 +95,8 @@ QWidget {
checkable: true
fixedWidth: 31
fixedHeight: 28
styleSheetFile: "nonecolorbutton.css";
styleSheetFile: "styledbuttonright.css"
iconFromFile: "images/icon_color_none.png"
onToggled: {
if (checked) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment