public void first() { // ! [0] QGraphicsScene scene = new QGraphicsScene(); scene.addText("Hello, world!"); QGraphicsView view = new QGraphicsView(scene); view.show(); // ! [0] }
public void fourth() { // ! [4] QGraphicsScene scene = new QGraphicsScene(); QGraphicsView view = new QGraphicsView(scene); view.show(); // a white semi-transparent foreground scene.setForegroundBrush(new QBrush(new QColor(255, 255, 255, 127))); // a grid foreground scene.setForegroundBrush(new QBrush(QColor.lightGray, Qt.BrushStyle.CrossPattern)); // ! [4] }
public void third() { // ! [3] QGraphicsScene scene = new QGraphicsScene(); QGraphicsView view = new QGraphicsView(scene); view.show(); // a blue background scene.setBackgroundBrush(new QBrush(QColor.blue)); // a gradient background QRadialGradient gradient = new QRadialGradient(0, 0, 10); gradient.setSpread(QGradient.Spread.RepeatSpread); scene.setBackgroundBrush(new QBrush(gradient)); // ! [3] }