Skip to content

Commit

Permalink
Honour DnD form font style properties
Browse files Browse the repository at this point in the history
  • Loading branch information
manisandro committed Jan 8, 2025
1 parent 5e9c005 commit c77345a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions src/config_generator/dnd_form_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ def __add_tablayout_fields(self, maplayer, projectname, layername, project, pare
if child.get('showLabel') == "1":
widget.set("class", "QGroupBox")
self.__add_widget_property(widget, "title", child, "name")
self.__add_label_style_properties(widget, child.find("labelStyle"))
else:
widget.set("class", "QFrame")
self.__add_widget_property(widget, "visibilityExpression", None, None, child.get("visibilityExpression"))
Expand Down Expand Up @@ -393,6 +394,7 @@ def __add_tablayout_fields(self, maplayer, projectname, layername, project, pare
labelWidget.set("class", "QLabel")
label = aliases.get(child.get("name"), child.get("name"))
self.__add_widget_property(labelWidget, "text", None, None, label)
self.__add_label_style_properties(labelWidget, child.find("labelStyle"))
labelItem.append(labelWidget)
else:
editorItem.set("column", str(col))
Expand Down Expand Up @@ -476,3 +478,23 @@ def __add_autolayout_fields(self, maplayer, projectname, layername, project, par
layout.append(item)
row += 1

def __add_label_style_properties(self, widget, labelStyle):
if labelStyle is None:
return
added = False
font = ElementTree.Element("font")
if labelStyle.get("overrideLabelFont") == "1":
labelFont = labelStyle.find("labelFont")
if labelFont is not None:
propMap = {"bold": "bold", "italic": "italic", "underline": "underline", "strikethrough": "strikeout"}
for prop, elName in propMap.items():
if labelFont.get(prop) == "1":
propEl = ElementTree.Element(elName)
propEl.text = "true"
font.append(propEl)
added = True
if added:
prop = ElementTree.Element("property")
prop.set("name", "font")
prop.append(font)
widget.append(prop)

0 comments on commit c77345a

Please sign in to comment.