Warning, /maui/mauikit/src/style.5/TextArea.qml is written in an unsupported language. File is not indexed.
0001 /* 0002 * Copyright 2017 Marco Martin <mart@kde.org> 0003 * Copyright 2017 The Qt Company Ltd. 0004 * 0005 * GNU Lesser General Public License Usage 0006 * Alternatively, this file may be used under the terms of the GNU Lesser 0007 * General Public License version 3 as published by the Free Software 0008 * Foundation and appearing in the file LICENSE.LGPLv3 included in the 0009 * packaging of this file. Please review the following information to 0010 * ensure the GNU Lesser General Public License version 3 requirements 0011 * will be met: https://www.gnu.org/licenses/lgpl.html. 0012 * 0013 * GNU General Public License Usage 0014 * Alternatively, this file may be used under the terms of the GNU 0015 * General Public License version 2.0 or later as published by the Free 0016 * Software Foundation and appearing in the file LICENSE.GPL included in 0017 * the packaging of this file. Please review the following information to 0018 * ensure the GNU General Public License version 2.0 requirements will be 0019 * met: http://www.gnu.org/licenses/gpl-2.0.html. 0020 */ 0021 0022 0023 import QtQuick 2.15 0024 import QtQuick.Window 2.15 0025 import QtQuick.Templates 2.15 as T 0026 import org.mauikit.controls 1.3 as Maui 0027 import "private" as Private 0028 0029 0030 T.TextArea 0031 { 0032 id: control 0033 0034 Maui.Theme.colorSet: Maui.Theme.View 0035 Maui.Theme.inherit: false 0036 clip: false 0037 0038 implicitWidth: Math.max(contentWidth + leftPadding + rightPadding, 0039 background ? background.implicitWidth : 0, 0040 placeholder.implicitWidth + leftPadding + rightPadding) 0041 implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, 0042 background ? background.implicitHeight : 0, 0043 placeholder.implicitHeight + topPadding + bottomPadding) 0044 0045 padding: Maui.Style.space.medium 0046 0047 color: Maui.Theme.textColor 0048 selectionColor: Maui.Theme.highlightColor 0049 selectedTextColor: Maui.Theme.highlightedTextColor 0050 0051 opacity: control.enabled ? 1 : 0.6 0052 wrapMode: Text.WordWrap 0053 0054 verticalAlignment: TextEdit.AlignTop 0055 hoverEnabled: !Maui.Handy.isTouch 0056 0057 // Work around Qt bug where NativeRendering breaks for non-integer scale factors 0058 // https://bugreports.qt.io/browse/QTBUG-67007 0059 renderType: Screen.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering 0060 0061 selectByMouse: !Maui.Handy.isMobile 0062 selectByKeyboard: true 0063 0064 persistentSelection: true 0065 activeFocusOnPress: true 0066 activeFocusOnTab: true 0067 0068 cursorDelegate: Maui.Handy.isTouch && Maui.Handy.isLinux ? mobileCursor : null 0069 Component 0070 { 0071 id: mobileCursor 0072 Private.MobileCursor 0073 { 0074 target: control 0075 } 0076 } 0077 0078 onPressAndHold: 0079 { 0080 if (!Maui.Handy.isTouch) { 0081 return; 0082 } 0083 0084 forceActiveFocus(); 0085 cursorPosition = positionAt(event.x, event.y); 0086 selectWord(); 0087 } 0088 0089 Label 0090 { 0091 id: placeholder 0092 0093 opacity: 0.5 0094 0095 x: control.leftPadding 0096 y: control.topPadding 0097 width: control.width - (control.leftPadding + control.rightPadding) 0098 height: control.height - (control.topPadding + control.bottomPadding) 0099 0100 text: control.placeholderText 0101 font: control.font 0102 color: control.color 0103 horizontalAlignment: control.horizontalAlignment 0104 verticalAlignment: control.verticalAlignment 0105 visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) 0106 elide: Text.ElideRight 0107 } 0108 0109 0110 0111 background: Rectangle 0112 { 0113 // y: parent.height - height - control.bottomPadding / 2 0114 implicitWidth: 120 0115 // height: control.activeFocus ? 2 : 1 0116 color: control.Maui.Theme.backgroundColor 0117 } 0118 }