mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-05-06 20:23:08 +00:00
feat(app): remove ScrollableTextEdit component
This commit is contained in:
parent
30c2c8cd12
commit
ab7a8659dc
4 changed files with 2 additions and 82 deletions
|
|
@ -137,7 +137,6 @@
|
|||
<file>ui/modules/Common/Form/CheckBoxText.qml</file>
|
||||
<file>ui/modules/Common/Form/ExclusiveButtons.qml</file>
|
||||
<file>ui/modules/Common/Form/ListForm.qml</file>
|
||||
<file>ui/modules/Common/Form/ScrollableTextEdit.qml</file>
|
||||
<file>ui/modules/Common/Form/SmallButton.qml</file>
|
||||
<file>ui/modules/Common/Form/TextButtonA.qml</file>
|
||||
<file>ui/modules/Common/Form/TextButtonB.qml</file>
|
||||
|
|
|
|||
|
|
@ -1,80 +0,0 @@
|
|||
import QtQuick 2.7
|
||||
import QtQuick 2.7 as Quick
|
||||
|
||||
import Common 1.0
|
||||
import Common.Styles 1.0
|
||||
|
||||
// ===================================================================
|
||||
|
||||
Item {
|
||||
property alias text: textEdit.text
|
||||
property alias font: textEdit.font
|
||||
property alias color: textEdit.color
|
||||
|
||||
signal editingFinished
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
function _handleEditingFinished () {
|
||||
textEdit.cursorPosition = 0
|
||||
editingFinished()
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------
|
||||
|
||||
Rectangle {
|
||||
anchors.fill: flick
|
||||
color: textEdit.activeFocus && !textEdit.readOnly
|
||||
? TransparentTextInputStyle.backgroundColor.focused
|
||||
: 'transparent'
|
||||
|
||||
InvertedMouseArea {
|
||||
anchors.fill: parent
|
||||
enabled: textEdit.activeFocus
|
||||
onPressed: textEdit.focus = false
|
||||
}
|
||||
}
|
||||
|
||||
Flickable {
|
||||
id: flick
|
||||
|
||||
// See: http://doc.qt.io/qt-5/qml-qtquick-texttextEdit.html
|
||||
function _ensureVisible (r) {
|
||||
if (contentX >= r.x) {
|
||||
contentX = r.x
|
||||
} else if (contentX + width <= r.x + r.width) {
|
||||
contentX = r.x + r.width - width
|
||||
}
|
||||
|
||||
if (contentY >= r.y) {
|
||||
contentY = r.y
|
||||
} else if (contentY + height <= r.y + r.height) {
|
||||
contentY = r.y + r.height - height
|
||||
}
|
||||
}
|
||||
|
||||
anchors.fill: parent
|
||||
boundsBehavior: Flickable.StopAtBounds
|
||||
clip: true
|
||||
contentHeight: textEdit.paintedHeight
|
||||
contentWidth: textEdit.paintedWidth
|
||||
interactive: textEdit.activeFocus
|
||||
|
||||
Quick.TextEdit {
|
||||
id: textEdit
|
||||
|
||||
color: activeFocus && !readOnly
|
||||
? TransparentTextInputStyle.textColor.focused
|
||||
: TransparentTextInputStyle.textColor.normal
|
||||
selectByMouse: true
|
||||
width: flick.width
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
Keys.onEscapePressed: focus = false
|
||||
Keys.onReturnPressed: focus = false
|
||||
|
||||
onCursorRectangleChanged: flick._ensureVisible(cursorRectangle)
|
||||
onEditingFinished: _handleEditingFinished()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,6 +3,8 @@ import QtQuick 2.7
|
|||
import Common 1.0
|
||||
import Common.Styles 1.0
|
||||
|
||||
// ===================================================================
|
||||
// A editable text that become the content of a box on focus.
|
||||
// ===================================================================
|
||||
|
||||
Item {
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ CheckBoxText 1.0 Form/CheckBoxText.qml
|
|||
ExclusiveButtons 1.0 Form/ExclusiveButtons.qml
|
||||
LightButton 1.0 Form/LightButton.qml
|
||||
ListForm 1.0 Form/ListForm.qml
|
||||
ScrollableTextEdit 1.0 Form/ScrollableTextEdit.qml
|
||||
TextButtonA 1.0 Form/TextButtonA.qml
|
||||
TextButtonB 1.0 Form/TextButtonB.qml
|
||||
TextField 1.0 Form/TextField.qml
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue