Hillbilly Joe
Hillbilly Joe

Reputation: 75

Subwindow in PyQt6 has no closing button

I am not a professional programmer. However, I am asked to finish a project previously done by other professional. The previous developer created this application using Windows machine. I am working on MacOS ventura 13.4.1. The application calls a subwindow by:

def on_image_area_picker_triggered(self):
        """
        Callback for the user pressing the area selection toolbar action. Opens the area selection
        user interface.
        """
        self.area_window = AreaSelectionWindow(self.calculation_area, self)
        self.area_window.setWindowFlag(QtCore.Qt.WindowType.Window, True) # Must be separate window
        self.area_window.setWindowFlag(QtCore.Qt.WindowType.Tool, True) # Must stay on top of parent
        self.area_window.setWindowModality(QtCore.Qt.WindowModality.WindowModal) # Must steal focus
        self.area_window.resize(500, 400)
        self.area_window.show()
        self.area_window.new_area.connect(self.on_area_window_new_area)
        self.area_window.clear_area.connect(self.on_area_window_new_area)

The part of the init of this subwindow is implemented as:

class AreaSelectionWindow(QtWidgets.QWidget):
    """
    User interface for selecting an area of an image to use for detecting oxygenation from.
    """
    # New area has been selected or loaded by the user
    new_area = QtCore.pyqtSignal(np.ndarray)
    # Any selected area has been cleared by the user
    clear_area = QtCore.pyqtSignal()

    def __init__(self, area_data: np.ndarray[np.float64]|None, parent: QtWidgets.QWidget|None):
        """
        Create the area selection window.

        :param area_data: Numpy array of an existing selected area. None if no existing area is
        selected. If the user has selected an area before and closed the window, this is probably
        not None.
        :param parent: Qt parent of this QWidget.
        """
        super().__init__(parent)

        self.setWindowTitle(self.tr("Area selection"))

enter image description here The problem here is that there are no standard controls on the upper border of the window. In fact, there is no even upper border. I already googled, had long conversations with ChatGPT but nothing works. Anyone has experience with such an issue?

Upvotes: 0

Views: 152

Answers (0)

Related Questions