I have a simple CheckBox es list, one for each day of the week. They depend on the value of days , an integer using a mask, 1 bit for each CheckBox .
The purpose of days is with both the “clear all” button and the “install all” button, and they are updated. However, after clicking on any of the mailboxes, they will no longer respond to changes in the days dependent property.
Why is this? They somehow become disconnected. If so, do I have to manually bandage them, and if so, why?
Here is the code
import QtQuick 2.7 import QtQuick.Controls 1.4 import QtQuick.Layouts 1.3 ApplicationWindow { visible: true width: 800 height: 400 property int days: 0 ColumnLayout { Repeater { model: ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"] CheckBox { text: modelData checked: (days & (1<<index)) != false onClicked: { if (checked) days |= (1<<index); else days &= ~(1<<index); } } } Button { text: "clear all" onClicked: days = 0 } Button { text: "set all" onClicked: days = 127 } } }
which is as follows:

To reproduce the problem, first click Install All and Clear All. then click on some checkboxes. Then click Install All and Clear All again. You will see that the checkboxes you checked are no longer affected.
thanks.
source share