def METHOD_NAME(self, event: QResizeEvent):
    if self.ui.graphicsViewSpectrogram and self.ui.graphicsViewSpectrogram.sceneRect():
        self.ui.graphicsViewSpectrogram.fitInView(self.ui.graphicsViewSpectrogram.sceneRect())