18printer.setPaperSize(QPrinter::A4);
26QSizeF segmentSize = sceneRect().size() / pow(2,
depth - 1);
59QRectF TileScene::rectForTile(
int x,
int y)
const
62 return QRectF(
x * tileWidth,
y * tileHeight, tileWidth, tileHeight);
68 if (
x >= 0 && x < numTilesH && y >= 0 &&
y < numTilesV) {
70 invalidate(rectForTile(
x,
y), BackgroundLayer);
77 for (
int y = 0;
y < numTilesV; ++
y) {
78 for (
int x = 0;
x < numTilesH; ++
x) {
The QColor class provides colors based on RGB, HSV or CMYK values.
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.
void setForegroundBrush(const QBrush &brush)
void setBackgroundBrush(const QBrush &brush)
QGraphicsTextItem * addText(const QString &text, const QFont &font=QFont())
Creates and adds a text item to the scene, and returns the item pointer.
void render(QPainter *painter, const QRectF &target=QRectF(), const QRectF &source=QRectF(), Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio)
Renders the source rect from scene into target, using painter.
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
The QPainter class performs low-level painting on widgets and other paint devices.
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
bool intersects(const QRectF &r) const noexcept
Returns true if this rectangle intersects with the given rectangle (i.e.
void show()
Shows the window.
GLint GLint GLint GLint GLint x
[0]
GLint GLenum GLsizei GLsizei GLsizei depth