Skip to content

Commit

Permalink
Fix generated designer form layout if attributeEditorContainer contai…
Browse files Browse the repository at this point in the history
…ns children which are not attributeEditorContainer or attributeEditorField
  • Loading branch information
manisandro committed Apr 2, 2024
1 parent 8a35cd1 commit b430bb9
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/config_generator/dnd_form_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,12 +320,14 @@ def __add_tablayout_fields(self, maplayer, project, parent, container, aliases):
ncols = int(container.get('columnCount', '1'))

for child in container:
added = False
if child.tag == "attributeEditorContainer":
item = ElementTree.Element("item")
item.set("row", str(row))
item.set("column", str(col))
item.set("colspan", "2")
layout.append(item)
added = True

if child.get('groupBox') == "0":
if not tabWidget:
Expand Down Expand Up @@ -363,6 +365,7 @@ def __add_tablayout_fields(self, maplayer, project, parent, container, aliases):
editorItem.set("column", str(col + 1))
editorItem.append(editorWidget)
layout.append(editorItem)
added = True

if child.get("showLabel") == "1":
labelItem = ElementTree.Element("item")
Expand All @@ -375,6 +378,9 @@ def __add_tablayout_fields(self, maplayer, project, parent, container, aliases):
label = aliases.get(child.get("name"), child.get("name"))
self.__add_widget_property(labelWidget, "text", None, None, label)
labelItem.append(labelWidget)
else:
editorItem.set("column", str(col))
editorItem.set("colspan", "2")
elif child.tag == "attributeEditorRelation":
tabWidget = None

Expand All @@ -389,11 +395,13 @@ def __add_tablayout_fields(self, maplayer, project, parent, container, aliases):
relationItem.set("colspan", "2")
relationItem.append(relationWidget)
layout.append(relationItem)
added = True

col += 2
if col >= 2 * ncols:
col = 0
row += 1
if added:
col += 2
if col >= 2 * ncols:
col = 0
row += 1

item = ElementTree.Element("item")
item.set("row", str(row + 1))
Expand Down

0 comments on commit b430bb9

Please sign in to comment.