Skip to content

Commit 5854ccc

Browse files
committed
fix: modal windows now have the Qt.Dialog flag
Set the Qt.Dialog flag for modal windows, such as "Add Field" so that they will be seen as dialogs in the backend. This change is unlikely to be at all noticeable in systems like Windows, but for users running tiling window managers like bspwm or Sway, this will prevent these modal windows from being tiled alongside the main window, instead they will be floating on top, which is the expected behaviour seen on floating window managers, like the ones used by Windows and macOS. Added self.setWindowFlag(Qt.Dialog, on=True) # type: ignore to the following files: - tagstudio/src/qt/modals/add_field.py - tagstudio/src/qt/modals/delete_unlinked.py - tagstudio/src/qt/modals/drop_import.py - tagstudio/src/qt/modals/file_extension.py - tagstudio/src/qt/modals/fix_dupes.py - tagstudio/src/qt/modals/fix_unlinked.py - tagstudio/src/qt/modals/folders_to_tags.py - tagstudio/src/qt/modals/mirror_entities.py - tagstudio/src/qt/widgets/paged_panel/paged_panel.py - tagstudio/src/qt/widgets/panel.py - tagstudio/src/qt/widgets/progress.py Note that without adding # type: ignore, MyPy *will* give out an error, presumably because PySide6 is missing type hints for several things, and this may *or* may not be a justifiable use of # type: ignore, which throws the MyPy type checking for that line out the window. Ref: #392, #464
1 parent a25ef8c commit 5854ccc

11 files changed

+11
-0
lines changed

tagstudio/src/qt/modals/add_field.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def __init__(self, library: Library):
3131
self.setMinimumSize(400, 300)
3232
self.root_layout = QVBoxLayout(self)
3333
self.root_layout.setContentsMargins(6, 6, 6, 6)
34+
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore
3435

3536
self.title_widget = QLabel()
3637
self.title_widget.setObjectName("fieldTitle")

tagstudio/src/qt/modals/delete_unlinked.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def __init__(self, driver: "QtDriver", tracker: MissingRegistry):
3636
self.setMinimumSize(500, 400)
3737
self.root_layout = QVBoxLayout(self)
3838
self.root_layout.setContentsMargins(6, 6, 6, 6)
39+
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore
3940

4041
self.desc_widget = QLabel()
4142
self.desc_widget.setObjectName("descriptionLabel")

tagstudio/src/qt/modals/drop_import.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def __init__(self, driver: "QtDriver"):
4747
self.setMinimumSize(500, 400)
4848
self.root_layout = QVBoxLayout(self)
4949
self.root_layout.setContentsMargins(6, 6, 6, 6)
50+
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore
5051

5152
self.desc_widget = QLabel()
5253
self.desc_widget.setObjectName("descriptionLabel")

tagstudio/src/qt/modals/file_extension.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ def __init__(self, library: "Library"):
4141
self.setMinimumSize(240, 400)
4242
self.root_layout = QVBoxLayout(self)
4343
self.root_layout.setContentsMargins(6, 6, 6, 6)
44+
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore
4445

4546
# Create Table Widget --------------------------------------------------
4647
self.table = QTableWidget(len(self.lib.prefs(LibraryPrefs.EXTENSION_LIST)), 1)

tagstudio/src/qt/modals/fix_dupes.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ def __init__(self, library: "Library", driver: "QtDriver"):
3636
self.setMinimumSize(400, 300)
3737
self.root_layout = QVBoxLayout(self)
3838
self.root_layout.setContentsMargins(6, 6, 6, 6)
39+
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore
3940

4041
self.tracker = DupeRegistry(library=self.lib)
4142

tagstudio/src/qt/modals/fix_unlinked.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def __init__(self, library: "Library", driver: "QtDriver"):
3535
self.setMinimumSize(400, 300)
3636
self.root_layout = QVBoxLayout(self)
3737
self.root_layout.setContentsMargins(6, 6, 6, 6)
38+
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore
3839

3940
self.unlinked_desc_widget = QLabel()
4041
self.unlinked_desc_widget.setObjectName("unlinkedDescriptionLabel")

tagstudio/src/qt/modals/folders_to_tags.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ def __init__(self, library: "Library", driver: "QtDriver"):
168168
self.setMinimumSize(640, 640)
169169
self.root_layout = QVBoxLayout(self)
170170
self.root_layout.setContentsMargins(6, 6, 6, 6)
171+
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore
171172

172173
self.title_widget = QLabel()
173174
self.title_widget.setObjectName("title")

tagstudio/src/qt/modals/mirror_entities.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ def __init__(self, driver: "QtDriver", tracker: DupeRegistry):
3737
self.root_layout = QVBoxLayout(self)
3838
self.root_layout.setContentsMargins(6, 6, 6, 6)
3939
self.tracker = tracker
40+
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore
4041

4142
self.desc_widget = QLabel()
4243
self.desc_widget.setObjectName("descriptionLabel")

tagstudio/src/qt/widgets/paged_panel/paged_panel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ def __init__(self, size: tuple[int, int], stack: list[PagedPanelState]):
3131
self.root_layout.setObjectName("baseLayout")
3232
self.root_layout.setAlignment(Qt.AlignmentFlag.AlignCenter)
3333
self.root_layout.setContentsMargins(0, 0, 0, 0)
34+
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore
3435

3536
self.content_container = QWidget()
3637
self.content_layout = QVBoxLayout(self.content_container)

tagstudio/src/qt/widgets/panel.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ def __init__(
3232
self.setWindowModality(Qt.WindowModality.ApplicationModal)
3333
self.root_layout = QVBoxLayout(self)
3434
self.root_layout.setContentsMargins(6, 0, 6, 6)
35+
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore
3536

3637
self.title_widget = QLabel()
3738
self.title_widget.setObjectName("fieldTitle")

tagstudio/src/qt/widgets/progress.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ def __init__(
3535
self.setWindowFlags(self.pb.windowFlags() & ~Qt.WindowType.WindowCloseButtonHint)
3636
self.setWindowTitle(window_title)
3737
self.setWindowModality(Qt.WindowModality.ApplicationModal)
38+
self.setWindowFlag(Qt.Dialog, on=True) # type: ignore
3839

3940
def update_label(self, text: str):
4041
self.pb.setLabelText(text)

0 commit comments

Comments
 (0)