Noushadali
Noushadali

Reputation: 86

QDialog with WindowModal modality looses the WindwoTitle on Mac

I want to make a QDialog with WindowModal on Mac as follows.

class Wid(QWidget):
    def __init__(self, parent = None):
        super().__init__(parent=parent)
        self.setWindowTitle("Parent Widget")
        layout = QHBoxLayout(self)
        button = QPushButton("Dialog", parent=self)
        button.clicked.connect(self._show_dialog)

        checkbox = QCheckBox("Check")
        layout.addWidget(button)
        layout.addWidget(checkbox)
        self.setMinimumSize(400, 200)

    def _show_dialog(self):
        dialog = QDialog(parent=self)
        dialog.setWindowTitle("This is a Test Dialog")
        dialog.setMinimumSize(600, 200)
        dialog.setWindowModality(Qt.WindowModal)
        dialog.show()


if __name__ == "__main__":
    app = QApplication([])
    wid = Wid()
    wid.show()
    sys.exit(app.exec_())

I get the dialog without the window title. enter image description here

Why setting the WindowModal makes the dialog more like a popup ?

If I set to

dialog.setWindowModality(Qt.ApplicationModal)

then everything works as fine enter image description here

Upvotes: 0

Views: 25

Answers (0)

Related Questions