code: def _update_viewport_margins(self):
          
          top = 0
          left = 0
          right = 0
          bottom = 0
          for panel in self.panels_for_zone(Panel.Position.LEFT):
              if panel.isVisible():
                  width = panel.sizeHint().width()
                  left += width
          for panel in self.panels_for_zone(Panel.Position.RIGHT):
              if panel.isVisible():
                  width = panel.sizeHint().width()
                  right += width
          for panel in self.panels_for_zone(Panel.Position.TOP):
              if panel.isVisible():
                  height = panel.sizeHint().height()
                  top += height
          for panel in self.panels_for_zone(Panel.Position.BOTTOM):
              if panel.isVisible():
                  height = panel.sizeHint().height()
                  bottom += height
          self._margin_sizes = (top, left, right, bottom)
          self.editor.setViewportMargins(left, top, right, bottom)
docs: Update viewport margins.