QmlDesigner: Effect maker UI tweaks

- Corrected property name font size
- Disabled zoom controls when not needed
- Updated Zoom Fit icon
- Show vec2, 3, and 4 properties in 1 line

Change-Id: I6d5474163b708790b61b6d3462068b138431bd49
Reviewed-by: Amr Elsayed <amr.elsayed@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Mahmoud Badri
2023-09-05 18:03:05 +03:00
parent 6f21cb0b23
commit 00aad5e89b
9 changed files with 337 additions and 319 deletions

View File

@@ -45,7 +45,7 @@ Item {
Text {
text: uniformName
color: StudioTheme.Values.themeTextColor
font.pointSize: StudioTheme.Values.smallFontSize
font.pixelSize: StudioTheme.Values.baseFontSize
horizontalAlignment: Text.AlignRight
Layout.maximumWidth: 140
Layout.minimumWidth: 140

View File

@@ -30,30 +30,31 @@ Column {
}
HelperWidgets.AbstractButton {
enabled: previewImage.scale > .4
style: StudioTheme.Values.viewBarButtonStyle
buttonIcon: StudioTheme.Constants.zoomOut_medium
tooltip: qsTr("Zoom out")
onClicked: {
if (previewImage.scale > .4)
previewImage.scale -= .2
}
}
HelperWidgets.AbstractButton {
enabled: previewImage.scale < 2
style: StudioTheme.Values.viewBarButtonStyle
buttonIcon: StudioTheme.Constants.zoomIn_medium
tooltip: qsTr("Zoom In")
onClicked: {
if (previewImage.scale < 2)
previewImage.scale += .2
}
}
HelperWidgets.AbstractButton {
enabled: previewImage.scale !== 1
style: StudioTheme.Values.viewBarButtonStyle
buttonIcon: StudioTheme.Constants.cornersAll
buttonIcon: StudioTheme.Constants.fitAll_medium
tooltip: qsTr("Zoom Fit")
onClicked: {

View File

@@ -14,7 +14,7 @@ Row {
StudioControls.RealSpinBox {
id: spinBox
width: 40
width: 60
actionIndicatorVisible: false
spinBoxIndicatorVisible: false
inputHAlignment: Qt.AlignHCenter
@@ -29,7 +29,8 @@ Row {
StudioControls.Slider {
id: slider
width: parent.width - 80
width: parent.width - 100
visible: width > 20
labels: false
decimals: 2
actionIndicatorVisible: false

View File

@@ -14,7 +14,7 @@ Row {
StudioControls.SpinBox {
id: spinBox
width: 40
width: 60
actionIndicatorVisible: false
spinBoxIndicatorVisible: false
inputHAlignment: Qt.AlignHCenter
@@ -27,7 +27,8 @@ Row {
StudioControls.Slider {
id: slider
width: parent.width - 80
width: parent.width - 100
visible: width > 20
labels: false
actionIndicatorVisible: false
from: uniformMinValue

View File

@@ -2,23 +2,23 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick
import QtQuick.Layouts
import QtQuickDesignerTheme
import StudioControls as StudioControls
import StudioTheme 1.0 as StudioTheme
import EffectMakerBackend
Column {
RowLayout {
width: parent.width
spacing: 1
Row {
width: parent.width
spacing: 5
spacing: 0
StudioControls.RealSpinBox {
id: vX
width: 40
Layout.fillWidth: true
Layout.minimumWidth: 30
Layout.maximumWidth: 60
actionIndicatorVisible: false
spinBoxIndicatorVisible: false
inputHAlignment: Qt.AlignHCenter
@@ -30,31 +30,32 @@ Column {
onRealValueModified: uniformValue.x = realValue
}
StudioControls.Slider {
id: sliderX
width: parent.width - 80
labels: false
decimals: 2
actionIndicatorVisible: false
from: uniformMinValue.x
to: uniformMaxValue.x
value: uniformValue.x
onMoved: {
uniformValue.x = value
vX.realValue = value // binding isn't working for this property so update it
}
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 2
Layout.maximumWidth: 10
}
Row {
width: parent.width
spacing: 5
Text {
text: qsTr("X")
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
Layout.alignment: Qt.AlignVCenter
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 10
Layout.maximumWidth: 20
}
StudioControls.RealSpinBox {
id: vY
width: 40
Layout.fillWidth: true
Layout.minimumWidth: 30
Layout.maximumWidth: 60
actionIndicatorVisible: false
spinBoxIndicatorVisible: false
inputHAlignment: Qt.AlignHCenter
@@ -66,20 +67,22 @@ Column {
onRealValueModified: uniformValue.y = realValue
}
StudioControls.Slider {
id: sliderY
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 2
Layout.maximumWidth: 10
}
width: parent.width - 80
labels: false
decimals: 2
actionIndicatorVisible: false
from: uniformMinValue.y
to: uniformMaxValue.y
value: uniformValue.y
onMoved: {
uniformValue.y = value
vY.realValue = value // binding isn't working for this property so update it
}
Text {
text: qsTr("Y")
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
Layout.alignment: Qt.AlignVCenter
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 10
}
}

View File

@@ -2,24 +2,23 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick
import QtQuick.Layouts
import QtQuickDesignerTheme
import StudioControls as StudioControls
import StudioTheme 1.0 as StudioTheme
import EffectMakerBackend
Column {
RowLayout {
width: parent.width
spacing: 1
Row {
width: parent.width
spacing: 5
spacing: 0
StudioControls.RealSpinBox {
id: vX
width: 40
Layout.fillWidth: true
Layout.minimumWidth: 30
Layout.maximumWidth: 60
actionIndicatorVisible: false
spinBoxIndicatorVisible: false
inputHAlignment: Qt.AlignHCenter
@@ -31,31 +30,32 @@ Column {
onRealValueModified: uniformValue.x = realValue
}
StudioControls.Slider {
id: sliderX
width: parent.width - 80
labels: false
decimals: 2
actionIndicatorVisible: false
from: uniformMinValue.x
to: uniformMaxValue.x
value: uniformValue.x
onMoved: {
uniformValue.x = value
vX.realValue = value // binding isn't working for this property so update it
}
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 2
Layout.maximumWidth: 10
}
Row {
width: parent.width
spacing: 5
Text {
text: qsTr("X")
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
Layout.alignment: Qt.AlignVCenter
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 10
Layout.maximumWidth: 20
}
StudioControls.RealSpinBox {
id: vY
width: 40
Layout.fillWidth: true
Layout.minimumWidth: 30
Layout.maximumWidth: 60
actionIndicatorVisible: false
spinBoxIndicatorVisible: false
inputHAlignment: Qt.AlignHCenter
@@ -67,31 +67,32 @@ Column {
onRealValueModified: uniformValue.y = realValue
}
StudioControls.Slider {
id: sliderY
width: parent.width - 80
labels: false
decimals: 2
actionIndicatorVisible: false
from: uniformMinValue.y
to: uniformMaxValue.y
value: uniformValue.y
onMoved: {
uniformValue.y = value
vY.realValue = value // binding isn't working for this property so update it
}
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 2
Layout.maximumWidth: 10
}
Row {
width: parent.width
spacing: 5
Text {
text: qsTr("Y")
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
Layout.alignment: Qt.AlignVCenter
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 10
Layout.maximumWidth: 20
}
StudioControls.RealSpinBox {
id: vZ
width: 40
Layout.fillWidth: true
Layout.minimumWidth: 30
Layout.maximumWidth: 60
actionIndicatorVisible: false
spinBoxIndicatorVisible: false
inputHAlignment: Qt.AlignHCenter
@@ -103,20 +104,22 @@ Column {
onRealValueModified: uniformValue.z = realValue
}
StudioControls.Slider {
id: sliderZ
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 2
Layout.maximumWidth: 10
}
width: parent.width - 80
labels: false
decimals: 2
actionIndicatorVisible: false
from: uniformMinValue.z
to: uniformMaxValue.z
value: uniformValue.z
onMoved: {
uniformValue.z = value
vZ.realValue = value // binding isn't working for this property so update it
}
Text {
text: qsTr("Z")
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
Layout.alignment: Qt.AlignVCenter
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 10
}
}

View File

@@ -2,24 +2,23 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
import QtQuick
import QtQuick.Layouts
import QtQuickDesignerTheme
import StudioControls as StudioControls
import StudioTheme 1.0 as StudioTheme
import EffectMakerBackend
Column {
RowLayout {
width: parent.width
spacing: 1
Row {
width: parent.width
spacing: 5
spacing: 0
StudioControls.RealSpinBox {
id: vX
width: 40
Layout.fillWidth: true
Layout.minimumWidth: 30
Layout.maximumWidth: 60
actionIndicatorVisible: false
spinBoxIndicatorVisible: false
inputHAlignment: Qt.AlignHCenter
@@ -31,31 +30,32 @@ Column {
onRealValueModified: uniformValue.x = realValue
}
StudioControls.Slider {
id: sliderX
width: parent.width - 80
labels: false
decimals: 2
actionIndicatorVisible: false
from: uniformMinValue.x
to: uniformMaxValue.x
value: uniformValue.x
onMoved: {
uniformValue.x = value
vX.realValue = value // binding isn't working for this property so update it
}
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 2
Layout.maximumWidth: 10
}
Row {
width: parent.width
spacing: 5
Text {
text: qsTr("X")
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
Layout.alignment: Qt.AlignVCenter
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 10
Layout.maximumWidth: 20
}
StudioControls.RealSpinBox {
id: vY
width: 40
Layout.fillWidth: true
Layout.minimumWidth: 30
Layout.maximumWidth: 60
actionIndicatorVisible: false
spinBoxIndicatorVisible: false
inputHAlignment: Qt.AlignHCenter
@@ -67,31 +67,32 @@ Column {
onRealValueModified: uniformValue.y = realValue
}
StudioControls.Slider {
id: sliderY
width: parent.width - 80
labels: false
decimals: 2
actionIndicatorVisible: false
from: uniformMinValue.y
to: uniformMaxValue.y
value: uniformValue.y
onMoved: {
uniformValue.y = value
vY.realValue = value // binding isn't working for this property so update it
}
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 2
Layout.maximumWidth: 10
}
Row {
width: parent.width
spacing: 5
Text {
text: qsTr("Y")
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
Layout.alignment: Qt.AlignVCenter
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 10
Layout.maximumWidth: 20
}
StudioControls.RealSpinBox {
id: vZ
width: 40
Layout.fillWidth: true
Layout.minimumWidth: 30
Layout.maximumWidth: 60
actionIndicatorVisible: false
spinBoxIndicatorVisible: false
inputHAlignment: Qt.AlignHCenter
@@ -103,31 +104,32 @@ Column {
onRealValueModified: uniformValue.z = realValue
}
StudioControls.Slider {
id: sliderZ
width: parent.width - 80
labels: false
decimals: 2
actionIndicatorVisible: false
from: uniformMinValue.z
to: uniformMaxValue.z
value: uniformValue.z
onMoved: {
uniformValue.z = value
vZ.realValue = value // binding isn't working for this property so update it
}
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 2
Layout.maximumWidth: 10
}
Row {
width: parent.width
spacing: 5
Text {
text: qsTr("Z")
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
Layout.alignment: Qt.AlignVCenter
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 10
Layout.maximumWidth: 20
}
StudioControls.RealSpinBox {
id: vW
width: 40
Layout.fillWidth: true
Layout.minimumWidth: 30
Layout.maximumWidth: 60
actionIndicatorVisible: false
spinBoxIndicatorVisible: false
inputHAlignment: Qt.AlignHCenter
@@ -139,20 +141,22 @@ Column {
onRealValueModified: uniformValue.w = realValue
}
StudioControls.Slider {
id: sliderW
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 2
Layout.maximumWidth: 10
}
width: parent.width - 80
labels: false
decimals: 2
actionIndicatorVisible: false
from: uniformMinValue.w
to: uniformMaxValue.w
value: uniformValue.w
onMoved: {
uniformValue.w = value
vW.realValue = value // binding isn't working for this property so update it
}
Text {
text: qsTr("W")
color: StudioTheme.Values.themeTextColor
font.pixelSize: StudioTheme.Values.baseFontSize
Layout.alignment: Qt.AlignVCenter
}
Item { // spacer
Layout.fillWidth: true
Layout.minimumWidth: 10
}
}

View File

@@ -20,6 +20,10 @@ Uniform::Uniform(const QJsonObject &propObj)
m_type = Uniform::typeFromString(propObj.value("type").toString());
defaultValue = propObj.value("defaultValue").toString();
m_displayName = propObj.value("displayName").toString();
if (m_displayName.isEmpty())
m_displayName = m_name;
if (m_type == Type::Sampler) {
if (!defaultValue.isEmpty())
defaultValue = getResourcePath(defaultValue);

View File

@@ -18,7 +18,7 @@ class Uniform : public QObject
{
Q_OBJECT
Q_PROPERTY(QString uniformName MEMBER m_name CONSTANT)
Q_PROPERTY(QString uniformName MEMBER m_displayName CONSTANT)
Q_PROPERTY(QString uniformType READ typeName CONSTANT)
Q_PROPERTY(QVariant uniformValue READ value WRITE setValue NOTIFY uniformValueChanged)
Q_PROPERTY(QVariant uniformBackendValue READ backendValue NOTIFY uniformBackendValueChanged)
@@ -89,6 +89,7 @@ private:
QVariant m_minValue;
QVariant m_maxValue;
QString m_name;
QString m_displayName;
QString m_description;
QString m_customValue;
bool m_useCustomValue = false;