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
|
||||
|
||||
property alias source: source
|
||||
|
||||
Rectangle { // toolbar
|
||||
width: parent.width
|
||||
height: StudioTheme.Values.toolbarHeight
|
||||
@@ -38,35 +40,35 @@ Column {
|
||||
}
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
enabled: previewImage.scale > .4
|
||||
enabled: sourceImage.scale > .4
|
||||
style: StudioTheme.Values.viewBarButtonStyle
|
||||
buttonIcon: StudioTheme.Constants.zoomOut_medium
|
||||
tooltip: qsTr("Zoom out")
|
||||
|
||||
onClicked: {
|
||||
previewImage.scale -= .2
|
||||
sourceImage.scale -= .2
|
||||
}
|
||||
}
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
enabled: previewImage.scale < 2
|
||||
enabled: sourceImage.scale < 2
|
||||
style: StudioTheme.Values.viewBarButtonStyle
|
||||
buttonIcon: StudioTheme.Constants.zoomIn_medium
|
||||
tooltip: qsTr("Zoom In")
|
||||
|
||||
onClicked: {
|
||||
previewImage.scale += .2
|
||||
sourceImage.scale += .2
|
||||
}
|
||||
}
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
enabled: previewImage.scale !== 1
|
||||
enabled: sourceImage.scale !== 1
|
||||
style: StudioTheme.Values.viewBarButtonStyle
|
||||
buttonIcon: StudioTheme.Constants.fitAll_medium
|
||||
tooltip: qsTr("Zoom Fit")
|
||||
|
||||
onClicked: {
|
||||
previewImage.scale = 1
|
||||
sourceImage.scale = 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,27 +109,33 @@ Column {
|
||||
}
|
||||
|
||||
Rectangle { // preview image
|
||||
id: previewImageBg
|
||||
id: preview
|
||||
|
||||
color: "#dddddd"
|
||||
width: parent.width
|
||||
height: 200
|
||||
clip: true
|
||||
|
||||
Image {
|
||||
id: previewImage
|
||||
|
||||
anchors.margins: 5
|
||||
Item {
|
||||
id: source
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectFit
|
||||
smooth: true
|
||||
layer.enabled: 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 {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutQuad
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user