summaryrefslogtreecommitdiff
path: root/tests/auto/declarative/qmlvisual/qdeclarativetextedit
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2010-06-18 13:10:26 +0200
committerPaul Olav Tvete <paul.tvete@nokia.com>2010-06-18 13:10:26 +0200
commita3fd00796dafe52d4ff138b271564daf70d1adee (patch)
tree77ca481c06c1b2c3c7822a4cd5864702e341b680 /tests/auto/declarative/qmlvisual/qdeclarativetextedit
parent793d1ed8d3a03eefdd487facdacf66ba575e1a07 (diff)
parent6aa50af000f85cc4497749fcf0860c8ed244a60e (diff)
downloadqt4-tools-a3fd00796dafe52d4ff138b271564daf70d1adee.tar.gz
Merge remote branch 'qt/4.7' into lighthouse
Conflicts: configure mkspecs/common/qws.conf src/corelib/io/qresource.cpp src/gui/image/qpixmapdata_p.h src/gui/kernel/qapplication.cpp src/gui/kernel/qapplication_p.h src/gui/painting/qpaintengine_raster.cpp src/gui/text/qfontdatabase.cpp src/opengl/qgl_p.h src/plugins/mediaservices/gstreamer/gstreamer.pro
Diffstat (limited to 'tests/auto/declarative/qmlvisual/qdeclarativetextedit')
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml73
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativetextedit/usingMultilineEdit.qml13
-rw-r--r--tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml2
3 files changed, 87 insertions, 1 deletions
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml
new file mode 100644
index 0000000000..53538cb91b
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/MultilineEdit.qml
@@ -0,0 +1,73 @@
+import Qt 4.7
+
+Item {
+ id:lineedit
+ property alias text: textEdit.text
+
+ width: 240 + 11 //Should be set manually in most cases
+ height: textEdit.height + 11
+
+ Rectangle{
+ color: 'lightsteelblue'
+ anchors.fill: parent
+ }
+ clip: true
+ Component.onCompleted: textEdit.cursorPosition = 0;
+ TextEdit{
+ id:textEdit
+ cursorDelegate: Item{
+ Rectangle{
+ visible: parent.parent.focus
+ color: "#009BCE"
+ height: 13
+ width: 2
+ y: 1
+ }
+ }
+ property int leftMargin: 6
+ property int topMargin: 6
+ property int rightMargin: 6
+ property int bottomMargin: 6
+ x: leftMargin
+ width: parent.width - leftMargin - rightMargin;
+ y: 5
+ //Below function implements all scrolling logic
+ onCursorPositionChanged: {
+ if(cursorRectangle.y < topMargin - textEdit.y){//Cursor went off the front
+ textEdit.y = topMargin - Math.max(0, cursorRectangle.y);
+ }else if(cursorRectangle.y > parent.height - topMargin - bottomMargin - textEdit.y){//Cursor went off the end
+ textEdit.y = topMargin - Math.max(0, cursorRectangle.y - (parent.height - topMargin - bottomMargin)) - cursorRectangle.height;
+ }
+ }
+
+ text:""
+ horizontalAlignment: TextInput.AlignLeft
+ wrapMode: TextEdit.WordWrap
+ font.pixelSize:15
+ }
+ MouseArea{
+ //Implements all line edit mouse handling
+ id: mainMouseArea
+ anchors.fill: parent;
+ function translateY(y){
+ return y - textEdit.y
+ }
+ function translateX(x){
+ return x - textEdit.x
+ }
+ onPressed: {
+ textEdit.focus = true;
+ textEdit.cursorPosition = textEdit.positionAt(translateX(mouse.x), translateY(mouse.y));
+ }
+ onPositionChanged: {
+ textEdit.moveCursorSelection(textEdit.positionAt(translateX(mouse.x), translateY(mouse.y)));
+ }
+ onReleased: {
+ }
+ onDoubleClicked: {
+ textEdit.selectAll()
+ }
+ z: textEdit.z + 1
+ }
+
+}
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/usingMultilineEdit.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/usingMultilineEdit.qml
new file mode 100644
index 0000000000..47b48d8601
--- /dev/null
+++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/usingMultilineEdit.qml
@@ -0,0 +1,13 @@
+import Qt 4.7
+
+Rectangle{
+ width: 600
+ height: 200
+ Column{
+ MultilineEdit{
+ text: 'I am the very model of a modern major general. I\'ve information vegetable, animal and mineral. I know the kings of england and I quote the fights historical - from Marathon to Waterloo in order categorical.';
+ width: 182; height: 60;
+ }
+ MultilineEdit{text: 'Hello world'}
+ }
+}
diff --git a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml
index abb446423c..a1dc5bf17f 100644
--- a/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml
+++ b/tests/auto/declarative/qmlvisual/qdeclarativetextedit/wrap.qml
@@ -27,7 +27,7 @@ Item {
TextEdit {
width: 150
height: 100
- wrapMode: TextEdit.WrapAtWordBoundaryOrAnywhere
+ wrapMode: TextEdit.Wrap
text: "This is a test that text edit wraps correctly. thisisaverylongstringwithnospaces"
y:300
}