51 #include <QApplication>
53 #include <QGraphicsAnchorLayout>
54 #include <QGraphicsProxyWidget>
55 #include <QGraphicsScene>
56 #include <QGraphicsSceneResizeEvent>
57 #include <QGraphicsView>
58 #include <QGraphicsWidget>
60 #include <QPushButton>
73 w->setGeometry(0, 0,
event->size().width(),
event->size().height());
104 rect.height() /
r.height()),
true);
167 p.setBrush(linearGrad);
181 QSize newSize =
event->newSize().toSize();
183 scaled = original.
scaled(newSize);
198 int main(
int argc,
char *argv[])
GraphicsView(QGraphicsScene *scene, QGraphicsWidget *widget)
void resizeEvent(QResizeEvent *event) override
The QApplication class manages the GUI application's control flow and main settings.
void setSpacing(int spacing) override
The QBrush class defines the fill pattern of shapes drawn by QPainter.
The QColor class provides colors based on RGB, HSV or CMYK values.
void setColorAt(qreal pos, const QColor &color)
The QGraphicsAnchor class represents an anchor between two items in a QGraphicsAnchorLayout.
void setSpacing(qreal spacing)
The QGraphicsAnchorLayout class provides a layout where one can anchor widgets together in Graphics V...
void setTransform(const QTransform &matrix, bool combine=false)
void setPos(const QPointF &pos)
The QGraphicsLayoutItem class can be inherited to allow your custom items to be managed by layouts.
void setGraphicsItem(QGraphicsItem *item)
void setSizePolicy(const QSizePolicy &policy)
void setPreferredSize(const QSizeF &size)
void setMinimumSize(const QSizeF &size)
The QGraphicsPixmapItem class provides a pixmap item that you can add to a QGraphicsScene.
The QGraphicsScene class provides a surface for managing a large number of 2D graphical items.
void addItem(QGraphicsItem *item)
void setSceneRect(const QRectF &rect)
void setBackgroundBrush(const QBrush &brush)
The QGraphicsSceneResizeEvent class provides events for widget resizing in the graphics view framewor...
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.
QGraphicsScene * scene() const
QImage mirrored(bool horizontally=false, bool vertically=true) const &
The QLinearGradient class is used in combination with QBrush to specify a linear gradient brush.
The QPainter class performs low-level painting on widgets and other paint devices.
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
@ CompositionMode_DestinationOver
The QPalette class contains color groups for each widget state.
The QPixmap class is an off-screen image representation that can be used as a paint device.
QPixmap scaled(int w, int h, Qt::AspectRatioMode aspectMode=Qt::IgnoreAspectRatio, Qt::TransformationMode mode=Qt::FastTransformation) const
void fill(const QColor &fillColor=Qt::white)
static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags=Qt::AutoColor)
The QPointF class defines a point in the plane using floating point precision.
The QPoint class defines a point in the plane using integer precision.
The QRectF class defines a finite rectangle in the plane using floating point precision.
The QResizeEvent class contains event parameters for resize events. \inmodule QtGui.
The QSizeF class defines the size of a two-dimensional object using floating point precision.
The QSize class defines the size of a two-dimensional object using integer point precision.
constexpr int height() const noexcept
constexpr void setHeight(int h) noexcept
The QStyleOptionGraphicsItem class is used to describe the parameters needed to draw a QGraphicsItem.
int main(int argc, char **argv)
QT_END_INCLUDE_NAMESPACE typedef double qreal
#define Q_INIT_RESOURCE(name)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat z
GLfloat GLfloat GLfloat w
[0]
GLenum GLuint GLintptr GLsizeiptr size
[1]
QApplication app(argc, argv)
[0]