forked from qt-creator/qt-creator
QmlDesigner: Implement effect maker preview zoom controls
Also fix a memory leak on removing a node. Fixes: QDS-10546 Change-Id: Ifc32b6d7f6f4c6b8ce63a080b159c8ae66865a79 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Amr Elsayed <amr.elsayed@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Qt CI Patch Build Bot <ci_patchbuild_bot@qt.io>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
// 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 HelperWidgets as HelperWidgets
|
||||
import StudioControls as StudioControls
|
||||
@@ -18,18 +19,25 @@ Column {
|
||||
height: StudioTheme.Values.toolbarHeight
|
||||
color: StudioTheme.Values.themeToolbarBackground
|
||||
|
||||
Row {
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.rightMargin: 5
|
||||
RowLayout {
|
||||
anchors.fill: parent
|
||||
spacing: 5
|
||||
anchors.rightMargin: 5
|
||||
anchors.leftMargin: 5
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
style: StudioTheme.Values.viewBarButtonStyle
|
||||
buttonIcon: StudioTheme.Constants.zoomOut_medium
|
||||
tooltip: qsTr("Zoom out")
|
||||
|
||||
onClicked: {} // TODO
|
||||
onClicked: {
|
||||
if (previewImage.scale > .4)
|
||||
previewImage.scale -= .2
|
||||
}
|
||||
}
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
@@ -37,7 +45,10 @@ Column {
|
||||
buttonIcon: StudioTheme.Constants.zoomIn_medium
|
||||
tooltip: qsTr("Zoom In")
|
||||
|
||||
onClicked: {} // TODO
|
||||
onClicked: {
|
||||
if (previewImage.scale < 2)
|
||||
previewImage.scale += .2
|
||||
}
|
||||
}
|
||||
|
||||
HelperWidgets.AbstractButton {
|
||||
@@ -45,7 +56,13 @@ Column {
|
||||
buttonIcon: StudioTheme.Constants.cornersAll
|
||||
tooltip: qsTr("Zoom Fit")
|
||||
|
||||
onClicked: {} // TODO
|
||||
onClicked: {
|
||||
previewImage.scale = 1
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
Column {
|
||||
@@ -81,18 +98,29 @@ Column {
|
||||
}
|
||||
|
||||
Rectangle { // preview image
|
||||
id: previewImage
|
||||
id: previewImageBg
|
||||
|
||||
color: "#dddddd"
|
||||
width: parent.width
|
||||
height: 200
|
||||
clip: true
|
||||
|
||||
Image {
|
||||
id: previewImage
|
||||
|
||||
anchors.margins: 5
|
||||
anchors.fill: parent
|
||||
fillMode: Image.PreserveAspectFit
|
||||
smooth: true
|
||||
|
||||
source: "images/qt_logo.png" // TODO: update image
|
||||
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
duration: 200
|
||||
easing.type: Easing.OutQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -48,7 +48,9 @@ void EffectMakerModel::addNode(const QString &nodeQenPath)
|
||||
void EffectMakerModel::removeNode(int idx)
|
||||
{
|
||||
beginRemoveRows({}, idx, idx);
|
||||
CompositionNode *node = m_nodes.at(idx);
|
||||
m_nodes.removeAt(idx);
|
||||
delete node;
|
||||
endRemoveRows();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user