Bonjour,
je débute en Qt, j'ai repris le projet "touch" pour le modifier.
Je souhaite simplement tester l'id d'un item d'un stask view et rendre visible suivant la page les boutons des toolsBars.
Dans le but de faire des toolsBar personnaliser par page.
Je n'arrive pas à tester l'id de la view courante et en fonction masquer ou pas les boutons.
le stackview.get() renvoi souvent Null.
j'ai essayé aussi en l'appelant avec stackview.deph-1. (1élement==> indice 0)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 ToolBar { RowLayout { id:row function testIdView(str) { var current_item; console.log("index : " + Stack.index ); console.log("stack active:" + Stack.Active) if (Stack.index !== -1) { current_item = stackView.get(Stack.index,true); console.log("depth : " + stackView.depth +" "+ current_item); if (current_item !== null) { console.log("id : " + current_item.id); if (current_item.id === str) return true; else return false; //Finsi } } else if (str === "initial") return true; else return false; //Finsi } anchors.fill: parent ToolButton { visible:row.testIdView("bouton") iconSource:"images/toolbar.png" } } }
dans ButtonPage.qml
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 import QtQuick 2.2 import QtQuick.Controls 1.2 import QtQuick.Controls.Styles 1.1 Item { width: parent.width height: parent.height id:bouton property real progress: 0 SequentialAnimation on progress { loops: Animation.Infinite running: true NumberAnimation { from: 0 .....
sortie:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10 Starting C:\Users\travel\Desktop\essai qt\build-touch-Desktop_Qt_5_5_0_MinGW_32bit-Debug\debug\touch.exe... QML debugging is enabled. Only use this in a safe environment. qml: index : -1 qml: stack active:3 file:///C:/Qt/5.5/mingw492_32/qml/QtQuick/Controls/ToolBar.qml:142:9: QML Item: Binding loop detected for property "layoutHeight" file:///C:/Qt/5.5/mingw4 92_32/qml/QtQuick/Controls/ToolBar.qml:142:9: QML Item: Binding loop detected for property "layoutHeight" qrc:/main.qml:104:13: QML ToolBar: Binding loop detected for property "implicitHeight" qrc:/main.qml:104:13: QML ToolBar: Binding loop detected for property "width" qrc:/main.qml:104:13: QML ToolBar: Binding loop detected for property "width" C:\Users\travel\Desktop\essai qt\build-touch-Desktop_Qt_5_5_0_MinGW_32bit-Debug\debug\touch.exe exited with code 0
Partager