Warning, /graphics/krita/libs/libqml/qml/KritaSketchBase.qml is written in an unsupported language. File is not indexed.
0001 /* This file is part of the KDE project 0002 * SPDX-FileCopyrightText: 2012 Arjen Hiemstra <ahiemstra@heimr.nl> 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 Item { 0012 id: base; 0013 property QtObject window: null; 0014 onWindowChanged: Krita.Window = window; 0015 Flickable { 0016 id: screenScroller; 0017 boundsBehavior: Flickable.StopAtBounds; 0018 0019 anchors { 0020 top: parent.top; 0021 left: parent.left; 0022 right: parent.right; 0023 bottom: keyboard.top; 0024 } 0025 0026 contentWidth: base.width; 0027 contentHeight: base.height; 0028 0029 PageStack { 0030 id: mainPageStack; 0031 0032 width: base.width; 0033 height: base.height; 0034 0035 onCurrentPageChanged: window.currentSketchPage = (currentPage.pageName !== undefined) ? currentPage.pageName : currentPage.toString(); 0036 initialPage: welcomePage; 0037 0038 transitionDuration: Constants.AnimationDuration; 0039 0040 Component { id: welcomePage; WelcomePage { } } 0041 0042 MouseArea { 0043 anchors.fill: parent; 0044 onClicked: parent.focus = true; 0045 } 0046 } 0047 0048 function ensureVisible(item) { 0049 if (item !== undefined && item !== null) { 0050 var targetPosition = item.mapToItem(screenScroller, item.x, item.y); 0051 if (targetPosition.y > base.height * 0.5) { 0052 screenScroller.contentY = targetPosition.y - base.height / 2; 0053 screenScroller.returnToBounds(); 0054 } 0055 } 0056 } 0057 } 0058 0059 VirtualKeyboard { 0060 id: keyboard; 0061 onKeyboardVisibleChanged: if (keyboardVisible) screenScroller.ensureVisible(Settings.focusItem); 0062 } 0063 0064 Connections { 0065 target: Settings; 0066 0067 onFocusItemChanged: if (keyboard.keyboardVisible) screenScroller.ensureVisible(Settings.focusItem); 0068 } 0069 }