spawning of windows
[qt-letitsnow] / contents / ui / main.qml
1 /*
2  *   Copyright 2020 Robin Krens <robin@robinkrens.nl>
3  *
4  *   This program is free software; you can redistribute it and/or modify
5  *   it under the terms of the GNU Library General Public License as
6  *   published by the Free Software Foundation; either version 2 or
7  *   (at your option) any later version.
8  *
9  *   This program is distributed in the hope that it will be useful,
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *   GNU General Public License for more details
13  *
14  *   You should have received a copy of the GNU Library General Public
15  *   License along with this program; if not, write to the
16  *   Free Software Foundation, Inc.,
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18  */
19
20 import QtQuick 2.6
21 import QtQuick.Layouts 1.0
22 import QtQuick.Window 2.2
23
24 //import org.kde.plasma.plasmoid 2.0 as Plasmoid
25 //import org.kde.plasma.core 2.0 as PlasmaCore
26 //import org.kde.plasma.components 2.0 as PlasmaComponents
27
28 import QtQuick 2.3
29 import QtQuick.Controls 1.2
30
31 Item {
32         id: root;
33         Button {
34                 anchors.centerIn: parent;
35                 text: "Let it snow!";
36
37                 onClicked: {
38                         var snow = [];
39                         for (var i = 0; i < 10; i++) {
40                                 
41                                 snow[i] = Qt.createComponent("snowWindow.qml");
42                                 var snowWindow = snow[i].createObject(root);
43                                 snowWindow.x = Math.random() * 500;
44                                 snowWindow.y = Math.random() * 500;
45                                 //snowWindow.opacity = 0.9;
46                                 //snowWindow.flags = Qt.WA_TransparentForMouseEvents | Qt.X11BypassWindowManagerHint;
47
48                                 //snowWindow.flags =  Qt.WA_TransparentForMouseEvents| Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint;
49                                 snowWindow.showMaximized();
50                         }
51         }
52     }
53 }