Warning, /maui/nomad-style/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.6
0024 import QtQuick.Window 2.1
0025 import QtQuick.Templates 2.3 as T
0026 import org.kde.kirigami 2.2 as Kirigami
0027 import org.kde.qqc2desktopstyle.private 1.0 as StylePrivate
0028 
0029 T.TextArea {
0030     id: controlRoot
0031     Kirigami.Theme.colorSet: Kirigami.Theme.View
0032     Kirigami.Theme.inherit: false
0033 
0034     implicitWidth: Math.max(contentWidth + leftPadding + rightPadding,
0035                             background ? background.implicitWidth : 0,
0036                             placeholder.implicitWidth + leftPadding + rightPadding)
0037     implicitHeight: Math.max(contentHeight + topPadding + bottomPadding,
0038                              background ? background.implicitHeight : 0,
0039                              placeholder.implicitHeight + topPadding + bottomPadding)
0040 
0041     padding: 6
0042 
0043     color: Kirigami.Theme.textColor
0044     selectionColor: Kirigami.Theme.highlightColor
0045     selectedTextColor: Kirigami.Theme.highlightedTextColor
0046     wrapMode: Text.WordWrap
0047     verticalAlignment: TextEdit.AlignTop
0048     //Text.NativeRendering is broken on non integer pixel ratios
0049     renderType: Window.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering
0050     selectByMouse: true
0051 
0052     Label {
0053         id: placeholder
0054         x: controlRoot.leftPadding
0055         y: controlRoot.topPadding
0056         width: controlRoot.width - (controlRoot.leftPadding + controlRoot.rightPadding)
0057         height: controlRoot.height - (controlRoot.topPadding + controlRoot.bottomPadding)
0058 
0059         text: controlRoot.placeholderText
0060         font: controlRoot.font
0061         color: Kirigami.Theme.disabledTextColor
0062         horizontalAlignment: controlRoot.horizontalAlignment
0063         verticalAlignment: controlRoot.verticalAlignment
0064         visible: !controlRoot.length && !controlRoot.preeditText && (!controlRoot.activeFocus || controlRoot.horizontalAlignment !== Qt.AlignHCenter)
0065         elide: Text.ElideRight
0066     }
0067 
0068     background: StylePrivate.StyleItem {
0069         id: style
0070         control: controlRoot
0071         visible: controlRoot.backgroundVisible
0072         elementType: "edit"
0073         implicitWidth: 200
0074         implicitHeight: 22
0075 
0076         sunken: true
0077         hasFocus: controlRoot.activeFocus
0078         hover: controlRoot.hovered
0079     }
0080 }