Repeater, Abnormal display
-

Figure 1:Normal
Figure 2,3,4: Once clicked, an exception occasionally appearsHow can I do?
@supper_DM - it'd be helpful to post some of your code so we can see what's going on..
-

Figure 1:Normal
Figure 2,3,4: Once clicked, an exception occasionally appearsHow can I do?
description:
Left-clicking on a space will select it
Right-click the selected point and the menu - Delete will appear
Repeat operations and an exception will occurwin10 + QT5.14 MinGW 64bit
//main.qml---------------------------------------------------------- import QtQuick 2.14 import QtQuick.Controls 2.14 import Qt.labs.platform 1.1 import QtQuick.Window 2.14 Window { visible: true id:rect width: 800 height: 560 maximumWidth: width maximumHeight:height minimumWidth: width minimumHeight: height title: "test" color: "#f0f0f0" property var point_sequence: new Array//(int) Button{ id:btn_all_select x:50 y:30 width: 160 height: 30 text:qsTr("select all") onClicked: { var i for(i=0; i<60; i++) { box_0.point_Select(i) } for(i=0; i<60; i++) { box_1.point_Select(i) } } } Button{ id:btn_all_deSelect x:50 y:80 width: 160 height: 30 text:qsTr("deselect") onClicked: { for(var i in point_sequence) { if(point_sequence[i]<60) { box_0.point_deSelect(point_sequence[i]) } else if(point_sequence[i]<120) { box_1.point_deSelect(point_sequence[i]-60) } } point_sequence = [] } } MyPoint_box3{ id:box_0 anchors.top: parent.top anchors.right: box_1.left anchors.topMargin: 20 anchors.rightMargin: 20 // visible: false property var box_no:0 onSig_point_Select:{ var abs_no = Number(no + 60 * box_no) console.log("onPonit_Select = ", abs_no); var len = point_sequence.length point_sequence.push(abs_no) set_point_index(no, len) } onSig_point_deSelect: { var abs_no = Number(no + 60 * box_no) console.log("onPonit_deSelect = ", abs_no); for(var i in point_sequence) { if(abs_no === point_sequence[i]) { point_sequence.splice(i,1) break; } } reSet_sequence() } } MyPoint_box3{ id:box_1 anchors.top: parent.top anchors.right: parent.right anchors.topMargin: 20 anchors.rightMargin: 20 // visible: false property var box_no:1 onSig_point_Select:{ var abs_no = Number(no + 60 * box_no) console.log("onPonit_Select = ", abs_no); var len = point_sequence.length point_sequence.push(abs_no) set_point_index(no, len) } onSig_point_deSelect: { var abs_no = Number(no + 60 * box_no) console.log("onPonit_deSelect = ", abs_no); for(var i in point_sequence) { if(abs_no === point_sequence[i]) { point_sequence.splice(i,1)//delete break; } } reSet_sequence()//reset index } } function reSet_sequence() { for(var i in point_sequence) { if(point_sequence[i]<60) { box_0.set_point_index(point_sequence[i], i) } else if(point_sequence[i]<120) { box_1.set_point_index(point_sequence[i]-60, i) } } } } //MyPoint_box3.qml--------------------------------------------------- import QtQuick 2.14 import QtQuick.Controls 2.14 import QtCharts 2.14 import QtQuick.Layouts 1.14 Rectangle{ id:rect_main width: 240//40*(5+1) height: 520//40*(12+1) border.width: 2 border.color: "gray" color: "white" radius: 20 signal sig_point_Select(int no) signal sig_point_deSelect(int no) Rectangle{ id:rect_box width: 200//40*(5) height: 480//40*(12) anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter GridLayout{ anchors.fill:parent rows: 12 columns: 5 rowSpacing: 0 columnSpacing: 0 flow:GridLayout.TopToBottom Repeater{ id: myRepeater model: 60 MyPoint { myPos:index onSig_select: { rect_main.sig_point_Select(myPos) } onSig_deSelect: { rect_main.sig_point_deSelect(myPos) } } } } } function set_point_index(no, set_index) { // pointArray[no].myIndex = set_index if(no<60) { myRepeater.itemAt(no).set_index(set_index) } else { console.log("set_point_index--error") } } function point_Select(no) { if(no<60) { myRepeater.itemAt(no).point_Select() } else { console.log("point_Select--error") } } function point_deSelect(no) { // pointArray[no].myIndex = set_index if(no<60) { myRepeater.itemAt(no).point_deSelect() } else { console.log("point_deSelect--error") } } } //MyPoint.qml----------------------------------------------------------- import QtQuick 2.14 import QtQuick.Controls 2.14 import QtQuick.Controls 1.4 as Mycontrol_1_4 import QtGraphicalEffects 1.14 import Qt.labs.platform 1.1 //menu Rectangle { id:rect property int myPos: 0 property int myIndex: 9999 property bool flag_sel: false width: 40 height: 40 signal sig_select(int no) signal sig_deSelect(int no) color: "black" Rectangle{ id:rect_border anchors.fill: parent anchors.margins: 1 color: "white" Rectangle{ id:rect_stat_led width: 20//parent.width/2 height: 20//width radius: 10//width/2 anchors.top: parent.top anchors.topMargin: 2 anchors.horizontalCenter: parent.horizontalCenter color: "red" visible: flag_sel//false } Text { id: text_no text: "0" anchors.top: rect_stat_led.bottom anchors.topMargin: 2 anchors.horizontalCenter: parent.horizontalCenter font.pixelSize: 14 z:parent.z+1 visible: flag_sel//rect_stat_led.visible } } MouseArea{ anchors.fill: rect anchors.margins: 5 // hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton onClicked: { focus = true if(mouse.button === Qt.LeftButton) { if(flag_sel) {//Selected, skip } else { flag_sel = true sig_select(myPos) } } else if(mouse.button === Qt.RightButton) { if(flag_sel) { menu_right.open() } } } } Menu { // Right-click menu id: menu_right MenuItem { text: "delete" onTriggered: { flag_sel = false myIndex = -1 sig_deSelect(myPos) } } } function set_pos(pos) { if(myPos !== pos) { myPos = pos } } function set_index(s_index) { if(myIndex !== s_index) { myIndex = s_index text_no.text = myIndex+1 } } function point_Select() { if(flag_sel) { } else { console.log("Select = ", myPos) flag_sel = true sig_select(myPos) } } function point_deSelect() { flag_sel = false myIndex = -1 } }

