From 684c1ca249a30abefbb6fcf690258f3225e526c8 Mon Sep 17 00:00:00 2001 From: signedav Date: Thu, 15 Dec 2022 11:32:28 +0100 Subject: [PATCH] set group checked state if QGIS is later than 3.30 (before this has been not possible) See https://github.com/qgis/QGIS/pull/51195 --- toppingmaker/projecttopping.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/toppingmaker/projecttopping.py b/toppingmaker/projecttopping.py index fadd180..1566e43 100644 --- a/toppingmaker/projecttopping.py +++ b/toppingmaker/projecttopping.py @@ -401,13 +401,13 @@ def make_items( maptheme_item[expanded_groupnode] = {} maptheme_item[expanded_groupnode]["group"] = True maptheme_item[expanded_groupnode]["expanded"] = True - # setHasCheckedStateInfo(True) is not available in the API, what makes it impossible to control the checked state of a group - # see https://github.com/SebastienPeillet/QGIS/commit/736e46daa640b8a9c66107b4f05319d6d2534ac5#discussion_r1037225879 - for checked_groupnode in maptheme_record.checkedGroupNodes(): - if checked_groupnode not in maptheme_item: - maptheme_item[checked_groupnode] = {} - maptheme_item[checked_groupnode]["group"] = True - maptheme_item[checked_groupnode]["checked"] = True + if Qgis.QGIS_VERSION_INT >= 33000: + if maptheme_record.hasCheckedStateInfo(): + for checked_groupnode in maptheme_record.checkedGroupNodes(): + if checked_groupnode not in maptheme_item: + maptheme_item[checked_groupnode] = {} + maptheme_item[checked_groupnode]["group"] = True + maptheme_item[checked_groupnode]["checked"] = True self[name] = maptheme_item