public void first() {
    // ! [0]
    QGraphicsScene scene = new QGraphicsScene();
    scene.addText("Hello, world!");

    QGraphicsView view = new QGraphicsView(scene);
    view.show();
    // ! [0]
  }
  public OpenGLInGraphicsView(boolean gl) {
    QGLFormat format = new QGLFormat();
    format.setSampleBuffers(true);

    if (gl) {
      setViewport(new QGLWidget(format));
      setWindowTitle("GL window");
    } else {
      setWindowTitle("Non GL Window");
    }

    QGraphicsScene scene = new QGraphicsScene();

    QGraphicsPixmapItem pixmapItem =
        new QGraphicsPixmapItem(new QPixmap("classpath:org/qtjambi/images/chip-demo.png")) {

          @Override
          public void paint(QPainter painter, QStyleOptionGraphicsItem option, QWidget widget) {
            // painter.setRenderHint(QPainter.RenderHint.SmoothPixmapTransform, true);
            // super.paint(painter, option, widget);
            painter.drawPixmap(boundingRect().toRect(), this.pixmap());
          }
        };
    pixmapItem.setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsMovable, true);
    pixmapItem.setTransformationMode(Qt.TransformationMode.SmoothTransformation);
    scene.addItem(pixmapItem);

    QGraphicsPixmapItem otherPixmapItem =
        scene.addPixmap(new QPixmap("classpath:org/qtjambi/images/chip-demo.png"));
    otherPixmapItem.setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsMovable, true);
    otherPixmapItem.setTransformationMode(Qt.TransformationMode.SmoothTransformation);

    scene.addText("Hello World").setFlag(QGraphicsItem.GraphicsItemFlag.ItemIsMovable, true);

    setScene(scene);
    rotate(45);

    setRenderHint(QPainter.RenderHint.SmoothPixmapTransform);

    // setRenderHint(QPainter.RenderHint.Antialiasing, true);
    // setRenderHint(QPainter.RenderHint.HighQualityAntialiasing, true);
    // setRenderHint(QPainter.RenderHint.TextAntialiasing, true);
  }