42 #ifndef QGRAPHICSVIEW_H
43 #define QGRAPHICSVIEW_H
56 #if !defined(QT_NO_GRAPHICSVIEW) || (QT_EDITION & QT_MODULE_GRAPHICSVIEW) != QT_MODULE_GRAPHICSVIEW
63 class QGraphicsViewPrivate;
67 Q_FLAGS(QPainter::RenderHints CacheMode OptimizationFlags)
71 Q_PROPERTY(
bool interactive READ isInteractive WRITE setInteractive)
73 Q_PROPERTY(
Qt::Alignment alignment READ alignment WRITE setAlignment)
76 Q_PROPERTY(CacheMode cacheMode READ cacheMode WRITE setCacheMode)
79 Q_PROPERTY(ViewportUpdateMode viewportUpdateMode READ viewportUpdateMode WRITE setViewportUpdateMode)
80 #ifndef QT_NO_RUBBERBAND
83 Q_PROPERTY(OptimizationFlags optimizationFlags READ optimizationFlags WRITE setOptimizationFlags)
96 Q_DECLARE_FLAGS(CacheMode, CacheModeFlag)
104 enum ViewportUpdateMode {
109 BoundingRectViewportUpdate
113 DontClipPainter = 0x1,
114 DontSavePainterState = 0x2,
115 DontAdjustForAntialiasing = 0x4,
116 IndirectPainting = 0x8
118 Q_DECLARE_FLAGS(OptimizationFlags, OptimizationFlag)
124 QSize sizeHint() const;
126 QPainter::RenderHints renderHints() const;
127 void setRenderHint(
QPainter::RenderHint hint,
bool enabled = true);
128 void setRenderHints(
QPainter::RenderHints hints);
130 Qt::Alignment alignment() const;
131 void setAlignment(
Qt::Alignment alignment);
133 ViewportAnchor transformationAnchor() const;
134 void setTransformationAnchor(ViewportAnchor anchor);
136 ViewportAnchor resizeAnchor() const;
137 void setResizeAnchor(ViewportAnchor anchor);
139 ViewportUpdateMode viewportUpdateMode() const;
140 void setViewportUpdateMode(ViewportUpdateMode
mode);
142 OptimizationFlags optimizationFlags() const;
143 void setOptimizationFlag(OptimizationFlag flag,
bool enabled = true);
144 void setOptimizationFlags(OptimizationFlags flags);
146 DragMode dragMode() const;
147 void setDragMode(DragMode mode);
149 #ifndef QT_NO_RUBBERBAND
154 CacheMode cacheMode()
const;
155 void setCacheMode(CacheMode mode);
156 void resetCachedContent();
158 bool isInteractive()
const;
159 void setInteractive(
bool allowed);
165 void setSceneRect(
const QRectF &rect);
166 inline void setSceneRect(qreal
x, qreal
y, qreal
w, qreal
h);
173 bool isTransformed()
const;
175 void resetTransform();
176 void rotate(qreal angle);
177 void scale(qreal sx, qreal sy);
178 void shear(qreal sh, qreal sv);
179 void translate(qreal
dx, qreal
dy);
181 void centerOn(
const QPointF &pos);
182 inline void centerOn(qreal
x, qreal
y);
184 void ensureVisible(
const QRectF &rect,
int xmargin = 50,
int ymargin = 50);
185 inline void ensureVisible(qreal
x, qreal
y, qreal
w, qreal
h,
int xmargin = 50,
int ymargin = 50);
186 void ensureVisible(
const QGraphicsItem *item,
int xmargin = 50,
int ymargin = 50);
188 inline void fitInView(qreal
x, qreal
y, qreal
w, qreal
h,
214 inline QPointF mapToScene(
int x,
int y)
const;
215 inline QPolygonF mapToScene(
int x,
int y,
int w,
int h)
const;
216 inline QPoint mapFromScene(qreal
x, qreal
y)
const;
217 inline QPolygon mapFromScene(qreal
x, qreal
y, qreal
w, qreal
h)
const;
221 QBrush backgroundBrush()
const;
222 void setBackgroundBrush(
const QBrush &brush);
224 QBrush foregroundBrush()
const;
225 void setForegroundBrush(
const QBrush &brush);
230 void updateSceneRect(
const QRectF &rect);
240 #ifndef QT_NO_CONTEXTMENU
256 #ifndef QT_NO_WHEELEVENT
265 virtual void drawBackground(
QPainter *painter,
const QRectF &rect);
266 virtual void drawForeground(
QPainter *painter,
const QRectF &rect);
267 virtual void drawItems(
QPainter *painter,
int numItems,
278 friend class QGraphicsSceneWidget;
280 friend class QGraphicsScenePrivate;
281 friend class QGraphicsItemPrivate;
284 Q_DECLARE_OPERATORS_FOR_FLAGS(QGraphicsView::CacheMode)
285 Q_DECLARE_OPERATORS_FOR_FLAGS(
QGraphicsView::OptimizationFlags)
288 { setSceneRect(
QRectF(ax, ay, aw, ah)); }
310 #endif // QT_NO_GRAPHICSVIEW
316 #endif // QGRAPHICSVIEW_H
GLsizei GLsizei GLchar * source
#define Q_PRIVATE_SLOT(d, signature)
void fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRadioMode=Qt::IgnoreAspectRatio)
QPointF mapToScene(const QPoint &point) const
void centerOn(const QPointF &pos)
#define QT_BEGIN_NAMESPACE
void ensureVisible(const QRectF &rect, int xmargin=50, int ymargin=50)
QGraphicsItem * itemAt(const QPoint &pos) const
QList< QGraphicsItem * > items() const
GLuint GLenum GLenum transform
QPoint mapFromScene(const QPointF &point) const
int int int int int int h
GLubyte GLubyte GLubyte GLubyte w
GLenum GLenum GLenum GLenum GLenum scale