From ab7a8659dc66b0f31dae31afb0b1af3efe97475c Mon Sep 17 00:00:00 2001 From: Ronan Abhamon Date: Thu, 8 Dec 2016 13:48:22 +0100 Subject: [PATCH] feat(app): remove `ScrollableTextEdit` component --- tests/resources.qrc | 1 - .../Common/Form/ScrollableTextEdit.qml | 80 ------------------- .../Common/Form/TransparentTextInput.qml | 2 + tests/ui/modules/Common/qmldir | 1 - 4 files changed, 2 insertions(+), 82 deletions(-) delete mode 100644 tests/ui/modules/Common/Form/ScrollableTextEdit.qml diff --git a/tests/resources.qrc b/tests/resources.qrc index f8e7dd302..7f5c34851 100644 --- a/tests/resources.qrc +++ b/tests/resources.qrc @@ -137,7 +137,6 @@ ui/modules/Common/Form/CheckBoxText.qml ui/modules/Common/Form/ExclusiveButtons.qml ui/modules/Common/Form/ListForm.qml - ui/modules/Common/Form/ScrollableTextEdit.qml ui/modules/Common/Form/SmallButton.qml ui/modules/Common/Form/TextButtonA.qml ui/modules/Common/Form/TextButtonB.qml diff --git a/tests/ui/modules/Common/Form/ScrollableTextEdit.qml b/tests/ui/modules/Common/Form/ScrollableTextEdit.qml deleted file mode 100644 index 5308b9df3..000000000 --- a/tests/ui/modules/Common/Form/ScrollableTextEdit.qml +++ /dev/null @@ -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() - } - } -} diff --git a/tests/ui/modules/Common/Form/TransparentTextInput.qml b/tests/ui/modules/Common/Form/TransparentTextInput.qml index bc24cf2c2..32fada42b 100644 --- a/tests/ui/modules/Common/Form/TransparentTextInput.qml +++ b/tests/ui/modules/Common/Form/TransparentTextInput.qml @@ -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 { diff --git a/tests/ui/modules/Common/qmldir b/tests/ui/modules/Common/qmldir index 7ae66dc1d..3d6a22440 100644 --- a/tests/ui/modules/Common/qmldir +++ b/tests/ui/modules/Common/qmldir @@ -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