forked from qt-creator/qt-creator
QmlDesigner: Refactor effect preview component
Warm up rendering by introducing some adjusts and refactoring Change-Id: I6575467325f5f6c2001958d4f95c9c74be17143f Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io>
This commit is contained in:
@@ -16,6 +16,8 @@ Column {
|
|||||||
|
|
||||||
required property Item mainRoot
|
required property Item mainRoot
|
||||||
|
|
||||||
|
property alias source: source
|
||||||
|
|
||||||
Rectangle { // toolbar
|
Rectangle { // toolbar
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: StudioTheme.Values.toolbarHeight
|
height: StudioTheme.Values.toolbarHeight
|
||||||
@@ -38,35 +40,35 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
HelperWidgets.AbstractButton {
|
HelperWidgets.AbstractButton {
|
||||||
enabled: previewImage.scale > .4
|
enabled: sourceImage.scale > .4
|
||||||
style: StudioTheme.Values.viewBarButtonStyle
|
style: StudioTheme.Values.viewBarButtonStyle
|
||||||
buttonIcon: StudioTheme.Constants.zoomOut_medium
|
buttonIcon: StudioTheme.Constants.zoomOut_medium
|
||||||
tooltip: qsTr("Zoom out")
|
tooltip: qsTr("Zoom out")
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
previewImage.scale -= .2
|
sourceImage.scale -= .2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HelperWidgets.AbstractButton {
|
HelperWidgets.AbstractButton {
|
||||||
enabled: previewImage.scale < 2
|
enabled: sourceImage.scale < 2
|
||||||
style: StudioTheme.Values.viewBarButtonStyle
|
style: StudioTheme.Values.viewBarButtonStyle
|
||||||
buttonIcon: StudioTheme.Constants.zoomIn_medium
|
buttonIcon: StudioTheme.Constants.zoomIn_medium
|
||||||
tooltip: qsTr("Zoom In")
|
tooltip: qsTr("Zoom In")
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
previewImage.scale += .2
|
sourceImage.scale += .2
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HelperWidgets.AbstractButton {
|
HelperWidgets.AbstractButton {
|
||||||
enabled: previewImage.scale !== 1
|
enabled: sourceImage.scale !== 1
|
||||||
style: StudioTheme.Values.viewBarButtonStyle
|
style: StudioTheme.Values.viewBarButtonStyle
|
||||||
buttonIcon: StudioTheme.Constants.fitAll_medium
|
buttonIcon: StudioTheme.Constants.fitAll_medium
|
||||||
tooltip: qsTr("Zoom Fit")
|
tooltip: qsTr("Zoom Fit")
|
||||||
|
|
||||||
onClicked: {
|
onClicked: {
|
||||||
previewImage.scale = 1
|
sourceImage.scale = 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -107,27 +109,33 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rectangle { // preview image
|
Rectangle { // preview image
|
||||||
id: previewImageBg
|
id: preview
|
||||||
|
|
||||||
color: "#dddddd"
|
color: "#dddddd"
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 200
|
height: 200
|
||||||
clip: true
|
clip: true
|
||||||
|
|
||||||
Image {
|
Item {
|
||||||
id: previewImage
|
id: source
|
||||||
|
|
||||||
anchors.margins: 5
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
fillMode: Image.PreserveAspectFit
|
layer.enabled: true
|
||||||
smooth: true
|
layer.mipmap: true
|
||||||
|
layer.smooth: true
|
||||||
|
|
||||||
source: imagesComboBox.selectedImage
|
Image {
|
||||||
|
id: sourceImage
|
||||||
|
anchors.margins: 5
|
||||||
|
anchors.fill: parent
|
||||||
|
fillMode: Image.PreserveAspectFit
|
||||||
|
source: imagesComboBox.selectedImage
|
||||||
|
smooth: true
|
||||||
|
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
duration: 200
|
duration: 200
|
||||||
easing.type: Easing.OutQuad
|
easing.type: Easing.OutQuad
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user