fixed set focus for dictionary widget

This commit is contained in:
iLLiCiTiT 2021-08-26 12:15:24 +02:00
parent 75f3dca1ce
commit 5578784360
2 changed files with 21 additions and 0 deletions

View file

@ -89,6 +89,25 @@ class DictImmutableKeysWidget(BaseWidget):
self._prepare_entity_layouts(child["children"], wrapper)
def set_focus(self, scroll_to=False):
"""Set focus of a widget.
Args:
scroll_to(bool): Also scroll to widget in category widget.
"""
if self.body_widget:
if scroll_to:
self.scroll_to(self.body_widget.top_part)
self.body_widget.top_part.setFocus()
else:
if scroll_to:
if not self.input_fields:
self.scroll_to(self)
else:
self.scroll_to(self.input_fields[0])
self.setFocus()
def _ui_item_base(self):
self.setObjectName("DictInvisible")

View file

@ -221,6 +221,8 @@ class ExpandingWidget(QtWidgets.QWidget):
self.main_layout.setSpacing(0)
self.main_layout.addWidget(top_part)
self.top_part = top_part
def hide_toolbox(self, hide_content=False):
self.button_toggle.setArrowType(QtCore.Qt.NoArrow)
self.toolbox_hidden = True