From 7e31391678a5e022fe1aa91cd2526357025af0f6 Mon Sep 17 00:00:00 2001 From: Johnny Sequeira Date: Wed, 10 Jul 2024 18:15:20 -0600 Subject: [PATCH 1/3] First attempt to fix the check in QTreeWidgetItem --- qfieldsync/gui/dirs_to_copy_widget.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/qfieldsync/gui/dirs_to_copy_widget.py b/qfieldsync/gui/dirs_to_copy_widget.py index 0cf6ef30..59986e34 100644 --- a/qfieldsync/gui/dirs_to_copy_widget.py +++ b/qfieldsync/gui/dirs_to_copy_widget.py @@ -145,14 +145,14 @@ def save_settings(self) -> None: self.preferences.set_value("dirsToCopy", self.dirs_to_copy()) def _set_checked_state_recursively(self, checked: bool) -> None: - def set_checked_state(root_item: QTreeWidgetItem) -> Dict[str, bool]: - for i in range(root_item.childCount()): - item = root_item.child(i) - checked_state = Qt.Checked if checked else Qt.Unchecked - print(i, checked_state) - item.setCheckState(i, checked_state) + def set_checked_state(item: QTreeWidgetItem) -> None: + checked_state = Qt.Checked if checked else Qt.Unchecked + item.setCheckState(0, checked_state) - if item.childCount() > 0: - set_checked_state(item) + for i in range(item.childCount()): + child_item = item.child(i) + set_checked_state(child_item) + # print(i, checked_state) set_checked_state(self.dirsTreeWidget.invisibleRootItem()) + From fc09ea6ad8c52bc5585fcf886b465ca465cc65cf Mon Sep 17 00:00:00 2001 From: Johnny Sequeira Date: Sat, 13 Jul 2024 01:12:09 -0600 Subject: [PATCH 2/3] Fix end-of-file newlines --- qfieldsync/gui/dirs_to_copy_widget.py | 1 - 1 file changed, 1 deletion(-) diff --git a/qfieldsync/gui/dirs_to_copy_widget.py b/qfieldsync/gui/dirs_to_copy_widget.py index 59986e34..aa319b0d 100644 --- a/qfieldsync/gui/dirs_to_copy_widget.py +++ b/qfieldsync/gui/dirs_to_copy_widget.py @@ -155,4 +155,3 @@ def set_checked_state(item: QTreeWidgetItem) -> None: # print(i, checked_state) set_checked_state(self.dirsTreeWidget.invisibleRootItem()) - From 009c9848d4fac9418c70d0a890f2c8dcbf330415 Mon Sep 17 00:00:00 2001 From: Johnny <77129293+SeqLaz@users.noreply.github.com> Date: Sun, 14 Jul 2024 12:10:30 -0600 Subject: [PATCH 3/3] Update qfieldsync/gui/dirs_to_copy_widget.py Co-authored-by: Ivan Ivanov --- qfieldsync/gui/dirs_to_copy_widget.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/qfieldsync/gui/dirs_to_copy_widget.py b/qfieldsync/gui/dirs_to_copy_widget.py index aa319b0d..67b5060c 100644 --- a/qfieldsync/gui/dirs_to_copy_widget.py +++ b/qfieldsync/gui/dirs_to_copy_widget.py @@ -150,8 +150,6 @@ def set_checked_state(item: QTreeWidgetItem) -> None: item.setCheckState(0, checked_state) for i in range(item.childCount()): - child_item = item.child(i) - set_checked_state(child_item) - # print(i, checked_state) + set_checked_state(item.child(i)) set_checked_state(self.dirsTreeWidget.invisibleRootItem())