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
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
||||||
|
|
||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
import QtQuickDesignerTheme
|
import QtQuickDesignerTheme
|
||||||
import HelperWidgets as HelperWidgets
|
import HelperWidgets as HelperWidgets
|
||||||
import StudioControls as StudioControls
|
import StudioControls as StudioControls
|
||||||
@@ -18,18 +19,25 @@ Column {
|
|||||||
height: StudioTheme.Values.toolbarHeight
|
height: StudioTheme.Values.toolbarHeight
|
||||||
color: StudioTheme.Values.themeToolbarBackground
|
color: StudioTheme.Values.themeToolbarBackground
|
||||||
|
|
||||||
Row {
|
RowLayout {
|
||||||
anchors.right: parent.right
|
anchors.fill: parent
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
anchors.rightMargin: 5
|
|
||||||
spacing: 5
|
spacing: 5
|
||||||
|
anchors.rightMargin: 5
|
||||||
|
anchors.leftMargin: 5
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
HelperWidgets.AbstractButton {
|
HelperWidgets.AbstractButton {
|
||||||
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: {} // TODO
|
onClicked: {
|
||||||
|
if (previewImage.scale > .4)
|
||||||
|
previewImage.scale -= .2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HelperWidgets.AbstractButton {
|
HelperWidgets.AbstractButton {
|
||||||
@@ -37,7 +45,10 @@ Column {
|
|||||||
buttonIcon: StudioTheme.Constants.zoomIn_medium
|
buttonIcon: StudioTheme.Constants.zoomIn_medium
|
||||||
tooltip: qsTr("Zoom In")
|
tooltip: qsTr("Zoom In")
|
||||||
|
|
||||||
onClicked: {} // TODO
|
onClicked: {
|
||||||
|
if (previewImage.scale < 2)
|
||||||
|
previewImage.scale += .2
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HelperWidgets.AbstractButton {
|
HelperWidgets.AbstractButton {
|
||||||
@@ -45,7 +56,13 @@ Column {
|
|||||||
buttonIcon: StudioTheme.Constants.cornersAll
|
buttonIcon: StudioTheme.Constants.cornersAll
|
||||||
tooltip: qsTr("Zoom Fit")
|
tooltip: qsTr("Zoom Fit")
|
||||||
|
|
||||||
onClicked: {} // TODO
|
onClicked: {
|
||||||
|
previewImage.scale = 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
}
|
}
|
||||||
|
|
||||||
Column {
|
Column {
|
||||||
@@ -81,18 +98,29 @@ Column {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Rectangle { // preview image
|
Rectangle { // preview image
|
||||||
id: previewImage
|
id: previewImageBg
|
||||||
|
|
||||||
color: "#dddddd"
|
color: "#dddddd"
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: 200
|
height: 200
|
||||||
|
clip: true
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
|
id: previewImage
|
||||||
|
|
||||||
anchors.margins: 5
|
anchors.margins: 5
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
fillMode: Image.PreserveAspectFit
|
fillMode: Image.PreserveAspectFit
|
||||||
|
smooth: true
|
||||||
|
|
||||||
source: "images/qt_logo.png" // TODO: update image
|
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)
|
void EffectMakerModel::removeNode(int idx)
|
||||||
{
|
{
|
||||||
beginRemoveRows({}, idx, idx);
|
beginRemoveRows({}, idx, idx);
|
||||||
|
CompositionNode *node = m_nodes.at(idx);
|
||||||
m_nodes.removeAt(idx);
|
m_nodes.removeAt(idx);
|
||||||
|
delete node;
|
||||||
endRemoveRows();
|
endRemoveRows();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user