When an exception occurs, the window is minimized and normal
-
description:
Left-clicking on a space will select it
Right-click the selected point and the menu - Delete will appear
Repeat operations and an exception will occurwin10 + QT5.14 MinGW 64bit
//main.qml---------------------------------------------------------- import QtQuick 2.14 import QtQuick.Controls 2.14 import Qt.labs.platform 1.1 import QtQuick.Window 2.14 Window { visible: true id:rect width: 800 height: 560 maximumWidth: width maximumHeight:height minimumWidth: width minimumHeight: height title: "test" color: "#f0f0f0" property var point_sequence: new Array//(int) Button{ id:btn_all_select x:50 y:30 width: 160 height: 30 text:qsTr("select all") onClicked: { var i for(i=0; i<60; i++) { box_0.point_Select(i) } for(i=0; i<60; i++) { box_1.point_Select(i) } } } Button{ id:btn_all_deSelect x:50 y:80 width: 160 height: 30 text:qsTr("deselect") onClicked: { for(var i in point_sequence) { if(point_sequence[i]<60) { box_0.point_deSelect(point_sequence[i]) } else if(point_sequence[i]<120) { box_1.point_deSelect(point_sequence[i]-60) } } point_sequence = [] } } MyPoint_box3{ id:box_0 anchors.top: parent.top anchors.right: box_1.left anchors.topMargin: 20 anchors.rightMargin: 20 // visible: false property var box_no:0 onSig_point_Select:{ var abs_no = Number(no + 60 * box_no) console.log("onPonit_Select = ", abs_no); var len = point_sequence.length point_sequence.push(abs_no) set_point_index(no, len) } onSig_point_deSelect: { var abs_no = Number(no + 60 * box_no) console.log("onPonit_deSelect = ", abs_no); for(var i in point_sequence) { if(abs_no === point_sequence[i]) { point_sequence.splice(i,1) break; } } reSet_sequence() } } MyPoint_box3{ id:box_1 anchors.top: parent.top anchors.right: parent.right anchors.topMargin: 20 anchors.rightMargin: 20 // visible: false property var box_no:1 onSig_point_Select:{ var abs_no = Number(no + 60 * box_no) console.log("onPonit_Select = ", abs_no); var len = point_sequence.length point_sequence.push(abs_no) set_point_index(no, len) } onSig_point_deSelect: { var abs_no = Number(no + 60 * box_no) console.log("onPonit_deSelect = ", abs_no); for(var i in point_sequence) { if(abs_no === point_sequence[i]) { point_sequence.splice(i,1)//delete break; } } reSet_sequence()//reset index } } function reSet_sequence() { for(var i in point_sequence) { if(point_sequence[i]<60) { box_0.set_point_index(point_sequence[i], i) } else if(point_sequence[i]<120) { box_1.set_point_index(point_sequence[i]-60, i) } } } } //MyPoint_box3.qml--------------------------------------------------- import QtQuick 2.14 import QtQuick.Controls 2.14 import QtCharts 2.14 import QtQuick.Layouts 1.14 Rectangle{ id:rect_main width: 240//40*(5+1) height: 520//40*(12+1) border.width: 2 border.color: "gray" color: "white" radius: 20 signal sig_point_Select(int no) signal sig_point_deSelect(int no) Rectangle{ id:rect_box width: 200//40*(5) height: 480//40*(12) anchors.horizontalCenter: parent.horizontalCenter anchors.verticalCenter: parent.verticalCenter GridLayout{ anchors.fill:parent rows: 12 columns: 5 rowSpacing: 0 columnSpacing: 0 flow:GridLayout.TopToBottom Repeater{ id: myRepeater model: 60 MyPoint { myPos:index onSig_select: { rect_main.sig_point_Select(myPos) } onSig_deSelect: { rect_main.sig_point_deSelect(myPos) } } } } } function set_point_index(no, set_index) { // pointArray[no].myIndex = set_index if(no<60) { myRepeater.itemAt(no).set_index(set_index) } else { console.log("set_point_index--error") } } function point_Select(no) { if(no<60) { myRepeater.itemAt(no).point_Select() } else { console.log("point_Select--error") } } function point_deSelect(no) { // pointArray[no].myIndex = set_index if(no<60) { myRepeater.itemAt(no).point_deSelect() } else { console.log("point_deSelect--error") } } } //MyPoint.qml----------------------------------------------------------- import QtQuick 2.14 import QtQuick.Controls 2.14 import QtQuick.Controls 1.4 as Mycontrol_1_4 import QtGraphicalEffects 1.14 import Qt.labs.platform 1.1 //menu Rectangle { id:rect property int myPos: 0 property int myIndex: 9999 property bool flag_sel: false width: 40 height: 40 signal sig_select(int no) signal sig_deSelect(int no) color: "black" Rectangle{ id:rect_border anchors.fill: parent anchors.margins: 1 color: "white" Rectangle{ id:rect_stat_led width: 20//parent.width/2 height: 20//width radius: 10//width/2 anchors.top: parent.top anchors.topMargin: 2 anchors.horizontalCenter: parent.horizontalCenter color: "red" visible: flag_sel//false } Text { id: text_no text: "0" anchors.top: rect_stat_led.bottom anchors.topMargin: 2 anchors.horizontalCenter: parent.horizontalCenter font.pixelSize: 14 z:parent.z+1 visible: flag_sel//rect_stat_led.visible } } MouseArea{ anchors.fill: rect anchors.margins: 5 // hoverEnabled: true acceptedButtons: Qt.LeftButton | Qt.RightButton onClicked: { focus = true if(mouse.button === Qt.LeftButton) { if(flag_sel) {//Selected, skip } else { flag_sel = true sig_select(myPos) } } else if(mouse.button === Qt.RightButton) { if(flag_sel) { menu_right.open() } } } } Menu { // Right-click menu id: menu_right MenuItem { text: "delete" onTriggered: { flag_sel = false myIndex = -1 sig_deSelect(myPos) } } } function set_pos(pos) { if(myPos !== pos) { myPos = pos } } function set_index(s_index) { if(myIndex !== s_index) { myIndex = s_index text_no.text = myIndex+1 } } function point_Select() { if(flag_sel) { } else { console.log("Select = ", myPos) flag_sel = true sig_select(myPos) } } function point_deSelect() { flag_sel = false myIndex = -1 } }

