Skip to content

Commit c1d22fa

Browse files
allow to give a parent window
1 parent d3c9702 commit c1d22fa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

qt_jsonschema_form/form.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ def __init__(self, validator_cls=None):
5151
self.widget_map = deepcopy(self.default_widget_map)
5252
self.validator_cls = validator_cls
5353

54-
def create_form(self, schema: dict, ui_schema: dict, state=None) -> widgets.SchemaWidgetMixin:
54+
def create_form(self, schema: dict, ui_schema: dict, state=None, parent=None) -> widgets.SchemaWidgetMixin:
5555
validator_cls = self.validator_cls
5656
if validator_cls is None:
5757
validator_cls = validator_for(schema)
5858

5959
validator_cls.check_schema(schema)
6060
validator = validator_cls(schema)
6161
schema_widget = self.create_widget(schema, ui_schema, state)
62-
form = widgets.FormWidget(schema_widget)
62+
form = widgets.FormWidget(schema_widget, parent)
6363

6464
def validate(data):
6565
"""Show the error widget iff there are errors, and the error messages

qt_jsonschema_form/widgets.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,8 +572,8 @@ def _index_changed(self, index: int):
572572

573573
class FormWidget(QtWidgets.QWidget):
574574

575-
def __init__(self, widget: SchemaWidgetMixin):
576-
super().__init__()
575+
def __init__(self, widget: SchemaWidgetMixin, parent=parent):
576+
super().__init__(parent=parent)
577577
layout = QtWidgets.QVBoxLayout()
578578
self.setLayout(layout)
579579

0 commit comments

Comments
 (0)