~gerboland/+junk/windowmanager

« back to all changes in this revision

Viewing changes to WindowModel.qml

  • Committer: Gerry Boland
  • Date: 2015-01-26 16:17:22 UTC
  • Revision ID: gerry.boland@canonical.com-20150126161722-1zunz60xatflhezj
Make dedicated WindowModel object

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import QtQuick 2.2
 
2
 
 
3
ListModel {
 
4
    id: root
 
5
 
 
6
    property int counter: 0
 
7
 
 
8
    function addWindow() {
 
9
        windowList.append({
 
10
                              "title": counter,
 
11
                              "windowWidth": getRandInRange(200,600),
 
12
                              "windowHeight": getRandInRange(200,600),
 
13
                              "initialX": getRandInRange(0,400),
 
14
                              "initialY": getRandInRange(0,400),
 
15
                          });
 
16
        counter++;
 
17
    }
 
18
 
 
19
    function getRandInRange(min, max) {
 
20
        return Math.random() * (max - min) + min;
 
21
    }
 
22
}