-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHistogram.qml
55 lines (46 loc) · 1.73 KB
/
Histogram.qml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import QtQuick 2.4
HistogramForm
{
id: rootHistogram
property var masRects: []
readonly property int countRects: 15
//Создание спрайта компонента отображения слова
function createSpriteObjects(source, settings)
{
var component = Qt.createComponent(source);
var sprite = component.createObject(rootHistogram, {idStatic: settings["idStatic"],
y: 60 + settings["y"]});
if (sprite === null)
console.log("Error creating object");
return sprite
}
//Создание 15 компонент слова
function createHistogramsRects(mas, count)
{
var paddingRect = 25;
for(var i = 0; i < count; ++i)
{
var sprite = createSpriteObjects("DynamicRect.qml", {idStatic: i, y: paddingRect*i})
mas.push(sprite)
}
}
Component.onCompleted:
{
createHistogramsRects(rootHistogram.masRects, countRects)
}
//!!!!Второй вариант ловли сигналов Filemaanger для обновления данных на гистограме!!!!!
//Connections
//{
// target: rootWindow
// function onMasMapChanged()
// {
// for(var i = 0; i < rootWindow.mapKeys.length; ++i)
// {
// rootHistogram.masRects[i].textElement.text = rootWindow.mapKeys[i]
// rootHistogram.masRects[i].rectFrontCount.width = rootWindow.mapValues[i] / rootWindow.sum * 1000
// }
// //textElement1.text = rootWindow.mapKeys[0]
// //rectFrontCount.width = rootWindow.mapValues[0] / rootWindow.sum * 1000
// }
//}
}