CopperSpice API
1.9.2
|
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene. More...
Public Typedefs | |
using | CacheMode = QFlags< CacheModeFlag > |
using | OptimizationFlags = QFlags< OptimizationFlag > |
Public Typedefs inherited from QWidget | |
using | RenderFlags = QFlags< RenderFlag > |
Public Types | |
enum | CacheModeFlag |
enum | DragMode |
enum | OptimizationFlag |
enum | ViewportAnchor |
enum | ViewportUpdateMode |
Public Types inherited from QFrame | |
enum | Shadow |
enum | Shape |
enum | StyleMask |
Public Types inherited from QWidget | |
enum | RenderFlag |
Public Types inherited from QPaintDevice | |
enum | PaintDeviceMetric |
Public Signals | |
void | rubberBandChanged (QRect viewportRect, QPointF fromScenePoint, QPointF toScenePoint) |
Public Signals inherited from QWidget | |
void | customContextMenuRequested (const QPoint &pos) |
void | windowIconChanged (const QIcon &icon) |
void | windowIconTextChanged (const QString &iconText) |
void | windowTitleChanged (const QString &title) |
Public Signals inherited from QObject | |
void | destroyed (QObject *obj=nullptr) |
void | objectNameChanged (const QString &objectName) |
Public Slots | |
void | invalidateScene (const QRectF &rect=QRectF (), QGraphicsScene::SceneLayers layers=QGraphicsScene::AllLayers) |
void | updateScene (const QList< QRectF > &rects) |
void | updateSceneRect (const QRectF &rect) |
Public Slots inherited from QWidget | |
bool | close () |
void | hide () |
void | lower () |
void | raise () |
void | repaint () |
void | setDisabled (bool disable) |
void | setEnabled (bool enable) |
void | setFocus () |
void | setHidden (bool hidden) |
void | setStyleSheet (const QString &styleSheet) |
virtual void | setVisible (bool visible) |
void | setWindowModified (bool modified) |
void | setWindowTitle (const QString &title) |
void | show () |
void | showFullScreen () |
void | showMaximized () |
void | showMinimized () |
void | showNormal () |
void | update () |
Public Slots inherited from QObject | |
void | deleteLater () |
Public Methods | |
QGraphicsView (QGraphicsScene *scene, QWidget *parent=nullptr) | |
QGraphicsView (QWidget *parent=nullptr) | |
~QGraphicsView () | |
Qt::Alignment | alignment () const |
QBrush | backgroundBrush () const |
CacheMode | cacheMode () const |
void | centerOn (const QGraphicsItem *item) |
void | centerOn (const QPointF &pos) |
void | centerOn (qreal x, qreal y) |
DragMode | dragMode () const |
void | ensureVisible (const QGraphicsItem *item, int xmargin=50, int ymargin=50) |
void | ensureVisible (const QRectF &rect, int xmargin=50, int ymargin=50) |
void | ensureVisible (qreal x, qreal y, qreal width, qreal height, int xmargin=50, int ymargin=50) |
void | fitInView (const QGraphicsItem *item, Qt::AspectRatioMode mode=Qt::IgnoreAspectRatio) |
void | fitInView (const QRectF &rect, Qt::AspectRatioMode mode=Qt::IgnoreAspectRatio) |
void | fitInView (qreal x, qreal y, qreal width, qreal height, Qt::AspectRatioMode mode=Qt::IgnoreAspectRatio) |
QBrush | foregroundBrush () const |
QVariant | inputMethodQuery (Qt::InputMethodQuery query) const override |
bool | isInteractive () const |
bool | isTransformed () const |
QGraphicsItem * | itemAt (const QPoint &pos) const |
QGraphicsItem * | itemAt (int x, int y) const |
QList< QGraphicsItem * > | items () const |
QList< QGraphicsItem * > | items (const QPainterPath &path, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const |
QList< QGraphicsItem * > | items (const QPoint &pos) const |
QList< QGraphicsItem * > | items (const QPolygon &polygon, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const |
QList< QGraphicsItem * > | items (const QRect &rect, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const |
QList< QGraphicsItem * > | items (int x, int y) const |
QList< QGraphicsItem * > | items (int x, int y, int width, int height, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const |
QPainterPath | mapFromScene (const QPainterPath &path) const |
QPoint | mapFromScene (const QPointF &point) const |
QPolygon | mapFromScene (const QPolygonF &polygon) const |
QPolygon | mapFromScene (const QRectF &rect) const |
QPoint | mapFromScene (qreal x, qreal y) const |
QPolygon | mapFromScene (qreal x, qreal y, qreal width, qreal height) const |
QPainterPath | mapToScene (const QPainterPath &path) const |
QPointF | mapToScene (const QPoint &point) const |
QPolygonF | mapToScene (const QPolygon &polygon) const |
QPolygonF | mapToScene (const QRect &rect) const |
QPointF | mapToScene (int x, int y) const |
QPolygonF | mapToScene (int x, int y, int width, int height) const |
QMatrix | matrix () const |
OptimizationFlags | optimizationFlags () const |
void | render (QPainter *painter, const QRectF &target=QRectF (), const QRect &source=QRect (), Qt::AspectRatioMode mode=Qt::KeepAspectRatio) |
QPainter::RenderHints | renderHints () const |
void | resetCachedContent () |
void | resetMatrix () |
void | resetTransform () |
ViewportAnchor | resizeAnchor () const |
void | rotate (qreal angle) |
QRect | rubberBandRect () const |
Qt::ItemSelectionMode | rubberBandSelectionMode () const |
void | scale (qreal sx, qreal sy) |
QGraphicsScene * | scene () const |
QRectF | sceneRect () const |
void | setAlignment (Qt::Alignment alignment) |
void | setBackgroundBrush (const QBrush &brush) |
void | setCacheMode (CacheMode mode) |
void | setDragMode (DragMode mode) |
void | setForegroundBrush (const QBrush &brush) |
void | setInteractive (bool allowed) |
void | setMatrix (const QMatrix &matrix, bool combine=false) |
void | setOptimizationFlag (OptimizationFlag flag, bool enabled=true) |
void | setOptimizationFlags (OptimizationFlags flags) |
void | setRenderHint (QPainter::RenderHint hint, bool enabled=true) |
void | setRenderHints (QPainter::RenderHints hints) |
void | setResizeAnchor (ViewportAnchor anchor) |
void | setRubberBandSelectionMode (Qt::ItemSelectionMode mode) |
void | setScene (QGraphicsScene *scene) |
void | setSceneRect (const QRectF &rect) |
void | setSceneRect (qreal x, qreal y, qreal width, qreal height) |
void | setTransform (const QTransform &matrix, bool combine=false) |
void | setTransformationAnchor (ViewportAnchor anchor) |
void | setViewportUpdateMode (ViewportUpdateMode mode) |
void | shear (qreal sh, qreal sv) |
QSize | sizeHint () const override |
QTransform | transform () const |
ViewportAnchor | transformationAnchor () const |
void | translate (qreal dx, qreal dy) |
QTransform | viewportTransform () const |
ViewportUpdateMode | viewportUpdateMode () const |
Public Methods inherited from QAbstractScrollArea | |
QAbstractScrollArea (QWidget *parent=nullptr) | |
~QAbstractScrollArea () | |
void | addScrollBarWidget (QWidget *widget, Qt::Alignment alignment) |
QWidget * | cornerWidget () const |
QScrollBar * | horizontalScrollBar () const |
Qt::ScrollBarPolicy | horizontalScrollBarPolicy () const |
QSize | maximumViewportSize () const |
QSize | minimumSizeHint () const override |
QWidgetList | scrollBarWidgets (Qt::Alignment alignment) |
void | setCornerWidget (QWidget *widget) |
void | setHorizontalScrollBar (QScrollBar *scrollBar) |
void | setHorizontalScrollBarPolicy (Qt::ScrollBarPolicy policy) |
void | setSizeAdjustPolicy (SizeAdjustPolicy policy) |
virtual void | setupViewport (QWidget *viewport) |
void | setVerticalScrollBar (QScrollBar *scrollBar) |
void | setVerticalScrollBarPolicy (Qt::ScrollBarPolicy policy) |
void | setViewport (QWidget *widget) |
SizeAdjustPolicy | sizeAdjustPolicy () const |
QSize | sizeHint () const override |
QScrollBar * | verticalScrollBar () const |
Qt::ScrollBarPolicy | verticalScrollBarPolicy () const |
QWidget * | viewport () const |
Public Methods inherited from QFrame | |
QFrame (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag) | |
~QFrame () | |
QRect | frameRect () const |
Shadow | frameShadow () const |
Shape | frameShape () const |
int | frameStyle () const |
int | frameWidth () const |
int | lineWidth () const |
int | midLineWidth () const |
void | setFrameRect (const QRect &rect) |
void | setFrameShadow (Shadow value) |
void | setFrameShape (Shape value) |
void | setFrameStyle (int style) |
void | setLineWidth (int width) |
void | setMidLineWidth (int width) |
QSize | sizeHint () const override |
Public Methods inherited from QWidget | |
QWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag) | |
~QWidget () | |
bool | acceptDrops () const |
QString | accessibleDescription () const |
QString | accessibleName () const |
QList< QAction * > | actions () const |
void | activateWindow () |
void | addAction (QAction *action) |
void | addActions (const QList< QAction * > &actions) |
void | adjustSize () |
bool | autoFillBackground () const |
QPalette::ColorRole | backgroundRole () const |
QBackingStore * | backingStore () const |
QSize | baseSize () const |
QWidget * | childAt (const QPoint &position) const |
QWidget * | childAt (int x, int y) const |
QRect | childrenRect () const |
QRegion | childrenRegion () const |
void | clearFocus () |
void | clearMask () |
QMargins | contentsMargins () const |
QRect | contentsRect () const |
Qt::ContextMenuPolicy | contextMenuPolicy () const |
QCursor | cursor () const |
WId | effectiveWinId () const |
void | ensurePolished () const |
Qt::FocusPolicy | focusPolicy () const |
QWidget * | focusProxy () const |
QWidget * | focusWidget () const |
const QFont & | font () const |
QFontInfo | fontInfo () const |
QFontMetrics | fontMetrics () const |
QPalette::ColorRole | foregroundRole () const |
QRect | frameGeometry () const |
QSize | frameSize () const |
const QRect & | geometry () const |
void | getContentsMargins (int *left, int *top, int *right, int *bottom) const |
QPixmap | grab (const QRect &rectangle=QRect (QPoint (0, 0), QSize (-1,-1))) |
void | grabGesture (Qt::GestureType gestureType, Qt::GestureFlags flags=Qt::GestureFlags ()) |
void | grabKeyboard () |
void | grabMouse () |
void | grabMouse (const QCursor &cursor) |
int | grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut) |
QGraphicsEffect * | graphicsEffect () const |
QGraphicsProxyWidget * | graphicsProxyWidget () const |
bool | hasEditFocus () const |
bool | hasFocus () const |
virtual bool | hasHeightForWidth () const |
bool | hasMouseTracking () const |
int | height () const |
virtual int | heightForWidth (int width) const |
Qt::InputMethodHints | inputMethodHints () const |
void | insertAction (QAction *before, QAction *action) |
void | insertActions (QAction *before, QList< QAction * > actions) |
bool | isActiveWindow () const |
bool | isAncestorOf (const QWidget *child) const |
bool | isEnabled () const |
bool | isEnabledTo (const QWidget *parent) const |
bool | isEnabledToTLW () const |
bool | isFullScreen () const |
bool | isHidden () const |
bool | isMaximized () const |
bool | isMinimized () const |
bool | isModal () const |
bool | isTopLevel () const |
bool | isVisible () const |
bool | isVisibleTo (const QWidget *parent) const |
bool | isWindow () const |
bool | isWindowModified () const |
QLayout * | layout () const |
Qt::LayoutDirection | layoutDirection () const |
QLocale | locale () const |
QPoint | mapFrom (const QWidget *parent, const QPoint &pos) const |
QPoint | mapFromGlobal (const QPoint &pos) const |
QPoint | mapFromParent (const QPoint &pos) const |
QPoint | mapTo (const QWidget *parent, const QPoint &pos) const |
QPoint | mapToGlobal (const QPoint &pos) const |
QPoint | mapToParent (const QPoint &pos) const |
QRegion | mask () const |
int | maximumHeight () const |
QSize | maximumSize () const |
int | maximumWidth () const |
int | minimumHeight () const |
QSize | minimumSize () const |
int | minimumWidth () const |
void | move (const QPoint &point) |
void | move (int x, int y) |
QWidget * | nativeParentWidget () const |
QWidget * | nextInFocusChain () const |
QRect | normalGeometry () const |
void | overrideWindowFlags (Qt::WindowFlags flags) |
QPaintEngine * | paintEngine () const override |
const QPalette & | palette () const |
QWidget * | parentWidget () const |
QPoint | pos () const |
QWidget * | previousInFocusChain () const |
QRect | rect () const |
void | releaseKeyboard () |
void | releaseMouse () |
void | releaseShortcut (int id) |
void | removeAction (QAction *action) |
void | render (QPaintDevice *target, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren)) |
void | render (QPainter *painter, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren)) |
void | repaint (const QRect &rect) |
void | repaint (const QRegion ®ion) |
void | repaint (int x, int y, int w, int h) |
void | resize (const QSize &size) |
void | resize (int w, int h) |
bool | restoreGeometry (const QByteArray &geometry) |
QByteArray | saveGeometry () const |
void | scroll (int dx, int dy) |
void | scroll (int dx, int dy, const QRect &rect) |
void | setAcceptDrops (bool on) |
void | setAccessibleDescription (const QString &description) |
void | setAccessibleName (const QString &name) |
void | setAttribute (Qt::WidgetAttribute attribute, bool enable=true) |
void | setAutoFillBackground (bool enable) |
void | setBackgroundRole (QPalette::ColorRole role) |
void | setBaseSize (const QSize &size) |
void | setBaseSize (int basew, int baseh) |
void | setContentsMargins (const QMargins &margins) |
void | setContentsMargins (int left, int top, int right, int bottom) |
void | setContextMenuPolicy (Qt::ContextMenuPolicy policy) |
void | setCursor (const QCursor &cursor) |
void | setEditFocus (bool enable) |
void | setFixedHeight (int h) |
void | setFixedSize (const QSize &size) |
void | setFixedSize (int w, int h) |
void | setFixedWidth (int w) |
void | setFocus (Qt::FocusReason reason) |
void | setFocusPolicy (Qt::FocusPolicy policy) |
void | setFocusProxy (QWidget *widget) |
void | setFont (const QFont &font) |
void | setForegroundRole (QPalette::ColorRole role) |
void | setGeometry (const QRect &rect) |
void | setGeometry (int x, int y, int w, int h) |
void | setGraphicsEffect (QGraphicsEffect *effect) |
void | setInputMethodHints (Qt::InputMethodHints hints) |
void | setLayout (QLayout *layout) |
void | setLayoutDirection (Qt::LayoutDirection direction) |
void | setLocale (const QLocale &locale) |
void | setMask (const QBitmap &bitmap) |
void | setMask (const QRegion ®ion) |
void | setMaximumHeight (int maxh) |
void | setMaximumSize (const QSize &size) |
void | setMaximumSize (int maxw, int maxh) |
void | setMaximumWidth (int maxw) |
void | setMinimumHeight (int minh) |
void | setMinimumSize (const QSize &size) |
void | setMinimumSize (int minw, int minh) |
void | setMinimumWidth (int minw) |
void | setMouseTracking (bool enable) |
void | setPalette (const QPalette &palette) |
void | setParent (QWidget *parent) |
void | setParent (QWidget *parent, Qt::WindowFlags flags) |
void | setShortcutAutoRepeat (int id, bool enable=true) |
void | setShortcutEnabled (int id, bool enable=true) |
void | setSizeIncrement (const QSize &size) |
void | setSizeIncrement (int w, int h) |
void | setSizePolicy (QSizePolicy policy) |
void | setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical) |
void | setStatusTip (const QString &data) |
void | setStyle (QStyle *style) |
void | setToolTip (const QString &data) |
void | setToolTipDuration (int msec) |
void | setUpdatesEnabled (bool enable) |
void | setWhatsThis (const QString &str) |
void | setWindowFilePath (const QString &filePath) |
void | setWindowFlags (Qt::WindowFlags flags) |
void | setWindowIcon (const QIcon &icon) |
void | setWindowModality (Qt::WindowModality windowModality) |
void | setWindowOpacity (qreal level) |
void | setWindowRole (const QString &role) |
void | setWindowState (Qt::WindowStates windowState) |
QSize | size () const |
QSize | sizeIncrement () const |
QSizePolicy | sizePolicy () const |
void | stackUnder (QWidget *widget) |
QString | statusTip () const |
QStyle * | style () const |
QString | styleSheet () const |
bool | testAttribute (Qt::WidgetAttribute attribute) const |
QString | toolTip () const |
int | toolTipDuration () const |
QWidget * | topLevelWidget () const |
bool | underMouse () const |
void | ungrabGesture (Qt::GestureType gestureType) |
void | unsetCursor () |
void | unsetLayoutDirection () |
void | unsetLocale () |
void | update (const QRect &rect) |
void | update (const QRegion ®ion) |
void | update (int x, int y, int w, int h) |
void | updateGeometry () |
bool | updatesEnabled () const |
QRegion | visibleRegion () const |
QString | whatsThis () const |
int | width () const |
QWidget * | window () const |
QString | windowFilePath () const |
Qt::WindowFlags | windowFlags () const |
QWindow * | windowHandle () const |
QIcon | windowIcon () const |
Qt::WindowModality | windowModality () const |
qreal | windowOpacity () const |
QString | windowRole () const |
Qt::WindowStates | windowState () const |
QString | windowTitle () const |
Qt::WindowType | windowType () const |
WId | winId () const |
int | x () const |
int | y () const |
Public Methods inherited from QObject | |
QObject (QObject *parent=nullptr) | |
~QObject () | |
bool | blockSignals (bool block) |
const QList< QObject * > & | children () const |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
bool | disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
bool | disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const |
void | dumpObjectInfo () |
void | dumpObjectTree () |
QList< QString > | dynamicPropertyNames () const |
virtual bool | event (QEvent *event) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
template<typename T > | |
T | findChild (const QString &childName=QString ()) const |
template<class T > | |
QList< T > | findChildren (const QRegularExpression ®Exp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
template<class T > | |
QList< T > | findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
bool | inherits (const QString &className) const |
void | installEventFilter (QObject *filterObj) |
bool | isWidgetType () const |
bool | isWindowType () const |
void | killTimer (int id) |
const QMetaObject * | metaObject () const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const |
QObject * | parent () const |
template<class T = QVariant> | |
T | property (const QString &name) const |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setParent (QObject *parent) |
bool | setProperty (const QString &name, const QVariant &value) |
bool | signalsBlocked () const |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
QThread * | thread () const |
Public Methods inherited from QPaintDevice | |
virtual | ~QPaintDevice () |
int | colorCount () const |
int | depth () const |
int | devicePixelRatio () const |
qreal | devicePixelRatioF () const |
int | height () const |
int | heightMM () const |
int | logicalDpiX () const |
int | logicalDpiY () const |
bool | paintingActive () const |
int | physicalDpiX () const |
int | physicalDpiY () const |
int | width () const |
int | widthMM () const |
Protected Slots | |
void | setupViewport (QWidget *widget) |
Protected Slots inherited from QWidget | |
void | updateMicroFocus () |
Protected Methods | |
void | contextMenuEvent (QContextMenuEvent *event) override |
void | dragEnterEvent (QDragEnterEvent *event) override |
void | dragLeaveEvent (QDragLeaveEvent *event) override |
void | dragMoveEvent (QDragMoveEvent *event) override |
virtual void | drawBackground (QPainter *painter, const QRectF &rect) |
virtual void | drawForeground (QPainter *painter, const QRectF &rect) |
virtual void | drawItems (QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[]) |
void | dropEvent (QDropEvent *event) override |
bool | event (QEvent *event) override |
void | focusInEvent (QFocusEvent *event) override |
bool | focusNextPrevChild (bool next) override |
void | focusOutEvent (QFocusEvent *event) override |
void | inputMethodEvent (QInputMethodEvent *event) override |
void | keyPressEvent (QKeyEvent *event) override |
void | keyReleaseEvent (QKeyEvent *event) override |
void | mouseDoubleClickEvent (QMouseEvent *event) override |
void | mouseMoveEvent (QMouseEvent *event) override |
void | mousePressEvent (QMouseEvent *event) override |
void | mouseReleaseEvent (QMouseEvent *event) override |
void | paintEvent (QPaintEvent *event) override |
void | resizeEvent (QResizeEvent *event) override |
void | scrollContentsBy (int dx, int dy) override |
void | showEvent (QShowEvent *event) override |
bool | viewportEvent (QEvent *event) override |
void | wheelEvent (QWheelEvent *event) override |
Protected Methods inherited from QAbstractScrollArea | |
void | contextMenuEvent (QContextMenuEvent *event) override |
void | dragEnterEvent (QDragEnterEvent *event) override |
void | dragLeaveEvent (QDragLeaveEvent *event) override |
void | dragMoveEvent (QDragMoveEvent *event) override |
void | dropEvent (QDropEvent *event) override |
bool | event (QEvent *event) override |
void | keyPressEvent (QKeyEvent *event) override |
void | mouseDoubleClickEvent (QMouseEvent *event) override |
void | mouseMoveEvent (QMouseEvent *event) override |
void | mousePressEvent (QMouseEvent *event) override |
void | mouseReleaseEvent (QMouseEvent *event) override |
void | paintEvent (QPaintEvent *event) override |
void | resizeEvent (QResizeEvent *event) override |
void | setViewportMargins (const QMargins &margins) |
void | setViewportMargins (int left, int top, int right, int bottom) |
QMargins | viewportMargins () const |
virtual QSize | viewportSizeHint () const |
void | wheelEvent (QWheelEvent *event) override |
Protected Methods inherited from QFrame | |
void | changeEvent (QEvent *event) override |
void | drawFrame (QPainter *painter) |
bool | event (QEvent *event) override |
void | initStyleOption (QStyleOptionFrame *option) const |
void | paintEvent (QPaintEvent *event) override |
Protected Methods inherited from QWidget | |
virtual void | actionEvent (QActionEvent *event) |
virtual void | closeEvent (QCloseEvent *event) |
void | create (WId window=0, bool initializeWindow=true, bool destroyOldWindow=true) |
void | destroy (bool destroyWindow=true, bool destroySubWindows=true) |
virtual void | enterEvent (QEvent *event) |
bool | event (QEvent *event) override |
bool | focusNextChild () |
bool | focusPreviousChild () |
virtual void | hideEvent (QHideEvent *event) |
void | initPainter (QPainter *painter) const override |
virtual void | leaveEvent (QEvent *event) |
int | metric (PaintDeviceMetric metric) const override |
virtual void | moveEvent (QMoveEvent *event) |
virtual bool | nativeEvent (const QByteArray &eventType, void *message, long *result) |
virtual void | tabletEvent (QTabletEvent *event) |
Protected Methods inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
virtual void | connectNotify (const QMetaMethod &signalMethod) const |
virtual void | customEvent (QEvent *event) |
virtual void | disconnectNotify (const QMetaMethod &signalMethod) const |
bool | isSignalConnected (const QMetaMethod &signalMethod) const |
int | receivers (const QString &signal) const |
QObject * | sender () const |
int | senderSignalIndex () const |
virtual void | timerEvent (QTimerEvent *event) |
Protected Methods inherited from QPaintDevice | |
QPaintDevice () | |
Friends | |
class | QGraphicsScene |
Additional Inherited Members | |
Static Public Methods inherited from QWidget | |
static QWidget * | createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag) |
static QWidget * | find (WId id) |
static QWidget * | keyboardGrabber () |
static QWidget * | mouseGrabber () |
static void | setTabOrder (QWidget *firstWidget, QWidget *secondWidget) |
Static Public Methods inherited from QObject | |
static bool | connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ()) |
static bool | connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod) |
static bool | disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...)) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr) |
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T > | |
static bool | disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod) |
static QMetaObject & | staticMetaObject () |
static QString | tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >()) |
Related Functions inherited from QWidget | |
QWidgetList | |
WId | |
Related Functions inherited from QObject | |
T | qobject_cast (QObject *object) |
QObjectList | |
The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene in a scrollable viewport. Refer to the detailed documentation for the QGraphicsScene class which explains how to create a scene with a QGraphicsView.
QGraphicsView can be used to display an entire scene or only a portion of it. The displayed area is automatically detected when the view is displayed the first time based on QGraphicsScene::itemsBoundingRect()). To set the displayed area manually call setSceneRect() which will adjust the range of the scroll bars. Although scenes support a virtually unlimited size the range of the scroll bars will never exceed the range of an integer.
The user can scroll to any position on the scene by using the scroll bars. The application can scroll by calling centerOn(). By passing a point to centerOn() QGraphicsView will scroll its viewport to ensure the point is centered in the view. The centerOn() method can also be used to scroll to a specific QGraphicsItem in which case the center of the item will be centered in the view. To ensure a particular area of the scene is visible call ensureVisible().
QGraphicsView displays the scene by calling the method render(). By default the items are drawn onto the viewport using a QPainter and default render hints. To change the render hints which QGraphicsView passes to QPainter when painting items, call setRenderHints().
QGraphicsView creates a QWidget for the viewport widget. You can access this widget by calling viewport() or replace it by calling setViewport(). To render using OpenGL call setViewport(new QGLWidget). QGraphicsView will take ownership of the viewport widget.
QGraphicsView supports affine transformations using QTransform. You can either pass a matrix to setTransform() or call the methods rotate(), scale(), translate(), or shear(). QGraphicsView keeps the center of the view fixed during a transformation. Because of the scene alignment translating the view will have no visual effect.
Users can interact with the items in the scene using the mouse and keyboard. QGraphicsView translates the mouse and key events into scene events and forwards them to items in the scene. For example, if the user clicks on a selectable item it can inform the scene the current item has been selected. When this occurs the item can redraw itself to display a selection rectangle.
When dragging the mouse on a movable item the item must handle the mouse moves and moves itself. Item interaction is enabled by default and you can toggle it by calling setInteractive().
An application can provide custom scene interaction by inheriting from QGraphicsView and reimplementing the mouse and key event handlers. To convert between scene coordinates and view coordinates call the mapping methods mapToScene() and mapFromScene().
Typedef for QFlags<CacheModeFlag> which contains an OR combination of CacheModeFlag values.
Refer to QGraphicsView::CacheModeFlag for the enum documentation.
Typedef for QFlags<OptimizationFlag> which contains an OR combination of OptimizationFlag values.
Refer to QGraphicsView::OptimizationFlag for the enum documentation.
This enum describes the flags that you can set for a QGraphicsView's cache mode.
Constant | Value | Description |
---|---|---|
QGraphicsView::CacheNone | 0x0 | All painting is done directly onto the viewport. |
QGraphicsView::CacheBackground | 0x1 | The background is cached. This affects both custom backgrounds, and backgrounds based on the backgroundBrush property. When this flag is enabled, QGraphicsView will allocate one pixmap with the full size of the viewport. |
This enum describes the default action for the view when pressing and dragging the mouse over the viewport.
Constant | Value | Description |
---|---|---|
QGraphicsView::NoDrag | 0 | Nothing happens the mouse event is ignored. |
QGraphicsView::ScrollHandDrag | 1 | The cursor changes into a pointing hand, and dragging the mouse around will scroll the scrollbars. This mode works both in interactive and non-interactive mode. |
QGraphicsView::RubberBandDrag | 2 | A rubber band will appear. Dragging the mouse will set the rubber band geometry, and all items covered by the rubber band are selected. This mode is disabled for non-interactive views. |
This enum describes flags which can enabled to improve rendering performance. By default none of these flags are set. Setting a flag usually imposes a side effect which can vary between paint devices and platforms.
Constant | Value | Description |
---|---|---|
GraphicsView::DontSavePainterState | 0x2 | When rendering QGraphicsView protects the painter state when rendering the background or foreground and each item. This allows the application to leave the painter in an altered state. If the items always restore the state you should enable this flag to prevent QGraphicsView from doing the same. |
QGraphicsView::DontAdjustForAntialiasing | 0x4 | Disables QGraphicsView's antialiasing auto-adjustment of exposed areas. Items which render antialiased lines on the boundaries of their QGraphicsItem::boundingRect() can end up rendering parts of the line outside the bounding rectangle. To prevent artifacts QGraphicsView expands regions by 2 pixels. This flag will turn off the 2 pixel border to improves performance. Items drawn with antialiasing may leave painting traces as they are moved within the scene. |
QGraphicsView::IndirectPainting | 0x8 | Restores the old painting algorithm which calls QGraphicsView::drawItems() and QGraphicsScene::drawItems(). Only use this flag for compatibility with old application code. |
This enums describe the possible anchors that QGraphicsView can use when the user resizes the view or when the view is transformed.
Constant | Value | Description |
---|---|---|
QGraphicsView::NoAnchor | 0 | No anchor, i.e. the view leaves the scene's position unchanged. |
QGraphicsView::AnchorViewCenter | 1 | The scene point at the center of the view is used as the anchor. |
QGraphicsView::AnchorUnderMouse | 2 | The point under the mouse is used as the anchor. |
This enum describes how QGraphicsView updates its viewport when the scene contents change or are exposed.
Constant | Value | Description |
---|---|---|
QGraphicsView::FullViewportUpdate | 0 | When any visible part of the scene changes or is reexposed, QGraphicsView will update the entire viewport. This approach is fastest when QGraphicsView spends more time figuring out what to draw than it would spend drawing (e.g., when very many small items are repeatedly updated). This is the preferred update mode for viewports that do not support partial updates, such as QGLWidget, and for viewports that need to disable scroll optimization. |
QGraphicsView::MinimalViewportUpdate | 1 | QGraphicsView will determine the minimal viewport region that requires a redraw, minimizing the time spent drawing by avoiding a redraw of areas that have not changed. This is QGraphicsView's default mode. Although this approach provides the best performance in general, if there are many small visible changes on the scene, QGraphicsView might end up spending more time finding the minimal approach than it will spend drawing. |
QGraphicsView::SmartViewportUpdate | 2 | QGraphicsView will attempt to find an optimal update mode by analyzing the areas that require a redraw. |
QGraphicsView::BoundingRectViewportUpdate | 4 | The bounding rectangle of all changes in the viewport will be redrawn. This mode has the advantage that QGraphicsView searches only one region for changes, minimizing time spent determining what needs redrawing. The disadvantage is that areas that have not changed also need to be redrawn. |
QGraphicsView::NoViewportUpdate | 3 | QGraphicsView will never update its viewport when the scene changes; the user is expected to control all updates. This mode disables all (potentially slow) item visibility testing in QGraphicsView, and is suitable for scenes that either require a fixed frame rate, or where the viewport is otherwise updated externally. |
QGraphicsView::QGraphicsView | ( | QWidget * | parent = nullptr | ) |
Constructs a QGraphicsView. The parent is passed to the QWidget constructor.
QGraphicsView::QGraphicsView | ( | QGraphicsScene * | scene, |
QWidget * | parent = nullptr |
||
) |
Constructs a QGraphicsView and sets the visualized scene to scene. The parent is passed to the QWidget constructor.
QGraphicsView::~QGraphicsView | ( | ) |
Destroys the QGraphicsView object.
Qt::Alignment QGraphicsView::alignment | ( | ) | const |
Returns the value of the QGraphicsView::alignment property.
QBrush QGraphicsView::backgroundBrush | ( | ) | const |
Returns the value of the backgroundBrush property.
void QGraphicsView::centerOn | ( | const QGraphicsItem * | item | ) |
Scrolls the contents of the viewport to ensure that item is centered in the view.
void QGraphicsView::centerOn | ( | const QPointF & | pos | ) |
Scrolls the contents of the viewport to ensure the scene coordinate pos is centered in the view. Because pos is a floating point coordinate and the scroll bars operate on integer coordinates, the centering is only an approximation.
If the item is close to or outside the border it will be visible in the view but not centered.
|
overrideprotectedvirtual |
Reimplemented from QWidget::contextMenuEvent()
|
overrideprotectedvirtual |
Reimplemented from QWidget::dragEnterEvent()
|
overrideprotectedvirtual |
Reimplemented from QWidget::dragLeaveEvent()
|
overrideprotectedvirtual |
Reimplemented from QWidget::dragMoveEvent()
Draws the background of the scene using painter, before any items and the foreground are drawn. Reimplement this method to provide a custom background for this view. If all you want is to define a color, texture or gradient for the background call setBackgroundBrush().
All painting is done in scene coordinates. The value for rect is the exposed rectangle. The default implementation fills rect using the view's backgroundBrush. If no brush is defined the drawBackground() method for the scene is called.
Draws the foreground of the scene using painter, after the background and all items are drawn. Reimplement this method to provide a custom foreground for this view. If all you want is to define a color, texture or gradient for the foreground call setForegroundBrush().
All painting is done in scene coordinates. The value for rect is the exposed rectangle. The default implementation fills rect using the view's foregroundBrush. If no brush is defined drawForeground() method for the scene is called.
|
deprecatedprotectedvirtual |
Draws the items in the scene using painter after the background and before the foreground are drawn. The numItems is the number of items in the given items and options. The value for options is a list of styleoptions with one for each item.
Reimplement this method to provide custom item drawing for this view. The default implementation calls the scene's drawItems() method. This method is not called unless the QGraphicsView::IndirectPainting flag is given as an Optimization flag.
|
overrideprotectedvirtual |
Reimplemented from QWidget::dropEvent()
void QGraphicsView::ensureVisible | ( | const QGraphicsItem * | item, |
int | xmargin = 50 , |
||
int | ymargin = 50 |
||
) |
Scrolls the contents of the viewport so the center of item is visible, with margins specified in pixels by xmargin and ymargin. If the specified point can not be reached, the contents are scrolled to the nearest valid position. The default value for both margins is 50 pixels.
void QGraphicsView::ensureVisible | ( | const QRectF & | rect, |
int | xmargin = 50 , |
||
int | ymargin = 50 |
||
) |
Scrolls the contents of the viewport so the scene rectangle rect is visible, with margins specified in pixels by xmargin and ymargin. If the specified rect can not be reached the contents are scrolled to the nearest valid position. The default value for both margins is 50 pixels.
|
inline |
Equivalent to calling ensureVisible(QRectF(x, y, width, height), xmargin, ymargin).
|
overrideprotected |
Reimplemented from QAbstractScollArea::event()
void QGraphicsView::fitInView | ( | const QGraphicsItem * | item, |
Qt::AspectRatioMode | mode = Qt::IgnoreAspectRatio |
||
) |
Ensures item fits exactly inside the view by scaling the view according to mode.
void QGraphicsView::fitInView | ( | const QRectF & | rect, |
Qt::AspectRatioMode | mode = Qt::IgnoreAspectRatio |
||
) |
Scales the view matrix and scrolls the scroll bars to ensure that the scene rect fits inside the viewport. The given rect must be inside the scene rectangle otherwise this method can not guarantee the entire rectangle will be visible. This method does not change the current rotation, translation, or shear. The view is scaled according to mode. The rect will be centered in the view if it does not fit exactly. If rect is empty or if the viewport is too small this method will do nothing.
It is common to call this method from inside a reimplementation of resizeEvent() to ensure the entire scene or parts of the scene is scaled to fit the new size. However, this can lead to infinite resize recursion when the transformation toggles the state of the scrollbars. You can set the scrollbar policies to always on or always off to prevent this from happening.
|
inline |
Equivalent to calling fitInView(QRectF(x, y, width,height), mode).
|
overrideprotectedvirtual |
Reimplemented from QWidget::focusInEvent()
|
overrideprotectedvirtual |
Reimplemented from QWidget::focusNextPrevChild()
|
overrideprotectedvirtual |
Reimplemented from QWidget::focusOutEvent()
QBrush QGraphicsView::foregroundBrush | ( | ) | const |
Returns the value of the foregroundBrush property.
|
overrideprotectedvirtual |
Reimplemented from QWidget::inputMethodEvent()
|
overridevirtual |
Reimplemented from QWidget::inputMethodQuery()
|
slot |
Invalidates and schedules a redraw of layers inside rect. The given rect is in scene coordinates. Call this method to notify QGraphicsView of changes to the background or the foreground of the scene.
QGraphicsView only supports caching the background layer. This method is equivalent to calling update() if any layer other than QGraphicsScene::BackgroundLayer is passed.
bool QGraphicsView::isInteractive | ( | ) | const |
Returns the value of the QGraphicsView::interactive property.
bool QGraphicsView::isTransformed | ( | ) | const |
Returns true if the view is transformed which occurs when a transform has been assigned or the scrollbars are adjusted.
QGraphicsItem * QGraphicsView::itemAt | ( | const QPoint & | pos | ) | const |
Returns the item located at pos. The position is in viewport coordinates. If there are several items at this position this method returns the item in front.
|
inline |
QList< QGraphicsItem * > QGraphicsView::items | ( | ) | const |
Returns a sorted list of all the items in the current scene. The first element is the front item.
QList< QGraphicsItem * > QGraphicsView::items | ( | const QPainterPath & | path, |
Qt::ItemSelectionMode | mode = Qt::IntersectsItemShape |
||
) | const |
Returns a sorted list of all the items matching the given path and mode. The value for path is in viewport coordinates. The first element is the front item. The default value for mode is Qt::IntersectsItemShape where all items whose exact shape intersects with or is contained by path are returned.
QList< QGraphicsItem * > QGraphicsView::items | ( | const QPoint & | pos | ) | const |
Returns a sorted list of items at pos. The position is in viewport coordinates. The first element is the front item.
QList< QGraphicsItem * > QGraphicsView::items | ( | const QPolygon & | polygon, |
Qt::ItemSelectionMode | mode = Qt::IntersectsItemShape |
||
) | const |
Returns a sorted list of all the items matching the given polygon and mode. The value for polygon is in viewport coordinates. The first element is the front item. The default value for mode is Qt::IntersectsItemShape where all items whose exact shape intersects with or is contained by polygon are returned.
QList< QGraphicsItem * > QGraphicsView::items | ( | const QRect & | rect, |
Qt::ItemSelectionMode | mode = Qt::IntersectsItemShape |
||
) | const |
Returns a sorted list of all the items matching the given rect and mode. The value for rect is in viewport coordinates. The first element is the front item. The default value for mode is Qt::IntersectsItemShape where all items whose exact shape intersects with or is contained by rect are returned.
|
inline |
Equivalent to calling items(QPoint(x, y)).
|
inline |
Equivalent to calling items(QRectF(x, y, width, height), mode).
|
overrideprotectedvirtual |
Reimplemented from QWidget::keyPressEvent()
|
overrideprotectedvirtual |
Reimplemented from QWidget::keyReleaseEvent()
QPainterPath QGraphicsView::mapFromScene | ( | const QPainterPath & | path | ) | const |
Converts the given path from scene coordinates to viewport coordinates.
Converts the given point from scene coordinates to viewport coordinates.
Converts the given polygon from scene coordinates to viewport coordinates.
Converts the given rect from scene coordinates to viewport coordinates.
Equivalent to calling mapFromScene(QPointF(x, y)).
Equivalent to calling mapFromScene(QRectF(x, y, width, height)).
QPainterPath QGraphicsView::mapToScene | ( | const QPainterPath & | path | ) | const |
Converts the given path from viewport coordinates to scene coordinates.
Converts the given point from viewport coordinates to scene coordinates.
It can be useful to map the entire rectangle covered by the pixel at the given point instead of the point itself. To do this call mapToScene(QRect(point, QSize(2, 2))).
Converts the given polygon from viewport coordinates to scene coordinates.
Converts the given rect from viewport coordinates to scene coordinates.
|
inline |
Equivalent to calling mapToScene(QPoint(x, y)).
|
inline |
Equivalent to calling mapToScene(QRect(x, y, width, height).
QMatrix QGraphicsView::matrix | ( | ) | const |
Returns the current transformation matrix for the view. If no current transformation is set the identity matrix is returned.
|
overrideprotectedvirtual |
Reimplemented from QWidget::mouseDoubleClickEvent()
|
overrideprotectedvirtual |
Reimplemented from QWidget::mouseMoveEvent()
|
overrideprotectedvirtual |
Reimplemented from QWidget::mousePressEvent()
|
overrideprotectedvirtual |
Reimplemented from QWidget::mouseReleaseEvent()
OptimizationFlags QGraphicsView::optimizationFlags | ( | ) | const |
Returns the value of the optimizationFlags property.
|
overrideprotectedvirtual |
Reimplemented from QWidget::paintEvent()
void QGraphicsView::render | ( | QPainter * | painter, |
const QRectF & | target = QRectF() , |
||
const QRect & | source = QRect() , |
||
Qt::AspectRatioMode | mode = Qt::KeepAspectRatio |
||
) |
Renders the source rectangle which is in view coordinates into the target rectangle, which is in paint device coordinates, using painter. This method is useful for rendering the contents of the view onto a paint device, such as a QImage or for printing to a QPrinter.
If source is a null rectangle this method will call rect() to determine what to render. If the target is a null rectangle the full dimensions of the QPainter device will be used. The source rectangle contents will be transformed according to mode to fit into the target rectangle. By default, the aspect ratio is kept and source is scaled to fit in target.
QPainter::RenderHints QGraphicsView::renderHints | ( | ) | const |
Returns the value of the renderHints property.
void QGraphicsView::resetCachedContent | ( | ) |
Clears all cached content. If the current cache mode is CacheNone then this method does nothing. This method is called automatically when the backgroundBrush or QGraphicsScene::backgroundBrush properties change. Only call this method if you have reimplemented QGraphicsScene::drawBackground() or QGraphicsView::drawBackground() to draw a custom background and need to trigger a full redraw.
void QGraphicsView::resetMatrix | ( | ) |
Resets the view transformation matrix to the identity matrix.
void QGraphicsView::resetTransform | ( | ) |
Resets the view transformation matrix to the identity matrix.
ViewportAnchor QGraphicsView::resizeAnchor | ( | ) | const |
Returns the value of the resizeAnchor property.
|
overrideprotectedvirtual |
Reimplemented from QWidget::resizeEvent()
void QGraphicsView::rotate | ( | qreal | angle | ) |
Rotates the current view transformation angle degrees clockwise.
|
signal |
This signal is emitted when the rubber band rectangle is changed. The viewport is specified by viewportRect. The drag start position and drag end position are provided in scene coordinates with fromScenePoint and toScenePoint.
When a rubber band selection ends this signal will be emitted and all of the values will be null.
QRect QGraphicsView::rubberBandRect | ( | ) | const |
This method returns the current rubber band area in viewport coordinates if the user is currently doing an item selection with the rubber band. When the user is not using the rubber band this method returns a null QRectF. Part of this QRect can be outside the visual viewport or contain negative values.
Qt::ItemSelectionMode QGraphicsView::rubberBandSelectionMode | ( | ) | const |
Returns the value of the rubberBandSelectionMode property.
Scales the current view transformation by (sx, sy).
QGraphicsScene * QGraphicsView::scene | ( | ) | const |
Returns a pointer to the scene which is currently displayed in the view. If no scene is currently displayed a nullptr is returned.
|
overrideprotectedvirtual |
Reimplemented from QAbstractScrollArea::scrollContentsBy()
void QGraphicsView::setAlignment | ( | Qt::Alignment | alignment | ) |
Sets the value of the QGraphicsView::alignment property to alignment.
void QGraphicsView::setBackgroundBrush | ( | const QBrush & | brush | ) |
Sets the value of the backgroundBrush property to brush.
void QGraphicsView::setCacheMode | ( | CacheMode | mode | ) |
Sets the value of the cacheMode property to mode.
void QGraphicsView::setForegroundBrush | ( | const QBrush & | brush | ) |
Sets the value of the foregroundBrush property to brush.
void QGraphicsView::setInteractive | ( | bool | allowed | ) |
Sets the value of the QGraphicsView::interactive property to allowed.
void QGraphicsView::setMatrix | ( | const QMatrix & | matrix, |
bool | combine = false |
||
) |
Sets the view's current transformation to matrix. If combine is true then the given matrix is combined with the current matrix, otherwise matrix replaces the current matrix.
The transformation matrix is used to transform the scene into view coordinates. The default transformation uses the identity matrix which means one pixel in the view is one unit in the scene. To simplify interaction with items using a transformed view, QGraphicsView provides mapToScene() and mapFromScene() methods which translate between scene and view coordinates.
void QGraphicsView::setOptimizationFlag | ( | OptimizationFlag | flag, |
bool | enabled = true |
||
) |
Enables flag if enabled is true, otherwise disables flag.
void QGraphicsView::setOptimizationFlags | ( | OptimizationFlags | flags | ) |
Sets the value of the optimizationFlags property to flags.
void QGraphicsView::setRenderHint | ( | QPainter::RenderHint | hint, |
bool | enabled = true |
||
) |
If enabled is true the render hint is enabled, otherwise it is disabled.
void QGraphicsView::setRenderHints | ( | QPainter::RenderHints | hints | ) |
Sets the value of the renderHints property to hints.
void QGraphicsView::setResizeAnchor | ( | ViewportAnchor | anchor | ) |
Sets the value of the resizeAnchor property to anchor.
void QGraphicsView::setRubberBandSelectionMode | ( | Qt::ItemSelectionMode | mode | ) |
Sets the value of the rubberBandSelectionMode property to mode.
void QGraphicsView::setScene | ( | QGraphicsScene * | scene | ) |
Sets the current scene to the given scene. If the scene is being displayed this method does nothing. When a scene is set on a view the QGraphicsScene::changed() signal is automatically connected to this view's updateScene() slot and the view's scroll bars are adjusted to fit the size of the scene.
|
inline |
Sets the value of the sceneRect property to rect.
Sets the value of the sceneRect property to (x, y, width, height).
void QGraphicsView::setTransform | ( | const QTransform & | matrix, |
bool | combine = false |
||
) |
Sets the view's current transformation to matrix. If combine is true then the given matrix is combined with the current matrix, otherwise matrix replaces the current matrix.
The transformation matrix is used to transform the scene into view coordinates. The default transformation uses the identity matrix which means one pixel in the view is one unit in the scene. To simplify interaction with items using a transformed view, QGraphicsView provides mapToSceene() and mapFromScene() methods which translate between scene and view coordinates.
void QGraphicsView::setTransformationAnchor | ( | ViewportAnchor | anchor | ) |
Sets the value of the transformationAnchor property to anchor.
|
protectedslot |
This slot is called by QAbstractScrollArea after setViewport() has been called. Reimplement this method in a subclass of QGraphicsView to initialize the new viewport widget before it is used.
void QGraphicsView::setViewportUpdateMode | ( | ViewportUpdateMode | mode | ) |
Sets the value of the viewportUpdateMode property to mode.
Shears the current view transformation by (sh, sv).
|
overrideprotectedvirtual |
Reimplemented from QWidget::showEvent()
|
overridevirtual |
Reimplemented from QWidget::sizeHint()
QTransform QGraphicsView::transform | ( | ) | const |
Returns the current transformation matrix for the view. If no transformation is set the identity matrix is returned.
ViewportAnchor QGraphicsView::transformationAnchor | ( | ) | const |
Returns the value of the transformationAnchor property.
Translates the current view transformation by (dx, dy).
Schedules an update of the scene rectangles rects.
|
slot |
Notifies QGraphicsView the scene's rectangle has changed. The given rect is the new scene rectangle. If the view already has an explicitly set scene rectangle this method does nothing.
|
overrideprotectedvirtual |
Reimplemented from QAbstractScrollArea::viewportEvent()
QTransform QGraphicsView::viewportTransform | ( | ) | const |
Returns a matrix which maps viewport coordinates to scene coordinates.
ViewportUpdateMode QGraphicsView::viewportUpdateMode | ( | ) | const |
Returns the value of the viewportUpdateMode property.
|
overrideprotectedvirtual |
Reimplemented from QWidget::wheelEvent()
|
This property holds the alignment of the scene in the view when the entire scene is visible.
If the entire scene is visible in the view the alignment will determine where the scene will be rendered in the view. For example, if the alignment is Qt::AlignCenter the scene will be centered in the view and if the alignment is (Qt::AlignLeft | Qt::AlignTop) the scene will be rendered in the top-left corner of the view.
Properties | Class Methods |
---|---|
read | alignment |
write | setAlignment |
|
This property holds the background brush of the scene. This property sets the background brush for the scene in this view. It is used to override the scene's own background and defines the behavior of drawBackground(). To provide custom background drawing for this view reimplement drawBackground().
By default, this property contains a brush with the Qt::NoBrush pattern.
Properties | Class Methods |
---|---|
read | backgroundBrush |
write | setBackgroundBrush |
|
This property holds which parts of the view are cached. QGraphicsView can cache pre-rendered content in a QPixmap, which is then drawn onto the viewport. The purpose of such caching is to speed up the total rendering time for areas which are slow to render. Texture, gradient, and alpha blended backgrounds, can be slow to render, especially with a transformed view. The CacheBackground flag enables caching of the view's background.
The cache is invalidated every time the view is transformed. When scrolling, only partial invalidation is required. By default nothing is cached.
Properties | Class Methods |
---|---|
read | cacheMode |
write | setCacheMode |
|
This property holds the behavior for dragging the mouse over the scene while the left mouse button is pressed. This property defines what should happen when the user clicks on the scene background and drags the mouse along the background. The default value NoDrag does nothing.
This dragMode only affects mouse clicks that are not handled by any item. You can define a custom behavior by creating a subclass of QGraphicsView and reimplementing mouseMoveEvent().
Properties | Class Methods |
---|---|
read | dragMode |
write | setDragMode |
|
This property holds the foreground brush of the scene. This property sets the foreground brush for the scene in this view. It is used to override the foreground and defines the behavior of drawForeground(). To customize the foreground drawing for this view reimplement drawForeground(). By default, this property contains a brush with the Qt::NoBrush pattern.
Properties | Class Methods |
---|---|
read | foregroundBrush |
write | setForegroundBrush |
|
This property holds whether the view allowed scene interaction. If enabled the view is set to allow scene interaction. Otherwise, this view will not allow interaction and any mouse or key events are ignored. By default, this property is true.
Properties | Class Methods |
---|---|
read | isInteractive |
write | setInteractive |
|
This property holds flags which are used to optimize performance. QGraphicsView uses clipping, extra bounding rectangle adjustments, and certain other strategies to improve rendering quality and performance for the common case graphics scene. Depending on the target platform the scene and the viewport, some of these strategies operations can degrade performance and should be turned off. By default, no optimization flags are enabled.
Properties | Class Methods |
---|---|
read | optimizationFlags |
write | setOptimizationFlags |
|
This property holds the default render hints for the view. These hints are used to initialize the QPainter before each visible item is drawn. QPainter uses render hints to toggle features such as antialiasing and smooth pixmap transformation. QPainter::TextAntialiasing is enabled by default.
Properties | Class Methods |
---|---|
read | renderHints |
write | setRenderHints |
|
This property indicates how the view should position the scene when the view is resized. The default behavior of NoAnchor leaves the scene's position unchanged during a resize. The top-left corner of the view will appear to be stationary while resizing.
The effect of this property is noticeable when only a part of the scene is visible. If the whole scene fits in the view QGraphicsScene uses the view alignment to position the scene in the view.
Properties | Class Methods |
---|---|
read | resizeAnchor |
write | setResizeAnchor |
|
This property holds the behavior for selecting items with a rubber band selection rectangle. This property defines how items are selected when using the RubberBandDrag drag mode. The default value is Qt::IntersectsItemShape which means all items whose shape intersects with or is contained by the rubber band are selected.
Properties | Class Methods |
---|---|
read | rubberBandSelectionMode |
write | setRubberBandSelectionMode |
|
This property holds the area of the scene displayed in the current view. The scene rectangle defines the boundaries of the scene that can be navigated using the scroll bars. If this property is not set or is a null QRectF the value of QGraphicsScene::sceneRect will be used. By default this property contains a rectangle at the origin with zero width and height.
Although the scene supports a virtually unlimited size the range of the scroll bars will never exceed the range of an integer. When the scene is larger than the scroll bar range the translate() method can be used to navigate the scene.
Properties | Class Methods |
---|---|
read | sceneRect |
write | setSceneRect |
|
This property defines how the view should position the scene during transformations. The default behavior uses AnchorViewCenter, to ensure the point at the center of the view remains unchanged during transformations. The effect of this property is noticeable when only a part of the scene is visible. If the entire scene fits in the view the view alignment is used to position the scene in the view.
Properties | Class Methods |
---|---|
read | transformationAnchor |
write | setTransformationAnchor |
|
This property holds how the viewport should update its contents. QGraphicsView uses this property to decide how to update areas of the scene which have been exposed or changed. Normally this property does not need to be changed. However there are some cases where using a different mode can improve rendering performance.
The default value is MinimalViewportUpdate, where QGraphicsView will update as small an area of the viewport as possible when the contents change.
Properties | Class Methods |
---|---|
read | viewportUpdateMode |
write | setViewportUpdateMode |