~ubuntu-sdk-team/ubuntu-ui-toolkit/orientationManual

« back to all changes in this revision

Viewing changes to tests/autopilot/ubuntuuitoolkit/tests/custom_proxy_objects/test_listitem.ListViewWithLiveDraggingTestCase.qml

  • Committer: CI Train Bot
  • Author(s): Leo Arias, Christian Dywan, Nekhelesh Ramananthan, Tim Peeters, Zoltán Balogh
  • Date: 2015-03-27 12:35:52 UTC
  • mfrom: (1000.433.19 last_bugfix_vivid)
  • Revision ID: ci-train-bot@canonical.com-20150327123552-mdwg6mecr05akf0q
The very last bugfix landing for Vivid

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright 2015 Canonical Ltd.
 
3
 *
 
4
 * This program is free software; you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License as published by
 
6
 * the Free Software Foundation; version 3.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 */
 
16
 
 
17
import QtQuick 2.0
 
18
import Ubuntu.Components 1.2
 
19
 
 
20
MainView {
 
21
    width: units.gu(48)
 
22
    height: units.gu(60)
 
23
    objectName: "mainView"
 
24
 
 
25
    Page {
 
26
        id: testPage
 
27
        objectName: "test_page"
 
28
        title: listView.ViewItems.dragMode ? "In drag mode" : "Test app"
 
29
        ListView {
 
30
            id: listView
 
31
            objectName: "test_view"
 
32
            ViewItems.objectName: "test_attached"
 
33
            ViewItems.onDragUpdated: {
 
34
                if (event.status == ListItemDrag.Moving) {
 
35
                    model.move(event.from, event.to, 1)
 
36
                }
 
37
            }
 
38
 
 
39
            anchors.fill: parent
 
40
            model: ListModel {
 
41
                Component.onCompleted: {
 
42
                    for (var i = 0; i < 25; i++) {
 
43
                        append({data: i});
 
44
                    }
 
45
                }
 
46
            }
 
47
            moveDisplaced: Transition {
 
48
                UbuntuNumberAnimation {
 
49
                    properties: "y";
 
50
                }
 
51
            }
 
52
            delegate: ListItem {
 
53
                objectName: "listitem" + index
 
54
                ListView.objectName: "bumm"
 
55
                onPressAndHold: ListView.view.ViewItems.dragMode = !ListView.view.ViewItems.dragMode
 
56
                Label {
 
57
                    text: "List item #" + modelData
 
58
                }
 
59
            }
 
60
        }
 
61
    }
 
62
}