Skip to content

Commit

Permalink
Merge pull request #599 from opengisch/QF-4545-selection_deselection_…
Browse files Browse the repository at this point in the history
…all_directories_fix

First attempt to fix the select/deselect all folder in QFieldSync
  • Loading branch information
suricactus authored Jul 15, 2024
2 parents 9e980d6 + 009c984 commit bf7e59f
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions qfieldsync/gui/dirs_to_copy_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,14 +145,11 @@ 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()):
set_checked_state(item.child(i))

set_checked_state(self.dirsTreeWidget.invisibleRootItem())

0 comments on commit bf7e59f

Please sign in to comment.