40printer.setPageSize(QPrinter::A4);
50 QRectF(0, printer.height() / 2,
51 printer.width(), printer.height() / 2),
61 <<
"items at position" << mapToScene(
event->pos());
72 qDebug(
"You didn't click on an item.");
The QGraphicsItem class is the base class for all graphical items in a QGraphicsScene.
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items.
void addItem(QGraphicsItem *item)
Adds or moves the item and all its children to this scene.
QGraphicsRectItem * addRect(const QRectF &rect, const QPen &pen=QPen(), const QBrush &brush=QBrush())
Creates and adds a rectangle item to the scene, and returns the item pointer.
QGraphicsTextItem * addText(const QString &text, const QFont &font=QFont())
Creates and adds a text item to the scene, and returns the item pointer.
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
void setRenderHints(QPainter::RenderHints hints)
void setBackgroundBrush(const QBrush &brush)
void setCacheMode(CacheMode mode)
void render(QPainter *painter, const QRectF &target=QRectF(), const QRect &source=QRect(), Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio)
Renders the source rect, which is in view coordinates, from the scene into target,...
qsizetype size() const noexcept
The QPainter class performs low-level painting on widgets and other paint devices.
\inmodule QtCore\reentrant
constexpr QRectF adjusted(qreal x1, qreal y1, qreal x2, qreal y2) const noexcept
Returns a new rectangle with dx1, dy1, dx2 and dy2 added respectively to the existing coordinates of ...
\inmodule QtCore\reentrant
void show()
Shows the window.
view viewport() -> scroll(dx, dy, deviceRect)