Warning, /graphics/krita/libs/libqml/qml/panels/toolconfigpages/crop.qml is written in an unsupported language. File is not indexed.

0001 /* This file is part of the KDE project
0002  * SPDX-FileCopyrightText: 2012 Dan Leinir Turthra Jensen <admin@leinir.dk>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 import QtQuick 2.3
0008 import org.krita.sketch 1.0
0009 import org.krita.sketch.components 1.0
0010 
0011 Column {
0012     id: base
0013     property bool fullView: true;
0014     height: childrenRect.height;
0015     spacing: Constants.DefaultMargin;
0016 
0017     function apply() {
0018         toolManager.currentTool.crop();
0019     }
0020 
0021     ExpandingListView {
0022         id: cropTypeList;
0023         width: parent.width;
0024         visible: fullView;
0025         expandedHeight: Constants.GridHeight * 2;
0026         currentIndex: toolManager.currentTool.cropType !== undefined ? toolManager.currentTool.cropType : 0;
0027         onCurrentIndexChanged: if (toolManager.currentTool && toolManager.currentTool.cropType !== undefined) toolManager.currentTool.cropType = currentIndex;
0028         model: ListModel {
0029             ListElement {
0030                 text: "Layer";
0031             }
0032             ListElement {
0033                 text: "Image";
0034             }
0035         }
0036     }
0037     ExpandingListView {
0038         id: cropDecorationList;
0039         width: parent.width;
0040         visible: fullView;
0041         expandedHeight: Constants.GridHeight * 3;
0042         currentIndex: toolManager.currentTool.decoration !== undefined ? toolManager.currentTool.decoration : 0;
0043         onCurrentIndexChanged: if (toolManager.currentTool && toolManager.currentTool.decoration !== undefined && toolManager.currentTool.decoration !== currentIndex) toolManager.currentTool.decoration = currentIndex;
0044         model: ListModel {
0045             ListElement {
0046                 text: "No decoration";
0047             }
0048             ListElement {
0049                 text: "Thirds";
0050             }
0051             ListElement {
0052                 text: "Fifths";
0053             }
0054             ListElement {
0055                 text: "Passport photo";
0056             }
0057         }
0058     }
0059 
0060     RangeInput {
0061         id: xInput;
0062         width: parent.width;
0063         placeholder: "X";
0064         min: 0; max: sketchView.imageWidth; decimals: 0;
0065         value: toolManager.currentTool.cropX !== undefined ? toolManager.currentTool.cropX : 0;
0066         onValueChanged: if (toolManager.currentTool.cropX !== value) toolManager.currentTool.cropX = value;
0067     }
0068 
0069     RangeInput {
0070         id: yInput;
0071         width: parent.width;
0072         visible: fullView;
0073         placeholder: "Y";
0074         min: 0; max: sketchView.imageHeight; decimals: 0;
0075         value: toolManager.currentTool.cropY !== undefined ? toolManager.currentTool.cropY : 0;
0076         onValueChanged: if (toolManager.currentTool.cropY !== value) toolManager.currentTool.cropY = value;
0077     }
0078 
0079     RangeInput {
0080         id: widthInput;
0081         width: parent.width;
0082         placeholder: "Width";
0083         min: 0; max: sketchView.imageWidth; decimals: 0;
0084         value: toolManager.currentTool.cropWidth !== undefined ? toolManager.currentTool.cropWidth : 0;
0085         onValueChanged: if (toolManager.currentTool.cropWidth !== value) toolManager.currentTool.cropWidth = value;
0086     }
0087 
0088     RangeInput {
0089         id: heightInput;
0090         width: parent.width;
0091         placeholder: "Height";
0092         min: 0; max: sketchView.imageHeight; decimals: 0;
0093         value: toolManager.currentTool.cropHeight !== undefined ? toolManager.currentTool.cropHeight : 0;
0094         onValueChanged: if (toolManager.currentTool.cropHeight !== value) toolManager.currentTool.cropHeight = value;
0095     }
0096 
0097     Connections {
0098         target: toolManager.currentTool;
0099         onCropWidthChanged: if (widthInput.value !== toolManager.currentTool.cropWidth) widthInput.value = toolManager.currentTool.cropWidth;
0100         onCropHeightChanged: if (heightInput.value !== toolManager.currentTool.cropHeight) heightInput.value = toolManager.currentTool.cropHeight;
0101         onCropXChanged: if (xInput.value !== toolManager.currentTool.cropX) xInput.value = toolManager.currentTool.cropX;
0102         onCropYChanged: if (yInput.value !== toolManager.currentTool.cropY) yInput.value = toolManager.currentTool.cropY;
0103     }
0104 }