title: How to place widget correctly in QGraphicsScene
body: <p>I'm trying to implement a widget (an improvised toolbox) that will be placed on the right side of the scene. 
  It should looks like this: </p>
  
  <p><img src="https://i.imgur.com/48b2t9Y.png" alt="problem"></p>
  
  <p>There's a problem to place it correctly there and keep at the same size and position while moving and scaling the view.</p>
  
  <p>The widget itself is a QComboBox. I tryed to put it in a scene as a QGraphicsWidget, set a ZValue to a high number and set it to QGraphicsLinearLayout. Unfortunately, i can't align it to the left side and i feel that I'm doing it in a wrong way.</p>
  
  <p>Here's a sketch:</p>
  
  <pre class="lang-py prettyprint-override"><code>from PySide2 import QtWidgets, QtCore, QtGui
  import sys
  
  def hex2QColor(color):
      r = int(color[0:2], 16)
      g = int(color[2:4], 16)
      b = int(color[4:6], 16)
      return QtGui.QColor(r, g, b)
  
  class rotateGroupBox(QtWidgets.QGroupBox):
      """Create content to fill the widget"""
      def __init__(self, parent=None):
          super(rotateGroupBox, self).__init__(parent)
  
          self.setTitle("Rotation")
  
          self.l_rotate = QtWidgets.QSpinBox()
          self.l_rotate.setRange(0, 360)
  
          self.r_rotate = QtWidgets.QSpinBox()
          self.r_rotate.setRange(0, 360)
  
          self.l_label = QtWidgets.QLabel("Left: ")
          self.r_label = QtWidgets.QLabel("Right: ")
  
          layout = QtWidgets.QVBoxLayout()
  
          l1 = QtWidgets.QHBoxLayout()
          l1.setContentsMargins(0,0,0,0)
          l1.addWidget(self.l_label)
          l1.addWidget(self.l_rotate)
  
          l2 = QtWidgets.QHBoxLayout()
          l2.setContentsMargins(0, 0, 0, 0)
          l2.addWidget(self.r_label)
          l2.addWidget(self.r_rotate)
  
          layout.addLayout(l1)
          layout.addLayout(l2)
  
          self.setLayout(layout)
  
  class propertyBox(QtWidgets.QWidget):
      def __init__(self, parent=None):
          super(propertyBox, self).__init__(parent)
  
          self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
          self.setAttribute(QtCore.Qt.WA_TranslucentBackground)
  
          self.backgroundColor = hex2QColor("efefef")
          self.foregroundColor = hex2QColor("333333")
          self.borderRadius = 10
          self.__mousePressPos = None
          self.__mouseMovePos = None
  
          self.draggable = True
          self.dragging_threshould = 5
          self.__mousePressPos = None
          self.__mouseMovePos = None
  
          gr1 = rotateGroupBox(self)
          gr2 = rotateGroupBox(self)
          gr3 = rotateGroupBox(self)
          gr4 = rotateGroupBox(self)
  
          layout = QtWidgets.QVBoxLayout()
          layout.addWidget(gr1)
          layout.addWidget(gr2)
          layout.addWidget(gr3)
          layout.addWidget(gr4)
          self.setLayout(layout)
  
      def paintEvent(self, event):
          # get current window size
          s = self.size()
          qp = QtGui.QPainter()
          qp.begin(self)
          #qp.setRenderHint(QtGui.QPainter.HighQualityAntialiasing, True)
          qp.setPen(self.foregroundColor)
          qp.setBrush(self.backgroundColor)
          qp.drawRoundedRect(0, 0, s.width(), s.height(),
                             self.borderRadius, self.borderRadius)
          qp.end()
  
  class graphicsView(QtWidgets.QGraphicsView):
      def __init__(self, parent=None):
          super(graphicsView, self).__init__(parent)
  
      def wheelEvent(self, event):
          factor = 1.41 ** (-event.delta() / 240)
          self.scale(factor, factor)
          global RAW
          RAW = True
  
      def mousePressEvent(self, event):
          if event.button() &amp; QtCore.Qt.RightButton:
              self.setDragMode(QtWidgets.QGraphicsView.ScrollHandDrag)
          else:
              super(graphicsView, self).mousePressEvent(event)
  
      def mouseReleaseEvent(self, event):
          if event.button() &amp; QtCore.Qt.RightButton:
              self.setDragMode(QtWidgets.QGraphicsView.RubberBandDrag)
          else:
              super(graphicsView, self).mouseReleaseEvent(event)
  
  app = QtWidgets.QApplication(sys.argv)
  
  window = graphicsView()
  window.resize(1000, 500)
  
  scene = QtWidgets.QGraphicsScene()
  window.setScene(scene)
  
  box = scene.addWidget(propertyBox())
  
  layout = QtWidgets.QGraphicsLinearLayout()
  layout.setContentsMargins(0,0,0,0)
  #layout.setAlignment(box, QtCore.Qt.AlignRight) # doesn't work
  layout.addItem(box)
  
  form = QtWidgets.QGraphicsWidget()
  #form.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
  form.setZValue(100000000)
  form.setLayout(layout)
  scene.addItem(form)
  
  # Adding an item that should be overlapped by the property box
  rect = QtWidgets.QGraphicsRectItem()
  rect.setRect(0,0,200,200)
  rect.setFlag(QtWidgets.QGraphicsItem.ItemIsMovable)
  scene.addItem(rect)
  
  window.show()
  sys.exit(app.exec_())
  </code></pre>