When an exception occurs, the window is minimized and normal
@supper_DM - without actually trying your code, I notice a potential problem.
Point or ponit?, there is a mixture of the two words, I assume ponit is a typo of point?, I'm not sure if this makes any difference.
I'll paste and play with your code a bit later, I'm at work at the moment ;)
What output, if any, do you get in console by way of errors?
-
@supper_DM - without actually trying your code, I notice a potential problem.
Point or ponit?, there is a mixture of the two words, I assume ponit is a typo of point?, I'm not sure if this makes any difference.
I'll paste and play with your code a bit later, I'm at work at the moment ;)
What output, if any, do you get in console by way of errors?
@Markkyboy , I am very sory. The code upload was repeated. I'm going out. I'll upload it in a few days
-
@Markkyboy , I am very sory. The code upload was repeated. I'm going out. I'll upload it in a few days
@supper_DM - no worries, it does seem a little mixed up/repeated.
-
@supper_DM - no worries, it does seem a little mixed up/repeated.
@Markkyboy ,I am comming and reupload the code.
-
@Markkyboy ,I am comming and reupload the code.
@supper_DM
The raspberry PI tests were normal
-
@supper_DM
The raspberry PI tests were normal
@supper_DM - I finally got your code to compile with a few adjustments using Row to tidy things up and make it "human readable" for me.
I've compiled it on my SailfishOS phone (Sony Xperia 10 II) but the squares are so small, I need to make it so I can see it properly (my eyesight is not brilliant with small objects).
I'll play later, right now, I've family issues to deal with. I don't see any of the artefacts you first mentioned.....is it fixed now?
-
@supper_DM - I finally got your code to compile with a few adjustments using Row to tidy things up and make it "human readable" for me.
I've compiled it on my SailfishOS phone (Sony Xperia 10 II) but the squares are so small, I need to make it so I can see it properly (my eyesight is not brilliant with small objects).
I'll play later, right now, I've family issues to deal with. I don't see any of the artefacts you first mentioned.....is it fixed now?
@Markkyboy
I found a solution,add a code:
QCoreApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);//add -
S supper_DM has marked this topic as solved on