Qyoto  4.0.7
Qyoto is a C# language binding for Qt
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Properties
QtGui.QGraphicsView Class Reference

The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene. More...

Inheritance diagram for QtGui.QGraphicsView:
Collaboration diagram for QtGui.QGraphicsView:

Public Types

enum  CacheModeFlag { CacheBackground = 1, CacheNone = 0 }
  More...
 
enum  DragMode { NoDrag = 0, RubberBandDrag = 2, ScrollHandDrag = 1 }
  More...
 
enum  OptimizationFlag { DontAdjustForAntialiasing = 4, DontClipPainter = 1, DontSavePainterState = 2, IndirectPainting = 8 }
  More...
 
enum  ViewportAnchor { AnchorUnderMouse = 2, AnchorViewCenter = 1, NoAnchor = 0 }
  More...
 
enum  ViewportUpdateMode {
  BoundingRectViewportUpdate = 4, FullViewportUpdate = 0, MinimalViewportUpdate = 1, NoViewportUpdate = 3,
  SmartViewportUpdate = 2
}
  More...
 

Public Member Functions

 QGraphicsView (QWidget parent=null)
  More...
 
 QGraphicsView (QGraphicsScene scene, QWidget parent=null)
  More...
 
override void CreateProxy ()
 
new void CenterOn (QPointF pos)
  More...
 
new void CenterOn (IQGraphicsItem item)
  More...
 
new void CenterOn (double x, double y)
  More...
 
new void EnsureVisible (QRectF rect, int xmargin=50, int ymargin=50)
  More...
 
new void EnsureVisible (IQGraphicsItem item, int xmargin=50, int ymargin=50)
  More...
 
new void EnsureVisible (double x, double y, double w, double h, int xmargin=50, int ymargin=50)
  More...
 
override bool OnEvent (QEvent @event)
  More...
 
new void FitInView (QRectF rect, Qt.AspectRatioMode aspectRadioMode=Qt.AspectRatioMode.IgnoreAspectRatio)
  More...
 
new void FitInView (IQGraphicsItem item, Qt.AspectRatioMode aspectRadioMode=Qt.AspectRatioMode.IgnoreAspectRatio)
  More...
 
new void FitInView (double x, double y, double w, double h, Qt.AspectRatioMode aspectRadioMode=Qt.AspectRatioMode.IgnoreAspectRatio)
  More...
 
override object InputMethodQuery (Qt.InputMethodQuery query)
  More...
 
new void InvalidateScene ()
  More...
 
new void InvalidateScene (QRectF rect, QGraphicsScene.SceneLayer layers=QGraphicsScene.SceneLayer.AllLayers)
  More...
 
new IQGraphicsItem ItemAt (QPoint pos)
  More...
 
new IQGraphicsItem ItemAt (int x, int y)
  More...
 
new
System.Collections.Generic.List
< IQGraphicsItem
Items ()
  More...
 
new
System.Collections.Generic.List
< IQGraphicsItem
Items (QPoint pos)
  More...
 
new
System.Collections.Generic.List
< IQGraphicsItem
Items (QRect rect, Qt.ItemSelectionMode mode=Qt.ItemSelectionMode.IntersectsItemShape)
  More...
 
new
System.Collections.Generic.List
< IQGraphicsItem
Items (QPolygon polygon, Qt.ItemSelectionMode mode=Qt.ItemSelectionMode.IntersectsItemShape)
  More...
 
new
System.Collections.Generic.List
< IQGraphicsItem
Items (QPainterPath path, Qt.ItemSelectionMode mode=Qt.ItemSelectionMode.IntersectsItemShape)
  More...
 
new
System.Collections.Generic.List
< IQGraphicsItem
Items (int x, int y)
  More...
 
new
System.Collections.Generic.List
< IQGraphicsItem
Items (int x, int y, int w, int h, Qt.ItemSelectionMode mode=Qt.ItemSelectionMode.IntersectsItemShape)
  More...
 
new QPoint MapFromScene (QPointF point)
  More...
 
new QPolygon MapFromScene (QRectF rect)
  More...
 
new QPolygon MapFromScene (QPolygonF polygon)
  More...
 
new QPainterPath MapFromScene (QPainterPath path)
  More...
 
new QPoint MapFromScene (double x, double y)
  More...
 
new QPolygon MapFromScene (double x, double y, double w, double h)
  More...
 
new QPointF MapToScene (QPoint point)
  More...
 
new QPolygonF MapToScene (QRect rect)
  More...
 
new QPolygonF MapToScene (QPolygon polygon)
  More...
 
new QPainterPath MapToScene (QPainterPath path)
  More...
 
new QPointF MapToScene (int x, int y)
  More...
 
new QPolygonF MapToScene (int x, int y, int w, int h)
  More...
 
new void Render (QPainter painter)
  More...
 
new void Render (QPainter painter, QRectF target)
  More...
 
new void Render (QPainter painter, QRectF target, QRect source, Qt.AspectRatioMode aspectRatioMode=Qt.AspectRatioMode.KeepAspectRatio)
  More...
 
new void ResetCachedContent ()
  More...
 
new void ResetMatrix ()
  More...
 
new void ResetTransform ()
  More...
 
new void Rotate (double angle)
  More...
 
new void Scale (double sx, double sy)
  More...
 
new void SetMatrix (QMatrix matrix, bool combine=false)
  More...
 
new void SetOptimizationFlag (QGraphicsView.OptimizationFlag flag, bool enabled=true)
  More...
 
new void SetRenderHint (QPainter.RenderHint hint, bool enabled=true)
  More...
 
new void SetSceneRect (double x, double y, double w, double h)
 
new void SetTransform (QTransform matrix, bool combine=false)
  More...
 
new void Shear (double sh, double sv)
  More...
 
new void Translate (double dx, double dy)
  More...
 
new void UpdateScene (System.Collections.Generic.List< QRectF > rects)
  More...
 
new void UpdateSceneRect (QRectF rect)
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtGui.QAbstractScrollArea
 QAbstractScrollArea (QWidget parent=null)
  More...
 
new void AddScrollBarWidget (QWidget widget, Qt.AlignmentFlag alignment)
  More...
 
override bool OnEvent (QEvent @event)
  More...
 
new
System.Collections.Generic.List
< QWidget
ScrollBarWidgets (Qt.AlignmentFlag alignment)
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtGui.QFrame
 QFrame (QWidget parent=null, Qt.WindowType f=0)
  More...
 
override bool OnEvent (QEvent e)
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtGui.QWidget
 QWidget (QWidget parent=null, Qt.WindowType f=0)
  More...
 
override void CreateProxy ()
 
new void ActivateWindow ()
  More...
 
new void AddAction (QAction action)
  More...
 
new void AddActions (System.Collections.Generic.List< QAction > actions)
  More...
 
new void AdjustSize ()
  More...
 
new QWidget ChildAt (QPoint p)
  More...
 
new QWidget ChildAt (int x, int y)
  More...
 
new void ClearFocus ()
  More...
 
new void ClearMask ()
  More...
 
new bool Close ()
  More...
 
new void CreateWinId ()
 
new void EnsurePolished ()
  More...
 
override bool OnEvent (QEvent @event)
  More...
 
new QWidget FocusWidget ()
  More...
 
new void GetContentsMargins (ref int left, ref int top, ref int right, ref int bottom)
  More...
 
virtual System.IntPtr GetDC ()
  More...
 
new void GrabGesture (Qt.GestureType type, Qt.GestureFlag flags=0)
  More...
 
new void GrabKeyboard ()
  More...
 
new void GrabMouse ()
  More...
 
new void GrabMouse (QCursor cursor)
  More...
 
new int GrabShortcut (QKeySequence key, Qt.ShortcutContext context=Qt.ShortcutContext.WindowShortcut)
  More...
 
virtual int HeightForWidth (int w)
  More...
 
new void Hide ()
  More...
 
new void InsertAction (QAction before, QAction action)
  More...
 
new void InsertActions (QAction before, System.Collections.Generic.List< QAction > actions)
  More...
 
new bool IsAncestorOf (QWidget child)
  More...
 
new bool IsEnabledTo (QWidget ancestor)
  More...
 
new bool IsVisibleTo (QWidget ancestor)
  More...
 
new void Lower ()
  More...
 
new QPoint MapFrom (QWidget parent, QPoint pos)
  More...
 
new QPoint MapFromGlobal (QPoint pos)
  More...
 
new QPoint MapFromParent (QPoint pos)
  More...
 
new QPoint MapTo (QWidget parent, QPoint pos)
  More...
 
new QPoint MapToGlobal (QPoint pos)
  More...
 
new QPoint MapToParent (QPoint pos)
  More...
 
new void Move (int x, int y)
 
new void OverrideWindowFlags (Qt.WindowType type)
  More...
 
new void OverrideWindowState (Qt.WindowState state)
 
new void Raise ()
  More...
 
virtual void ReleaseDC (System.IntPtr hdc)
  More...
 
new void ReleaseKeyboard ()
  More...
 
new void ReleaseMouse ()
  More...
 
new void ReleaseShortcut (int id)
  More...
 
new void RemoveAction (QAction action)
  More...
 
new void Render (IQPaintDevice target)
  More...
 
new void Render (QPainter painter)
  More...
 
new void Render (IQPaintDevice target, QPoint targetOffset)
  More...
 
new void Render (QPainter painter, QPoint targetOffset)
  More...
 
new void Render (IQPaintDevice target, QPoint targetOffset, QRegion sourceRegion, QWidget.RenderFlag renderFlags=QWidget.RenderFlag.DrawWindowBackground|QWidget.RenderFlag.DrawChildren)
  More...
 
new void Render (QPainter painter, QPoint targetOffset, QRegion sourceRegion, QWidget.RenderFlag renderFlags=QWidget.RenderFlag.DrawWindowBackground|QWidget.RenderFlag.DrawChildren)
  More...
 
new void Repaint ()
  More...
 
new void Repaint (QRect rect)
  More...
 
new void Repaint (QRegion rgn)
  More...
 
new void Repaint (int x, int y, int w, int h)
  More...
 
new void Resize (int w, int h)
 
new bool RestoreGeometry (QByteArray geometry)
  More...
 
new QByteArray SaveGeometry ()
  More...
 
new void Scroll (int dx, int dy)
  More...
 
new void Scroll (int dx, int dy, QRect r)
  More...
 
new void SetAttribute (Qt.WidgetAttribute attribute, bool on=true)
  More...
 
new void SetBaseSize (int basew, int baseh)
 
new void SetContentsMargins (int left, int top, int right, int bottom)
  More...
 
new void SetDisabled (bool disable)
  More...
 
new void SetFixedHeight (int h)
  More...
 
new void SetFixedSize (QSize s)
  More...
 
new void SetFixedSize (int w, int h)
  More...
 
new void SetFixedWidth (int w)
  More...
 
new void SetFocus ()
  More...
 
new void SetFocus (Qt.FocusReason reason)
  More...
 
new void SetGeometry (int x, int y, int w, int h)
 
new void SetHidden (bool hidden)
  More...
 
new void SetMask (QBitmap bitmap)
  More...
 
new void SetMaximumSize (int maxw, int maxh)
 
new void SetMinimumSize (int minw, int minh)
 
new void SetParent (QWidget parent)
  More...
 
new void SetParent (QWidget parent, Qt.WindowType f)
  More...
 
new void SetShortcutAutoRepeat (int id, bool enable=true)
  More...
 
new void SetShortcutEnabled (int id, bool enable=true)
  More...
 
new void SetShown (bool shown)
  More...
 
new void SetSizeIncrement (int w, int h)
 
new void SetSizePolicy (QSizePolicy.Policy horizontal, QSizePolicy.Policy vertical)
 
new void Show ()
  More...
 
new void ShowFullScreen ()
  More...
 
new void ShowMaximized ()
  More...
 
new void ShowMinimized ()
  More...
 
new void ShowNormal ()
  More...
 
new void StackUnder (QWidget w)
  More...
 
new bool TestAttribute (Qt.WidgetAttribute attribute)
  More...
 
new void UngrabGesture (Qt.GestureType type)
  More...
 
new void UnsetCursor ()
 
new void UnsetLayoutDirection ()
 
new void UnsetLocale ()
 
new void Update ()
  More...
 
new void Update (QRect rect)
  More...
 
new void Update (QRegion rgn)
  More...
 
new void Update (int x, int y, int w, int h)
  More...
 
new void UpdateGeometry ()
  More...
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.QObject
 QObject (QObject parent=null)
  More...
 
new bool BlockSignals (bool b)
  More...
 
new bool Connect (QObject sender, string signal, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
  More...
 
new void DeleteLater ()
  More...
 
new bool Disconnect (QObject receiver, string member=null)
  More...
 
new bool Disconnect (string signal=null, QObject receiver=null, string member=null)
  More...
 
new void DumpObjectInfo ()
  More...
 
new void DumpObjectTree ()
  More...
 
virtual bool EventFilter (QObject watched, QEvent @event)
  More...
 
new bool Inherits (string classname)
  More...
 
new void InstallEventFilter (QObject filterObj)
  More...
 
new void KillTimer (int id)
  More...
 
new object Property (string name)
  More...
 
new void RemoveEventFilter (QObject obj)
  More...
 
new bool SetProperty (string name, object value)
  More...
 
new void SetUserData (uint id, QObjectUserData data)
 
new int StartTimer (int interval)
  More...
 
new QObjectUserData UserData (uint id)
 
new void Dispose ()
 
- Public Member Functions inherited from QtCore.Qt
delegate QTextStream FuncQTextStreamQTextStream (QTextStream qTextStream)
 
delegate void ActionQtMsgTypeString (QtMsgType qtMsgType, string @string)
 
delegate QObject FuncQObject ()
 
delegate string FuncStringQByteArray (QByteArray qByteArray)
 
delegate QByteArray FuncQByteArrayString (string @string)
 

Static Public Member Functions

static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtGui.QAbstractScrollArea
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtGui.QFrame
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtGui.QWidget
static QWidget Find (NativeULong id)
  More...
 
static void SetTabOrder (QWidget first, QWidget second)
  More...
 
static string Tr (string s, string c=null)
 
static string Tr (string s, string c, int n)
 
static string TrUtf8 (string s, string c=null)
 
static string TrUtf8 (string s, string c, int n)
 
- Static Public Member Functions inherited from QtCore.QObject
static bool Connect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod method, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
  More...
 
static bool Connect (QObject sender, string signal, QObject receiver, string member, Qt.ConnectionType type=Qt.ConnectionType.AutoConnection)
  More...
 
static bool Disconnect (QObject sender, QMetaMethod signal, QObject receiver, QMetaMethod member)
  More...
 
static bool Disconnect (QObject sender, string signal, QObject receiver, string member)
  More...
 
static string Tr (string s, string c=null)
  More...
 
static string Tr (string s, string c, int n)
  More...
 
static string TrUtf8 (string s, string c=null)
  More...
 
static string TrUtf8 (string s, string c, int n)
  More...
 
- Static Public Member Functions inherited from QtCore.Qt
static QDataStream Write (QDataStream s, object p)
 
static QDataStream Write (QDataStream stream, QSizeF size)
  More...
 
static QDataStream Write (QDataStream stream, QPoint point)
  More...
 
static QTextStream Write (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Write (QDataStream stream, QLineF line)
  More...
 
static QDataStream Write (QDataStream stream, QPointF point)
  More...
 
static QDataStream Write (QDataStream @out, QChar chr)
  More...
 
static QDataStream Write (QDataStream @out, QByteArray ba)
  More...
 
static QDataStream Write (QDataStream stream, QEasingCurve easing)
  More...
 
static QDataStream Write (QDataStream stream, QRectF rectangle)
  More...
 
static QDataStream Write (QDataStream @out, QDateTime dateTime)
  More...
 
static QDataStream Write (QDataStream @out, QUrl url)
  More...
 
static QDataStream Write (QDataStream @out, QTime time)
  More...
 
static QDataStream Write (QDataStream arg1, QLocale arg2)
 
static QDataStream Write (QDataStream @out, QBitArray ba)
  More...
 
static QDataStream Write (QDataStream s, QUuid id)
  More...
 
static QDataStream Write (QDataStream stream, QLine line)
  More...
 
static QDataStream Write (QDataStream @out, QDate date)
  More...
 
static QDataStream Write (QDataStream @out, QRegExp regExp)
  More...
 
static QDataStream Write (QDataStream stream, QRect rectangle)
  More...
 
static QDataStream Write (QDataStream stream, QSize size)
  More...
 
static QDataStream Write (QDataStream s, QVariant.Type p)
 
static QDataStream Write (QDataStream arg1, string arg2)
 
static QDataStream Write (QDataStream @out, System.Collections.Generic.List< string > list)
  More...
 
static QDataStream Read (QDataStream @in, QChar chr)
  More...
 
static QDataStream Read (QDataStream arg1, QLocale arg2)
 
static QDataStream Read (QDataStream stream, QRect rectangle)
  More...
 
static QDataStream Read (QDataStream arg1, QEasingCurve arg2)
 
static QDataStream Read (QDataStream @in, QDate date)
  More...
 
static QDataStream Read (QDataStream @in, QUrl url)
  More...
 
static QDataStream Read (QDataStream s, QUuid id)
  More...
 
static QTextStream Read (QTextStream s, Qt.FuncQTextStreamQTextStream f)
 
static QDataStream Read (QDataStream stream, QLineF line)
  More...
 
static QDataStream Read (QDataStream stream, QRectF rectangle)
  More...
 
static QDataStream Read (QDataStream stream, QPointF point)
  More...
 
static QDataStream Read (QDataStream stream, QLine line)
  More...
 
static QDataStream Read (QDataStream @in, QBitArray ba)
  More...
 
static QDataStream Read (QDataStream stream, QSize size)
  More...
 
static QDataStream Read (QDataStream @in, QDateTime dateTime)
  More...
 
static QDataStream Read (QDataStream @in, QTime time)
  More...
 
static QDataStream Read (QDataStream stream, QPoint point)
  More...
 
static QDataStream Read (QDataStream @in, QRegExp regExp)
  More...
 
static QDataStream Read (QDataStream s, object p)
 
static QDataStream Read (QDataStream @in, QByteArray ba)
  More...
 
static QDataStream Read (QDataStream stream, QSizeF size)
  More...
 
static QDataStream Read (QDataStream arg1, string arg2)
 
static QDataStream Read (QDataStream s, QVariant.Type p)
 
static QDataStream Read (QDataStream @in, System.Collections.Generic.List< string > list)
  More...
 
static double QAcos (double v)
  More...
 
static void QAddPostRoutine (System.Action ptr)
  More...
 
static double QAsin (double v)
  More...
 
static double QAtan (double v)
  More...
 
static double QAtan2 (double x, double y)
  More...
 
static void QBadAlloc ()
 
static int QCeil (double v)
  More...
 
static ushort QChecksum (string s, uint len)
  More...
 
static QByteArray QCompress (QByteArray data, int compressionLevel=-1)
  More...
 
static QByteArray QCompress (Pointer< byte > data, int nbytes, int compressionLevel=-1)
  More...
 
static double QCos (double v)
  More...
 
static double QExp (double v)
  More...
 
static double QFabs (double v)
 
static double QFastCos (double x)
 
static double QFastSin (double x)
 
static string QFlagLocation (string method)
 
static int QFloor (double v)
  More...
 
static bool QFuzzyCompare (double p1, double p2)
  More...
 
static bool QFuzzyCompare (float p1, float p2)
  More...
 
static bool QFuzzyIsNull (double d)
 
static bool QFuzzyIsNull (float f)
 
static uint QHash (QBitArray key)
  More...
 
static uint QHash (QChar key)
  More...
 
static uint QHash (QStringRef key)
 
static uint QHash (QUrl url)
  More...
 
static uint QHash (QPersistentModelIndex index)
 
static uint QHash (QByteArray key)
  More...
 
static uint QHash (QModelIndex index)
 
static uint QHash (uint key)
  More...
 
static uint QHash (char key)
  More...
 
static uint QHash (byte key)
  More...
 
static uint QHash (short key)
  More...
 
static uint QHash (NativeLong key)
  More...
 
static uint QHash (ushort key)
  More...
 
static uint QHash (long key)
  More...
 
static uint QHash (ulong key)
  More...
 
static uint QHash (int key)
  More...
 
static uint QHash (string key)
  More...
 
static uint QHash (NativeULong key)
  More...
 
static Qt.ActionQtMsgTypeString QInstallMsgHandler (Qt.ActionQtMsgTypeString handler)
  More...
 
static int QIntCast (float f)
 
static int QIntCast (double f)
 
static bool QIsFinite (double d)
 
static bool QIsFinite (float f)
 
static bool QIsInf (float f)
 
static bool QIsInf (double d)
 
static bool QIsNaN (float f)
 
static bool QIsNaN (double d)
 
static bool QIsNull (float f)
 
static bool QIsNull (double d)
 
static double QLn (double v)
  More...
 
static double QPow (double x, double y)
  More...
 
static void QRegisterStaticPluginInstanceFunction (Qt.FuncQObject function)
  More...
 
static void QRemovePostRoutine (System.Action arg1)
 
static int QRound (double d)
  More...
 
static long QRound64 (double d)
  More...
 
static double QSin (double v)
  More...
 
static double QSqrt (double v)
  More...
 
static bool QStringComparisonHelper (QStringRef s1, string s2)
 
static double QTan (double v)
  More...
 
static QByteArray QUncompress (QByteArray data)
  More...
 
static QByteArray QUncompress (Pointer< byte > data, int nbytes)
  More...
 
static void Qbswap_helper (Pointer< byte > src, Pointer< byte > dest, int size)
 
static QByteArray Qgetenv (string varName)
  More...
 
static bool Qputenv (string varName, QByteArray value)
  More...
 
static void Qsrand (uint seed)
  More...
 
static int Qstrcmp (QByteArray str1, QByteArray str2)
 
static int Qstrcmp (QByteArray str1, string str2)
 
static int Qstrcmp (string str1, QByteArray str2)
 
static int Qstrcmp (string str1, string str2)
  More...
 
static Pointer< sbyte > Qstrcpy (Pointer< sbyte > dst, string src)
  More...
 
static Pointer< sbyte > Qstrdup (string src)
  More...
 
static int Qstricmp (string str1, string str2)
  More...
 
static uint Qstrlen (string str)
  More...
 
static int Qstrncmp (string str1, string str2, uint len)
  More...
 
static Pointer< sbyte > Qstrncpy (Pointer< sbyte > dst, string src, uint len)
  More...
 
static int Qstrnicmp (string str1, string str2, uint len)
  More...
 
static uint Qstrnlen (string str, uint maxlen)
  More...
 

Protected Member Functions

 QGraphicsView (System.Type dummy)
 
override void OnContextMenuEvent (QContextMenuEvent @event)
  More...
 
override void OnDragEnterEvent (QDragEnterEvent @event)
  More...
 
override void OnDragLeaveEvent (QDragLeaveEvent @event)
  More...
 
override void OnDragMoveEvent (QDragMoveEvent @event)
  More...
 
virtual void DrawBackground (QPainter painter, QRectF rect)
  More...
 
virtual void DrawForeground (QPainter painter, QRectF rect)
  More...
 
virtual void DrawItems (QPainter painter, int numItems, IQGraphicsItem items, QStyleOptionGraphicsItem options)
  More...
 
override void OnDropEvent (QDropEvent @event)
  More...
 
override void OnFocusInEvent (QFocusEvent @event)
  More...
 
override bool FocusNextPrevChild (bool next)
  More...
 
override void OnFocusOutEvent (QFocusEvent @event)
  More...
 
override void OnInputMethodEvent (QInputMethodEvent @event)
  More...
 
override void OnKeyPressEvent (QKeyEvent @event)
  More...
 
override void OnKeyReleaseEvent (QKeyEvent @event)
  More...
 
override void OnMouseDoubleClickEvent (QMouseEvent @event)
  More...
 
override void OnMouseMoveEvent (QMouseEvent @event)
  More...
 
override void OnMousePressEvent (QMouseEvent @event)
  More...
 
override void OnMouseReleaseEvent (QMouseEvent @event)
  More...
 
override void OnPaintEvent (QPaintEvent @event)
  More...
 
override void OnResizeEvent (QResizeEvent @event)
  More...
 
override void ScrollContentsBy (int dx, int dy)
  More...
 
new void SetupViewport (QWidget widget)
  More...
 
override void OnShowEvent (QShowEvent @event)
  More...
 
override bool OnViewportEvent (QEvent @event)
  More...
 
override void OnWheelEvent (QWheelEvent @event)
  More...
 
- Protected Member Functions inherited from QtGui.QAbstractScrollArea
 QAbstractScrollArea (System.Type dummy)
 
override void OnContextMenuEvent (QContextMenuEvent e)
  More...
 
override void OnKeyPressEvent (QKeyEvent e)
  More...
 
override void OnMouseDoubleClickEvent (QMouseEvent e)
  More...
 
override void OnMouseMoveEvent (QMouseEvent e)
  More...
 
override void OnMousePressEvent (QMouseEvent e)
  More...
 
override void OnMouseReleaseEvent (QMouseEvent e)
  More...
 
new void SetViewportMargins (QMargins margins)
  More...
 
new void SetViewportMargins (int left, int top, int right, int bottom)
  More...
 
new void SetupViewport (QWidget viewport)
  More...
 
override void OnWheelEvent (QWheelEvent e)
  More...
 
- Protected Member Functions inherited from QtGui.QFrame
 QFrame (System.Type dummy)
 
override void OnChangeEvent (QEvent ev)
  More...
 
new void DrawFrame (QPainter arg1)
 
- Protected Member Functions inherited from QtGui.QWidget
 QWidget (System.Type dummy)
 
virtual void OnActionEvent (QActionEvent @event)
  More...
 
virtual void OnChangeEvent (QEvent @event)
  More...
 
virtual void OnCloseEvent (QCloseEvent @event)
  More...
 
new void Create ()
  More...
 
new void Create (NativeULong window, bool initializeWindow=true, bool destroyOldWindow=true)
  More...
 
new void OnCustomContextMenuRequested (QPoint pos)
  More...
 
new void Destroy (bool destroyWindow=true, bool destroySubWindows=true)
  More...
 
virtual void EnabledChange (bool arg1)
 
virtual void OnEnterEvent (QEvent @event)
  More...
 
new bool FocusNextChild ()
  More...
 
new bool FocusPreviousChild ()
  More...
 
virtual void FontChange (QFont arg1)
 
virtual void OnHideEvent (QHideEvent @event)
  More...
 
virtual void LanguageChange ()
  More...
 
virtual void OnLeaveEvent (QEvent @event)
  More...
 
virtual int Metric (QPaintDevice.PaintDeviceMetric m)
  More...
 
virtual void OnMoveEvent (QMoveEvent @event)
  More...
 
virtual void PaletteChange (QPalette arg1)
 
new void ResetInputContext ()
  More...
 
virtual void StyleChange (QStyle arg1)
 
virtual void OnTabletEvent (QTabletEvent @event)
  More...
 
new void UpdateMicroFocus ()
  More...
 
virtual void WindowActivationChange (bool arg1)
 
- Protected Member Functions inherited from QtCore.QObject
 QObject (System.Type dummy)
 
virtual void OnChildEvent (QChildEvent @event)
  More...
 
virtual void ConnectNotify (string signal)
  More...
 
virtual void OnCustomEvent (QEvent @event)
  More...
 
new void OnDestroyed (QObject obj=null)
  More...
 
virtual void DisconnectNotify (string signal)
  More...
 
new int Receivers (string signal)
  More...
 
virtual void OnTimerEvent (QTimerEvent @event)
  More...
 

Properties

QGraphicsScene Scene [get, set]
  More...
 
QMatrix Matrix [get]
  More...
 
QTransform Transform [get]
  More...
 
override QSize SizeHint [get]
  More...
 
bool IsTransformed [get]
  More...
 
QTransform ViewportTransform [get]
  More...
 
new QBrush BackgroundBrush [get, set]
  More...
 
new QBrush ForegroundBrush [get, set]
  More...
 
new bool Interactive [get, set]
  More...
 
new QRectF SceneRect [get, set]
  More...
 
new Qt.AlignmentFlag Alignment [get, set]
  More...
 
new QPainter.RenderHint RenderHints [get, set]
  More...
 
new DragMode dragMode [get, set]
  More...
 
new QGraphicsView.CacheModeFlag CacheMode [get, set]
  More...
 
new ViewportAnchor TransformationAnchor [get, set]
  More...
 
new ViewportAnchor ResizeAnchor [get, set]
  More...
 
new ViewportUpdateMode viewportUpdateMode [get, set]
  More...
 
new Qt.ItemSelectionMode RubberBandSelectionMode [get, set]
  More...
 
new QGraphicsView.OptimizationFlag OptimizationFlags [get, set]
  More...
 
static new QMetaObject StaticMetaObject [get]
 
new IQGraphicsViewSignals Emit [get]
 
- Properties inherited from QtGui.QAbstractScrollArea
virtual EventHandler
< QEventArgs< QEvent > > 
ViewportEvent
  More...
 
QWidget CornerWidget [get, set]
  More...
 
QScrollBar HorizontalScrollBar [get, set]
  More...
 
QScrollBar VerticalScrollBar [get, set]
  More...
 
QWidget Viewport [get, set]
  More...
 
override QSize MinimumSizeHint [get]
  More...
 
override QSize SizeHint [get]
  More...
 
QSize MaximumViewportSize [get]
  More...
 
override EventHandler
< QEventArgs< QActionEvent > > 
ActionEvent
  More...
 
override EventHandler
< QEventArgs< QEvent > > 
ChangeEvent
  More...
 
override EventHandler
< QEventArgs< QCloseEvent > > 
CloseEvent
  More...
 
override EventHandler
< QEventArgs
< QContextMenuEvent > > 
ContextMenuEvent
  More...
 
override EventHandler
< QEventArgs< QDragEnterEvent > > 
DragEnterEvent
  More...
 
override EventHandler
< QEventArgs< QDragLeaveEvent > > 
DragLeaveEvent
  More...
 
override EventHandler
< QEventArgs< QDragMoveEvent > > 
DragMoveEvent
  More...
 
override EventHandler
< QEventArgs< QDropEvent > > 
DropEvent
  More...
 
override EventHandler
< QEventArgs< QEvent > > 
EnterEvent
  More...
 
override EventHandler
< QEventArgs< QFocusEvent > > 
FocusInEvent
  More...
 
override EventHandler
< QEventArgs< QFocusEvent > > 
FocusOutEvent
  More...
 
override EventHandler
< QEventArgs< QHideEvent > > 
HideEvent
  More...
 
override EventHandler
< QEventArgs
< QInputMethodEvent > > 
InputMethodEvent
  More...
 
override EventHandler
< QEventArgs< QKeyEvent > > 
KeyPressEvent
  More...
 
override EventHandler
< QEventArgs< QKeyEvent > > 
KeyReleaseEvent
  More...
 
override EventHandler
< QEventArgs< QEvent > > 
LeaveEvent
  More...
 
override EventHandler
< QEventArgs< QMouseEvent > > 
MouseDoubleClickEvent
  More...
 
override EventHandler
< QEventArgs< QMouseEvent > > 
MouseMoveEvent
  More...
 
override EventHandler
< QEventArgs< QMouseEvent > > 
MousePressEvent
  More...
 
override EventHandler
< QEventArgs< QMouseEvent > > 
MouseReleaseEvent
  More...
 
override EventHandler
< QEventArgs< QMoveEvent > > 
MoveEvent
  More...
 
override EventHandler
< QEventArgs< QPaintEvent > > 
PaintEvent
  More...
 
override EventHandler
< QEventArgs< QResizeEvent > > 
ResizeEvent
  More...
 
override EventHandler
< QEventArgs< QShowEvent > > 
ShowEvent
  More...
 
override EventHandler
< QEventArgs< QTabletEvent > > 
TabletEvent
  More...
 
override EventHandler
< QEventArgs< QWheelEvent > > 
WheelEvent
  More...
 
new Qt.ScrollBarPolicy VerticalScrollBarPolicy [get, set]
  More...
 
new Qt.ScrollBarPolicy HorizontalScrollBarPolicy [get, set]
  More...
 
static new QMetaObject StaticMetaObject [get]
 
new IQAbstractScrollAreaSignals Emit [get]
 
- Properties inherited from QtGui.QFrame
int FrameStyle [get, set]
  More...
 
override QSize SizeHint [get]
  More...
 
new Shape FrameShape [get, set]
  More...
 
new Shadow FrameShadow [get, set]
  More...
 
new int LineWidth [get, set]
  More...
 
new int MidLineWidth [get, set]
  More...
 
new int FrameWidth [get]
  More...
 
new QRect FrameRect [get, set]
  More...
 
static new QMetaObject StaticMetaObject [get]
 
new IQFrameSignals Emit [get]
 
- Properties inherited from QtGui.QWidget
virtual EventHandler
< QEventArgs< QActionEvent > > 
ActionEvent
  More...
 
virtual EventHandler
< QEventArgs< QEvent > > 
ChangeEvent
  More...
 
virtual EventHandler
< QEventArgs< QCloseEvent > > 
CloseEvent
  More...
 
virtual EventHandler
< QEventArgs
< QContextMenuEvent > > 
ContextMenuEvent
  More...
 
virtual EventHandler
< QEventArgs< QDragEnterEvent > > 
DragEnterEvent
  More...
 
virtual EventHandler
< QEventArgs< QDragLeaveEvent > > 
DragLeaveEvent
  More...
 
virtual EventHandler
< QEventArgs< QDragMoveEvent > > 
DragMoveEvent
  More...
 
virtual EventHandler
< QEventArgs< QDropEvent > > 
DropEvent
  More...
 
virtual EventHandler
< QEventArgs< QEvent > > 
EnterEvent
  More...
 
virtual EventHandler
< QEventArgs< QFocusEvent > > 
FocusInEvent
  More...
 
virtual EventHandler
< QEventArgs< QFocusEvent > > 
FocusOutEvent
  More...
 
virtual EventHandler
< QEventArgs< QHideEvent > > 
HideEvent
  More...
 
virtual EventHandler
< QEventArgs
< QInputMethodEvent > > 
InputMethodEvent
  More...
 
virtual EventHandler
< QEventArgs< QKeyEvent > > 
KeyPressEvent
  More...
 
virtual EventHandler
< QEventArgs< QKeyEvent > > 
KeyReleaseEvent
  More...
 
virtual EventHandler
< QEventArgs< QEvent > > 
LeaveEvent
  More...
 
virtual EventHandler
< QEventArgs< QMouseEvent > > 
MouseDoubleClickEvent
  More...
 
virtual EventHandler
< QEventArgs< QMouseEvent > > 
MouseMoveEvent
  More...
 
virtual EventHandler
< QEventArgs< QMouseEvent > > 
MousePressEvent
  More...
 
virtual EventHandler
< QEventArgs< QMouseEvent > > 
MouseReleaseEvent
  More...
 
virtual EventHandler
< QEventArgs< QMoveEvent > > 
MoveEvent
  More...
 
virtual EventHandler
< QEventArgs< QPaintEvent > > 
PaintEvent
  More...
 
virtual EventHandler
< QEventArgs< QResizeEvent > > 
ResizeEvent
  More...
 
virtual EventHandler
< QEventArgs< QShowEvent > > 
ShowEvent
  More...
 
virtual EventHandler
< QEventArgs< QTabletEvent > > 
TabletEvent
  More...
 
virtual EventHandler
< QEventArgs< QWheelEvent > > 
WheelEvent
  More...
 
Slot< QPointCustomContextMenuRequested
  More...
 
QPalette.ColorRole BackgroundRole [get, set]
  More...
 
QMargins ContentsMargins [get, set]
  More...
 
QWidget FocusProxy [get, set]
  More...
 
QPalette.ColorRole ForegroundRole [get, set]
  More...
 
QGraphicsEffect GraphicsEffect [get, set]
  More...
 
QInputContext InputContext [get, set]
  More...
 
QLayout Layout [get, set]
  More...
 
QRegion Mask [get, set]
  More...
 
QStyle Style [get, set]
  More...
 
Qt.WindowType WindowFlags [get, set]
 
string WindowRole [get, set]
  More...
 
Qt.WindowState WindowState [get, set]
  More...
 
virtual int DevType [get]
 
virtual QPaintEngine PaintEngine [get]
  More...
 
int ColorCount [get]
  More...
 
int Depth [get]
  More...
 
int HeightMM [get]
  More...
 
int LogicalDpiX [get]
  More...
 
int LogicalDpiY [get]
  More...
 
int NumColors [get]
  More...
 
bool PaintingActive [get]
  More...
 
int PhysicalDpiX [get]
  More...
 
int PhysicalDpiY [get]
  More...
 
int WidthMM [get]
  More...
 
System.Collections.Generic.List
< QAction
Actions [get]
  More...
 
QRect ContentsRect [get]
  More...
 
NativeULong EffectiveWinId [get]
  More...
 
QFontInfo FontInfo [get]
  More...
 
QFontMetrics FontMetrics [get]
  More...
 
QGraphicsProxyWidget GraphicsProxyWidget [get]
  More...
 
NativeULong InternalWinId [get]
 
bool IsEnabledToTLW [get]
  More...
 
bool IsHidden [get]
  More...
 
bool IsLeftToRight [get]
 
bool IsRightToLeft [get]
 
bool IsTopLevel [get]
  More...
 
bool IsWindow [get]
  More...
 
static QWidget KeyboardGrabber [get]
  More...
 
static QWidget MouseGrabber [get]
  More...
 
QWidget NativeParentWidget [get]
  More...
 
QWidget NextInFocusChain [get]
  More...
 
QWidget ParentWidget [get]
  More...
 
QWidget PreviousInFocusChain [get]
  More...
 
QWidget TopLevelWidget [get]
  More...
 
bool UnderMouse [get]
  More...
 
QRegion VisibleRegion [get]
  More...
 
NativeULong WinId [get]
  More...
 
QWidget Window [get]
  More...
 
Qt.WindowType WindowType [get]
  More...
 
new bool Modal [get]
  More...
 
new Qt.WindowModality WindowModality [get, set]
  More...
 
new bool Enabled [get, set]
  More...
 
new QRect Geometry [get, set]
  More...
 
new QRect FrameGeometry [get]
  More...
 
new QRect NormalGeometry [get]
  More...
 
new int X [get]
  More...
 
new int Y [get]
  More...
 
new QPoint Pos [get, set]
  More...
 
new QSize FrameSize [get]
  More...
 
new QSize Size [get, set]
  More...
 
new int Width [get]
  More...
 
new int Height [get]
  More...
 
new QRect Rect [get]
  More...
 
new QRect ChildrenRect [get]
  More...
 
new QRegion ChildrenRegion [get]
  More...
 
new QSizePolicy SizePolicy [get, set]
  More...
 
new QSize MinimumSize [get, set]
  More...
 
new QSize MaximumSize [get, set]
  More...
 
new int MinimumWidth [get, set]
  More...
 
new int MinimumHeight [get, set]
  More...
 
new int MaximumWidth [get, set]
  More...
 
new int MaximumHeight [get, set]
  More...
 
new QSize SizeIncrement [get, set]
  More...
 
new QSize BaseSize [get, set]
  More...
 
new QPalette Palette [get, set]
  More...
 
new QFont Font [get, set]
  More...
 
new QCursor Cursor [get, set]
  More...
 
new bool MouseTracking [get, set]
  More...
 
new bool IsActiveWindow [get]
  More...
 
new Qt.FocusPolicy FocusPolicy [get, set]
  More...
 
new bool Focus [get]
  More...
 
new Qt.ContextMenuPolicy ContextMenuPolicy [get, set]
  More...
 
new bool UpdatesEnabled [get, set]
  More...
 
virtual new bool Visible [get, set]
  More...
 
new bool Minimized [get]
  More...
 
new bool Maximized [get]
  More...
 
new bool FullScreen [get]
  More...
 
virtual new QSize SizeHint [get]
  More...
 
virtual new QSize MinimumSizeHint [get]
  More...
 
new bool AcceptDrops [get, set]
  More...
 
new string WindowTitle [get, set]
  More...
 
new QIcon WindowIcon [get, set]
  More...
 
new string WindowIconText [get, set]
  More...
 
new double WindowOpacity [get, set]
  More...
 
new bool WindowModified [get, set]
  More...
 
new string ToolTip [get, set]
  More...
 
new string StatusTip [get, set]
  More...
 
new string WhatsThis [get, set]
  More...
 
new string AccessibleName [get, set]
  More...
 
new string AccessibleDescription [get, set]
  More...
 
new Qt.LayoutDirection LayoutDirection [get, set]
  More...
 
new bool AutoFillBackground [get, set]
  More...
 
new string StyleSheet [get, set]
  More...
 
new QLocale Locale [get, set]
  More...
 
new string WindowFilePath [get, set]
  More...
 
new Qt.InputMethodHint InputMethodHints [get, set]
  More...
 
static new QMetaObject StaticMetaObject [get]
 
new ushort Painters [get, set]
 
new IQWidgetSignals Emit [get]
 
- Properties inherited from QtCore.QObject
virtual EventHandler
< QEventArgs< QChildEvent > > 
ChildEvent
  More...
 
virtual EventHandler
< QEventArgs< QEvent > > 
CustomEvent
  More...
 
virtual EventHandler
< QEventArgs< QEvent > > 
Event
  More...
 
virtual EventHandler
< QEventArgs< QTimerEvent > > 
TimerEvent
  More...
 
Slot< QObjectDestroyedObj
  More...
 
Slot Destroyed
  More...
 
QObject Parent [get, set]
  More...
 
System.Collections.Generic.List
< QObject
Children [get]
  More...
 
System.Collections.Generic.List
< QByteArray
DynamicPropertyNames [get]
  More...
 
bool IsWidgetType [get]
  More...
 
static uint RegisterUserData [get]
 
QObject Sender [get]
  More...
 
int SenderSignalIndex [get]
  More...
 
bool SignalsBlocked [get]
  More...
 
virtual System.IntPtr SmokeObject [get, set]
 
new string ObjectName [get, set]
  More...
 
static new QMetaObject StaticMetaObject [get]
  More...
 
static new QMetaObject StaticQtMetaObject [get]
 
new IQObjectSignals Emit [get]
 
- Properties inherited from QtCore.Qt
static string QAppName [get]
 
static double QInf [get]
 
static double QQNaN [get]
 
static double QSNaN [get]
 
static bool QSharedBuild [get]
 
static string QVersion [get]
  More...
 
static int Qrand [get]
  More...
 
- Properties inherited from QtGui.IQPaintDevice
System.Int32 ColorCount [get]
  More...
 
System.Int32 Depth [get]
  More...
 
System.Int32 DevType [get]
 
System.Int32 Height [get]
  More...
 
System.Int32 HeightMM [get]
  More...
 
System.Int32 LogicalDpiX [get]
  More...
 
System.Int32 LogicalDpiY [get]
  More...
 
System.Int32 NumColors [get]
  More...
 
QPaintEngine PaintEngine [get]
  More...
 
System.Boolean PaintingActive [get]
  More...
 
System.Int32 PhysicalDpiX [get]
  More...
 
System.Int32 PhysicalDpiY [get]
  More...
 
System.Int32 Width [get]
  More...
 
System.Int32 WidthMM [get]
  More...
 

Additional Inherited Members

- Static Public Attributes inherited from QtCore.Qt
</para > *< para > Creating QM
files suitable for use with
this[SmokeMethod("qtTrId(const
char*, int)")] static strin 
QtTrId )(string id, int n=-1)
 
- Protected Attributes inherited from QtCore.QObject
object Q_EMIT = null
 
SmokeInvocation interceptor
 
readonly List< QEventHandler > eventFilters = new List<QEventHandler>()
 

Detailed Description

The QGraphicsView class provides a widget for displaying the contents of a QGraphicsScene.

QGraphicsView visualizes the contents of a QGraphicsScene in a scrollable viewport. To create a scene with geometrical items, see QGraphicsScene's documentation. QGraphicsView is part of the Graphics View Framework.

To visualize a scene, you start by constructing a QGraphicsView object, passing the address of the scene you want to visualize to QGraphicsView's constructor. Alternatively, you can call setScene() to set the scene at a later point. After you call show(), the view will by default scroll to the center of the scene and display any items that are visible at this point. For example:

QGraphicsScene scene;

scene.addText("Hello, world!");

QGraphicsView view(&scene);

view.show();

You can explicitly scroll to any position on the scene by using the scroll bars, or by calling centerOn(). By passing a point to centerOn(), QGraphicsView will scroll its viewport to ensure that the point is centered in the view. An overload is provided for scrolling to a QGraphicsItem, in which case QGraphicsView will see to that the center of the item is centered in the view. If all you want is to ensure that a certain area is visible, (but not necessarily centered,) you can call ensureVisible() instead.

QGraphicsView can be used to visualize a whole scene, or only parts of it. The visualized area is by default detected automatically when the view is displayed for the first time (by calling QGraphicsScene::itemsBoundingRect()). To set the visualized area rectangle yourself, you can call setSceneRect(). This will adjust the scroll bars' ranges appropriately. Note that although the scene supports a virtually unlimited size, the range of the scroll bars will never exceed the range of an integer (INT_MIN, INT_MAX).

QGraphicsView visualizes the scene by calling render(). By default, the items are drawn onto the viewport by using a regular QPainter, and using default render hints. To change the default render hints that QGraphicsView passes to QPainter when painting items, you can call setRenderHints().

By default, QGraphicsView provides a regular QWidget for the viewport widget. You can access this widget by calling viewport(), or you can replace it by calling setViewport(). To render using OpenGL, simply call setViewport(new QGLWidget). QGraphicsView takes ownership of the viewport widget.

QGraphicsView supports affine transformations, using QTransform. You can either pass a matrix to setTransform(), or you can call one of the convenience functions rotate(), scale(), translate() or shear(). The most two common transformations are scaling, which is used to implement zooming, and rotation. QGraphicsView keeps the center of the view fixed during a transformation. Because of the scene alignment (setAligment()), translating the view will have no visual impact.

You can interact with the items on the scene by using the mouse and keyboard. QGraphicsView translates the mouse and key events into scene events, (events that inherit QGraphicsSceneEvent,), and forward them to the visualized scene. In the end, it's the individual item that handles the events and reacts to them. For example, if you click on a selectable item, the item will typically let the scene know that it has been selected, and it will also redraw itself to display a selection rectangle. Similiary, if you click and drag the mouse to move a movable item, it's the item that handles the mouse moves and moves itself. Item interaction is enabled by default, and you can toggle it by calling setInteractive().

You can also provide your own custom scene interaction, by creating a subclass of QGraphicsView, and reimplementing the mouse and key event handlers. To simplify how you programmatically interact with items in the view, QGraphicsView provides the mapping functions mapToScene() and mapFromScene(), and the item accessors items() and itemAt(). These functions allow you to map points, rectangles, polygons and paths between view coordinates and scene coordinates, and to find items on the scene using view coordinates.

See also QGraphicsScene, QGraphicsItem, and QGraphicsSceneEvent.

Member Enumeration Documentation

This enum describes the flags that you can set for a QGraphicsView's cache mode.

See also cacheMode.

Enumerator
CacheBackground 

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.

CacheNone 

All painting is done directly onto the viewport.

This enum describes the default action for the view when pressing and dragging the mouse over the viewport.

See also dragMode and QGraphicsScene::setSelectionArea().

Enumerator
NoDrag 

Nothing happens; the mouse event is ignored.

RubberBandDrag 

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.

ScrollHandDrag 

The cursor changes into a pointing hand, and dragging the mouse around will scroll the scrolbars. This mode works both in interactive and non-interactive mode.

This enum describes flags that you can enable to improve rendering performance in QGraphicsView. By default, none of these flags are set. Note that setting a flag usually imposes a side effect, and this effect can vary between paint devices and platforms.

This enum was introduced or modified in Qt 4.3.

Enumerator
DontAdjustForAntialiasing 

Disables QGraphicsView's antialiasing auto-adjustment of exposed areas. Items that render antialiased lines on the boundaries of their QGraphicsItem::boundingRect() can end up rendering parts of the line outside. To prevent rendering artifacts, QGraphicsView expands all exposed regions by 2 pixels in all directions. If you enable this flag, QGraphicsView will no longer perform these adjustments, minimizing the areas that require redrawing, which improves performance. A common side effect is that items that do draw with antialiasing can leave painting traces behind on the scene as they are moved.

DontClipPainter 

This value is obsolete and has no effect.

DontSavePainterState 

When rendering, QGraphicsView protects the painter state (see QPainter::save()) when rendering the background or foreground, and when rendering each item. This allows you to leave the painter in an altered state (i.e., you can call QPainter::setPen() or QPainter::setBrush() without restoring the state after painting). However, if the items consistently do restore the state, you should enable this flag to prevent QGraphicsView from doing the same.

IndirectPainting 

Since Qt 4.6, restore the old painting algorithm that calls QGraphicsView::drawItems() and QGraphicsScene::drawItems(). To be used only for compatibility with old code.

This enums describe the possible anchors that QGraphicsView can use when the user resizes the view or when the view is transformed.

See also resizeAnchor and transformationAnchor.

Enumerator
AnchorUnderMouse 

The point under the mouse is used as the anchor.

AnchorViewCenter 

The scene point at the center of the view is used as the anchor.

NoAnchor 

No anchor, i.e. the view leaves the scene's position unchanged.

This enum describes how QGraphicsView updates its viewport when the scene contents change or are exposed.

This enum was introduced or modified in Qt 4.3.

See also viewportUpdateMode.

Enumerator
BoundingRectViewportUpdate 

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.

FullViewportUpdate 

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.

MinimalViewportUpdate 

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.

NoViewportUpdate 

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.

SmartViewportUpdate 

QGraphicsView will attempt to find an optimal update mode by analyzing the areas that require a redraw.

Constructor & Destructor Documentation

QtGui.QGraphicsView.QGraphicsView ( System.Type  dummy)
protected
QtGui.QGraphicsView.QGraphicsView ( QWidget  parent = null)

Constructs a QGraphicsView. parent is passed to QWidget's constructor.

Here is the call graph for this function:

QtGui.QGraphicsView.QGraphicsView ( QGraphicsScene  scene,
QWidget  parent = null 
)

Constructs a QGraphicsView and sets the visualized scene to scene. parent is passed to QWidget's constructor.

Here is the call graph for this function:

Member Function Documentation

new void QtGui.QGraphicsView.CenterOn ( QPointF  pos)

Scrolls the contents of the viewport to ensure that 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.

Note: If the item is close to or outside the border, it will be visible in the view, but not centered.

See also ensureVisible().

new void QtGui.QGraphicsView.CenterOn ( IQGraphicsItem  item)

This is an overloaded function.

Scrolls the contents of the viewport to ensure that item is centered in the view.

See also ensureVisible().

new void QtGui.QGraphicsView.CenterOn ( double  x,
double  y 
)

This is an overloaded function.

This function is provided for convenience. It's equivalent to calling centerOn(QPointF(x, y)).

override void QtGui.QGraphicsView.CreateProxy ( )
virtual

Reimplemented from QtGui.QAbstractScrollArea.

Here is the caller graph for this function:

new void QtGui.QGraphicsView.Dispose ( )
virtual void QtGui.QGraphicsView.DrawBackground ( QPainter  painter,
QRectF  rect 
)
protectedvirtual

Draws the background of the scene using painter, before any items and the foreground are drawn. Reimplement this function to provide a custom background for this view.

If all you want is to define a color, texture or gradient for the background, you can call setBackgroundBrush() instead.

All painting is done in scene coordinates. rect is the exposed rectangle.

The default implementation fills rect using the view's backgroundBrush. If no such brush is defined (the default), the scene's drawBackground() function is called instead.

See also drawForeground() and QGraphicsScene::drawBackground().

virtual void QtGui.QGraphicsView.DrawForeground ( QPainter  painter,
QRectF  rect 
)
protectedvirtual

Draws the foreground of the scene using painter, after the background and all items are drawn. Reimplement this function to provide a custom foreground for this view.

If all you want is to define a color, texture or gradient for the foreground, you can call setForegroundBrush() instead.

All painting is done in scene coordinates. rect is the exposed rectangle.

The default implementation fills rect using the view's foregroundBrush. If no such brush is defined (the default), the scene's drawForeground() function is called instead.

See also drawBackground() and QGraphicsScene::drawForeground().

virtual void QtGui.QGraphicsView.DrawItems ( QPainter  painter,
int  numItems,
IQGraphicsItem  items,
QStyleOptionGraphicsItem  options 
)
protectedvirtual

Draws the items items in the scene using painter, after the background and before the foreground are drawn. numItems is the number of items in items and options in options. options is a list of styleoptions; one for each item. Reimplement this function to provide custom item drawing for this view.

The default implementation calls the scene's drawItems() function.

Since Qt 4.6, this function is not called anymore unless the QGraphicsView::IndirectPainting flag is given as an Optimization flag.

See also drawForeground(), drawBackground(), and QGraphicsScene::drawItems().

new void QtGui.QGraphicsView.EnsureVisible ( QRectF  rect,
int  xmargin = 50,
int  ymargin = 50 
)

Scrolls the contents of the viewport so that the scene rectangle rect is visible, with margins specified in pixels by xmargin and ymargin. If the specified rect cannot be reached, the contents are scrolled to the nearest valid position. The default value for both margins is 50 pixels.

See also centerOn().

new void QtGui.QGraphicsView.EnsureVisible ( IQGraphicsItem  item,
int  xmargin = 50,
int  ymargin = 50 
)

This is an overloaded function.

Scrolls the contents of the viewport so that the center of item item is visible, with margins specified in pixels by xmargin and ymargin. If the specified point cannot be reached, the contents are scrolled to the nearest valid position. The default value for both margins is 50 pixels.

See also centerOn().

new void QtGui.QGraphicsView.EnsureVisible ( double  x,
double  y,
double  w,
double  h,
int  xmargin = 50,
int  ymargin = 50 
)

This is an overloaded function.

This function is provided for convenience. It's equivalent to calling ensureVisible(QRectF(x, y, w, h), xmargin, ymargin).

new void QtGui.QGraphicsView.FitInView ( QRectF  rect,
Qt.AspectRatioMode  aspectRadioMode = Qt.AspectRatioMode.IgnoreAspectRatio 
)

Scales the view matrix and scrolls the scroll bars to ensure that the scene rectangle rect fits inside the viewport. rect must be inside the scene rect; otherwise, fitInView() cannot guarantee that the whole rect is visible.

This function keeps the view's rotation, translation, or shear. The view is scaled according to aspectRatioMode. rect will be centered in the view if it does not fit tightly.

It's common to call fitInView() from inside a reimplementation of resizeEvent(), to ensure that the whole scene, or parts of the scene, scales automatically to fit the new size of the viewport as the view is resized. Note though, that calling fitInView() from inside resizeEvent() can lead to unwanted resize recursion, if the new transformation toggles the automatic state of the scrollbars. You can toggle the scrollbar policies to always on or always off to prevent this (see horizontalScrollBarPolicy() and verticalScrollBarPolicy()).

If rect is empty, or if the viewport is too small, this function will do nothing.

See also setTransform(), ensureVisible(), and centerOn().

new void QtGui.QGraphicsView.FitInView ( IQGraphicsItem  item,
Qt.AspectRatioMode  aspectRadioMode = Qt.AspectRatioMode.IgnoreAspectRatio 
)

This is an overloaded function.

Ensures that item fits tightly inside the view, scaling the view according to aspectRatioMode.

See also ensureVisible() and centerOn().

new void QtGui.QGraphicsView.FitInView ( double  x,
double  y,
double  w,
double  h,
Qt.AspectRatioMode  aspectRadioMode = Qt.AspectRatioMode.IgnoreAspectRatio 
)

This is an overloaded function.

This convenience function is equivalent to calling fitInView(QRectF(x, y, w, h), aspectRatioMode).

See also ensureVisible() and centerOn().

override bool QtGui.QGraphicsView.FocusNextPrevChild ( bool  next)
protectedvirtual

Reimplemented from QWidget::focusNextPrevChild().

Reimplemented from QtGui.QWidget.

override object QtGui.QGraphicsView.InputMethodQuery ( Qt.InputMethodQuery  query)
virtual

Reimplemented from QWidget::inputMethodQuery().

Reimplemented from QtGui.QWidget.

new void QtGui.QGraphicsView.InvalidateScene ( )

Invalidates and schedules a redraw of layers inside rect. rect is in scene coordinates. Any cached content for layers inside rect is unconditionally invalidated and redrawn.

You can call this function to notify QGraphicsView of changes to the background or the foreground of the scene. It is commonly used for scenes with tile-based backgrounds to notify changes when QGraphicsView has enabled background caching.

Note that QGraphicsView currently supports background caching only (see QGraphicsView::CacheBackground). This function is equivalent to calling update() if any layer but QGraphicsScene::BackgroundLayer is passed.

See also QGraphicsScene::invalidate() and update().

new void QtGui.QGraphicsView.InvalidateScene ( QRectF  rect,
QGraphicsScene.SceneLayer  layers = QGraphicsScene.SceneLayer.AllLayers 
)

Invalidates and schedules a redraw of layers inside rect. rect is in scene coordinates. Any cached content for layers inside rect is unconditionally invalidated and redrawn.

You can call this function to notify QGraphicsView of changes to the background or the foreground of the scene. It is commonly used for scenes with tile-based backgrounds to notify changes when QGraphicsView has enabled background caching.

Note that QGraphicsView currently supports background caching only (see QGraphicsView::CacheBackground). This function is equivalent to calling update() if any layer but QGraphicsScene::BackgroundLayer is passed.

See also QGraphicsScene::invalidate() and update().

new IQGraphicsItem QtGui.QGraphicsView.ItemAt ( QPoint  pos)

Returns the item at position pos, which is in viewport coordinates. If there are several items at this position, this function returns the topmost item.

Example:

void CustomView::mousePressEvent(QMouseEvent *event)

{

if (QGraphicsItem *item = itemAt(event->pos())) {

qDebug() << "You clicked on item" << item;

} else {

qDebug() << "You didn't click on an item.";

}

}

See also items() and Sorting.

new IQGraphicsItem QtGui.QGraphicsView.ItemAt ( int  x,
int  y 
)

This is an overloaded function.

This function is provided for convenience. It's equivalent to calling itemAt(QPoint(x, y)).

new System.Collections.Generic.List<IQGraphicsItem> QtGui.QGraphicsView.Items ( )

Returns a list of all the items in the associated scene, in descending stacking order (i.e., the first item in the returned list is the uppermost item).

See also QGraphicsScene::items() and Sorting.

new System.Collections.Generic.List<IQGraphicsItem> QtGui.QGraphicsView.Items ( QPoint  pos)

Returns a list of all the items at the position pos in the view. The items are listed in descending stacking order (i.e., the first item in the list is the uppermost item, and the last item is the lowermost item). pos is in viewport coordinates.

This function is most commonly called from within mouse event handlers in a subclass in QGraphicsView. pos is in untransformed viewport coordinates, just like QMouseEvent::pos().

void CustomView::mousePressEvent(QMouseEvent *event)

{

qDebug() << "There are" << items(event->pos()).size()

<< "items at position" << mapToScene(event->pos());

}

See also QGraphicsScene::items() and Sorting.

new System.Collections.Generic.List<IQGraphicsItem> QtGui.QGraphicsView.Items ( QRect  rect,
Qt.ItemSelectionMode  mode = Qt.ItemSelectionMode.IntersectsItemShape 
)

This is an overloaded function.

Returns a list of all the items that, depending on mode, are either contained by or intersect with rect. rect is in viewport coordinates.

The default value for mode is Qt::IntersectsItemShape; all items whose exact shape intersects with or is contained by rect are returned.

The items are sorted in descending stacking order (i.e., the first item in the returned list is the uppermost item).

See also itemAt(), items(), mapToScene(), and Sorting.

new System.Collections.Generic.List<IQGraphicsItem> QtGui.QGraphicsView.Items ( QPolygon  polygon,
Qt.ItemSelectionMode  mode = Qt.ItemSelectionMode.IntersectsItemShape 
)

This is an overloaded function.

Returns a list of all the items that, depending on mode, are either contained by or intersect with polygon. polygon is in viewport coordinates.

The default value for mode is Qt::IntersectsItemShape; all items whose exact shape intersects with or is contained by polygon are returned.

The items are sorted by descending stacking order (i.e., the first item in the returned list is the uppermost item).

See also itemAt(), items(), mapToScene(), and Sorting.

new System.Collections.Generic.List<IQGraphicsItem> QtGui.QGraphicsView.Items ( QPainterPath  path,
Qt.ItemSelectionMode  mode = Qt.ItemSelectionMode.IntersectsItemShape 
)

This is an overloaded function.

Returns a list of all the items that, depending on mode, are either contained by or intersect with path. path is in viewport coordinates.

The default value for mode is Qt::IntersectsItemShape; all items whose exact shape intersects with or is contained by path are returned.

See also itemAt(), items(), mapToScene(), and Sorting.

new System.Collections.Generic.List<IQGraphicsItem> QtGui.QGraphicsView.Items ( int  x,
int  y 
)

This function is provided for convenience. It's equivalent to calling items(QPoint(x, y)).

new System.Collections.Generic.List<IQGraphicsItem> QtGui.QGraphicsView.Items ( int  x,
int  y,
int  w,
int  h,
Qt.ItemSelectionMode  mode = Qt.ItemSelectionMode.IntersectsItemShape 
)

This convenience function is equivalent to calling items(QRectF(x, y, w, h), mode).

This function was introduced in Qt 4.3.

new QPoint QtGui.QGraphicsView.MapFromScene ( QPointF  point)

Returns the scene coordinate point to viewport coordinates.

See also mapToScene().

new QPolygon QtGui.QGraphicsView.MapFromScene ( QRectF  rect)

Returns the scene rectangle rect to a viewport coordinate polygon.

See also mapToScene().

new QPolygon QtGui.QGraphicsView.MapFromScene ( QPolygonF  polygon)

Returns the scene coordinate polygon polygon to a viewport coordinate polygon.

See also mapToScene().

new QPainterPath QtGui.QGraphicsView.MapFromScene ( QPainterPath  path)

Returns the scene coordinate painter path path to a viewport coordinate painter path.

See also mapToScene().

new QPoint QtGui.QGraphicsView.MapFromScene ( double  x,
double  y 
)

This function is provided for convenience. It's equivalent to calling mapFromScene(QPointF(x, y)).

new QPolygon QtGui.QGraphicsView.MapFromScene ( double  x,
double  y,
double  w,
double  h 
)

This function is provided for convenience. It's equivalent to calling mapFromScene(QRectF(x, y, w, h)).

new QPointF QtGui.QGraphicsView.MapToScene ( QPoint  point)

Returns the viewport coordinate point mapped to scene coordinates.

Note: It can be useful to map the whole rectangle covered by the pixel at point instead of the point itself. To do this, you can call mapToScene(QRect(point, QSize(2, 2))).

See also mapFromScene().

new QPolygonF QtGui.QGraphicsView.MapToScene ( QRect  rect)

Returns the viewport rectangle rect mapped to a scene coordinate polygon.

See also mapFromScene().

new QPolygonF QtGui.QGraphicsView.MapToScene ( QPolygon  polygon)

Returns the viewport polygon polygon mapped to a scene coordinate polygon.

See also mapFromScene().

new QPainterPath QtGui.QGraphicsView.MapToScene ( QPainterPath  path)

Returns the viewport painter path path mapped to a scene coordinate painter path.

See also mapFromScene().

new QPointF QtGui.QGraphicsView.MapToScene ( int  x,
int  y 
)

This function is provided for convenience. It's equivalent to calling mapToScene(QPoint(x, y)).

new QPolygonF QtGui.QGraphicsView.MapToScene ( int  x,
int  y,
int  w,
int  h 
)

This function is provided for convenience. It's equivalent to calling mapToScene(QRect(x, y, w, h)).

override void QtGui.QGraphicsView.OnContextMenuEvent ( QContextMenuEvent event)
protectedvirtual

Reimplemented from QWidget::contextMenuEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QGraphicsView.OnDragEnterEvent ( QDragEnterEvent event)
protectedvirtual

Reimplemented from QWidget::dragEnterEvent().

Reimplemented from QtGui.QAbstractScrollArea.

override void QtGui.QGraphicsView.OnDragLeaveEvent ( QDragLeaveEvent event)
protectedvirtual

Reimplemented from QWidget::dragLeaveEvent().

Reimplemented from QtGui.QAbstractScrollArea.

override void QtGui.QGraphicsView.OnDragMoveEvent ( QDragMoveEvent event)
protectedvirtual

Reimplemented from QWidget::dragMoveEvent().

Reimplemented from QtGui.QAbstractScrollArea.

override void QtGui.QGraphicsView.OnDropEvent ( QDropEvent event)
protectedvirtual

Reimplemented from QWidget::dropEvent().

Reimplemented from QtGui.QAbstractScrollArea.

override bool QtGui.QGraphicsView.OnEvent ( QEvent event)

Reimplemented from QObject::event().

override void QtGui.QGraphicsView.OnFocusInEvent ( QFocusEvent event)
protectedvirtual

Reimplemented from QWidget::focusInEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QGraphicsView.OnFocusOutEvent ( QFocusEvent event)
protectedvirtual

Reimplemented from QWidget::focusOutEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QGraphicsView.OnInputMethodEvent ( QInputMethodEvent event)
protectedvirtual

Reimplemented from QWidget::inputMethodEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QGraphicsView.OnKeyPressEvent ( QKeyEvent event)
protectedvirtual

Reimplemented from QWidget::keyPressEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QGraphicsView.OnKeyReleaseEvent ( QKeyEvent event)
protectedvirtual

Reimplemented from QWidget::keyReleaseEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QGraphicsView.OnMouseDoubleClickEvent ( QMouseEvent event)
protectedvirtual

Reimplemented from QWidget::mouseDoubleClickEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QGraphicsView.OnMouseMoveEvent ( QMouseEvent event)
protectedvirtual

Reimplemented from QWidget::mouseMoveEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QGraphicsView.OnMousePressEvent ( QMouseEvent event)
protectedvirtual

Reimplemented from QWidget::mousePressEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QGraphicsView.OnMouseReleaseEvent ( QMouseEvent event)
protectedvirtual

Reimplemented from QWidget::mouseReleaseEvent().

Reimplemented from QtGui.QWidget.

override void QtGui.QGraphicsView.OnPaintEvent ( QPaintEvent event)
protectedvirtual

Reimplemented from QWidget::paintEvent().

Reimplemented from QtGui.QAbstractScrollArea.

override void QtGui.QGraphicsView.OnResizeEvent ( QResizeEvent event)
protectedvirtual

Reimplemented from QWidget::resizeEvent().

Reimplemented from QtGui.QAbstractScrollArea.

override void QtGui.QGraphicsView.OnShowEvent ( QShowEvent event)
protectedvirtual

Reimplemented from QWidget::showEvent().

Reimplemented from QtGui.QWidget.

override bool QtGui.QGraphicsView.OnViewportEvent ( QEvent event)
protectedvirtual

Reimplemented from QAbstractScrollArea::viewportEvent().

Reimplemented from QtGui.QAbstractScrollArea.

override void QtGui.QGraphicsView.OnWheelEvent ( QWheelEvent event)
protectedvirtual

Reimplemented from QWidget::wheelEvent().

Reimplemented from QtGui.QWidget.

new void QtGui.QGraphicsView.Render ( QPainter  painter)

Renders the source rect, which is in view coordinates, from the scene into target, which is in paint device coordinates, using painter. This function is useful for capturing the contents of the view onto a paint device, such as a QImage (e.g., to take a screenshot), or for printing to QPrinter. For example:

QGraphicsScene scene;

scene.addItem(...

...

QGraphicsView view(&scene);

view.show();

...

QPrinter printer(QPrinter::HighResolution);

printer.setPageSize(QPrinter::A4);

QPainter painter(&printer);

// print, fitting the viewport contents into a full page

view.render(&painter);

// print the upper half of the viewport into the lower.

// half of the page.

QRect viewport = view.viewport()->rect();

view.render(&painter,

QRectF(0, printer.height() / 2,

printer.width(), printer.height() / 2),

viewport.adjusted(0, 0, 0, -viewport.height() / 2));

If source is a null rect, this function will use viewport()->rect() to determine what to draw. If target is a null rect, the full dimensions of painter's paint device (e.g., for a QPrinter, the page size) will be used.

The source rect contents will be transformed according to aspectRatioMode to fit into the target rect. By default, the aspect ratio is kept, and source is scaled to fit in target.

See also QGraphicsScene::render().

new void QtGui.QGraphicsView.Render ( QPainter  painter,
QRectF  target 
)

Renders the source rect, which is in view coordinates, from the scene into target, which is in paint device coordinates, using painter. This function is useful for capturing the contents of the view onto a paint device, such as a QImage (e.g., to take a screenshot), or for printing to QPrinter. For example:

QGraphicsScene scene;

scene.addItem(...

...

QGraphicsView view(&scene);

view.show();

...

QPrinter printer(QPrinter::HighResolution);

printer.setPageSize(QPrinter::A4);

QPainter painter(&printer);

// print, fitting the viewport contents into a full page

view.render(&painter);

// print the upper half of the viewport into the lower.

// half of the page.

QRect viewport = view.viewport()->rect();

view.render(&painter,

QRectF(0, printer.height() / 2,

printer.width(), printer.height() / 2),

viewport.adjusted(0, 0, 0, -viewport.height() / 2));

If source is a null rect, this function will use viewport()->rect() to determine what to draw. If target is a null rect, the full dimensions of painter's paint device (e.g., for a QPrinter, the page size) will be used.

The source rect contents will be transformed according to aspectRatioMode to fit into the target rect. By default, the aspect ratio is kept, and source is scaled to fit in target.

See also QGraphicsScene::render().

new void QtGui.QGraphicsView.Render ( QPainter  painter,
QRectF  target,
QRect  source,
Qt.AspectRatioMode  aspectRatioMode = Qt.AspectRatioMode.KeepAspectRatio 
)

Renders the source rect, which is in view coordinates, from the scene into target, which is in paint device coordinates, using painter. This function is useful for capturing the contents of the view onto a paint device, such as a QImage (e.g., to take a screenshot), or for printing to QPrinter. For example:

QGraphicsScene scene;

scene.addItem(...

...

QGraphicsView view(&scene);

view.show();

...

QPrinter printer(QPrinter::HighResolution);

printer.setPageSize(QPrinter::A4);

QPainter painter(&printer);

// print, fitting the viewport contents into a full page

view.render(&painter);

// print the upper half of the viewport into the lower.

// half of the page.

QRect viewport = view.viewport()->rect();

view.render(&painter,

QRectF(0, printer.height() / 2,

printer.width(), printer.height() / 2),

viewport.adjusted(0, 0, 0, -viewport.height() / 2));

If source is a null rect, this function will use viewport()->rect() to determine what to draw. If target is a null rect, the full dimensions of painter's paint device (e.g., for a QPrinter, the page size) will be used.

The source rect contents will be transformed according to aspectRatioMode to fit into the target rect. By default, the aspect ratio is kept, and source is scaled to fit in target.

See also QGraphicsScene::render().

new void QtGui.QGraphicsView.ResetCachedContent ( )

Resets any cached content. Calling this function will clear QGraphicsView's cache. If the current cache mode is CacheNone, this function does nothing.

This function is called automatically for you when the backgroundBrush or QGraphicsScene::backgroundBrush properties change; you only need to call this function if you have reimplemented QGraphicsScene::drawBackground() or QGraphicsView::drawBackground() to draw a custom background, and need to trigger a full redraw.

See also cacheMode().

new void QtGui.QGraphicsView.ResetMatrix ( )

Resets the view transformation matrix to the identity matrix.

See also resetTransform().

new void QtGui.QGraphicsView.ResetTransform ( )

Resets the view transformation to the identity matrix.

See also transform() and setTransform().

new void QtGui.QGraphicsView.Rotate ( double  angle)

Rotates the current view transformation angle degrees clockwise.

See also setTransform(), transform(), scale(), shear(), and translate().

new void QtGui.QGraphicsView.Scale ( double  sx,
double  sy 
)

Scales the current view transformation by (sx, sy).

See also setTransform(), transform(), rotate(), shear(), and translate().

override void QtGui.QGraphicsView.ScrollContentsBy ( int  dx,
int  dy 
)
protectedvirtual

Reimplemented from QAbstractScrollArea::scrollContentsBy().

Reimplemented from QtGui.QAbstractScrollArea.

new void QtGui.QGraphicsView.SetMatrix ( QMatrix  matrix,
bool  combine = false 
)

Sets the view's current transformation matrix to matrix.

If combine is true, then matrix is combined with the current matrix; otherwise, matrix replaces the current matrix. combine is false by default.

The transformation matrix tranforms the scene into view coordinates. Using the default transformation, provided by the identity matrix, one pixel in the view represents one unit in the scene (e.g., a 10x10 rectangular item is drawn using 10x10 pixels in the view). If a 2x2 scaling matrix is applied, the scene will be drawn in 1:2 (e.g., a 10x10 rectangular item is then drawn using 20x20 pixels in the view).

Example:

QGraphicsScene scene;

scene.addText("GraphicsView rotated clockwise");

QGraphicsView view(&scene);

view.rotate(90); // the text is rendered with a 90 degree clockwise rotation

view.show();

To simplify interation with items using a transformed view, QGraphicsView provides mapTo... and mapFrom... functions that can translate between scene and view coordinates. For example, you can call mapToScene() to map a view coordinate to a floating point scene coordinate, or mapFromScene() to map from floating point scene coordinates to view coordinates.

See also matrix(), setTransform(), rotate(), scale(), shear(), and translate().

new void QtGui.QGraphicsView.SetOptimizationFlag ( QGraphicsView.OptimizationFlag  flag,
bool  enabled = true 
)

Enables flag if enabled is true; otherwise disables flag.

See also optimizationFlags.

new void QtGui.QGraphicsView.SetRenderHint ( QPainter.RenderHint  hint,
bool  enabled = true 
)

If enabled is true, the render hint hint is enabled; otherwise it is disabled.

See also renderHints.

new void QtGui.QGraphicsView.SetSceneRect ( double  x,
double  y,
double  w,
double  h 
)
new void QtGui.QGraphicsView.SetTransform ( QTransform  matrix,
bool  combine = false 
)

Sets the view's current transformation matrix to matrix.

If combine is true, then matrix is combined with the current matrix; otherwise, matrix replaces the current matrix. combine is false by default.

The transformation matrix tranforms the scene into view coordinates. Using the default transformation, provided by the identity matrix, one pixel in the view represents one unit in the scene (e.g., a 10x10 rectangular item is drawn using 10x10 pixels in the view). If a 2x2 scaling matrix is applied, the scene will be drawn in 1:2 (e.g., a 10x10 rectangular item is then drawn using 20x20 pixels in the view).

Example:

QGraphicsScene scene;

scene.addText("GraphicsView rotated clockwise");

QGraphicsView view(&scene);

view.rotate(90); // the text is rendered with a 90 degree clockwise rotation

view.show();

To simplify interation with items using a transformed view, QGraphicsView provides mapTo... and mapFrom... functions that can translate between scene and view coordinates. For example, you can call mapToScene() to map a view coordiate to a floating point scene coordinate, or mapFromScene() to map from floating point scene coordinates to view coordinates.

See also transform(), rotate(), scale(), shear(), and translate().

new void QtGui.QGraphicsView.SetupViewport ( QWidget  widget)
protected

This slot is called by QAbstractScrollArea after setViewport() has been called. Reimplement this function in a subclass of QGraphicsView to initialize the new viewport widget before it is used.

See also setViewport().

new void QtGui.QGraphicsView.Shear ( double  sh,
double  sv 
)

Shears the current view transformation by (sh, sv).

See also setTransform(), transform(), rotate(), scale(), and translate().

static string QtGui.QGraphicsView.Tr ( string  s,
string  c = null 
)
static
static string QtGui.QGraphicsView.Tr ( string  s,
string  c,
int  n 
)
static
new void QtGui.QGraphicsView.Translate ( double  dx,
double  dy 
)

Translates the current view transformation by (dx, dy).

See also setTransform(), transform(), rotate(), and shear().

static string QtGui.QGraphicsView.TrUtf8 ( string  s,
string  c = null 
)
static
static string QtGui.QGraphicsView.TrUtf8 ( string  s,
string  c,
int  n 
)
static
new void QtGui.QGraphicsView.UpdateScene ( System.Collections.Generic.List< QRectF rects)

Schedules an update of the scene rectangles rects.

See also QGraphicsScene::changed().

new void QtGui.QGraphicsView.UpdateSceneRect ( QRectF  rect)

Notifies QGraphicsView that the scene's scene rect has changed. rect is the new scene rect. If the view already has an explicitly set scene rect, this function does nothing.

See also sceneRect and QGraphicsScene::sceneRectChanged().

Property Documentation

new Qt.AlignmentFlag QtGui.QGraphicsView.Alignment
getset

This property holds the alignment of the scene in the view when the whole scene is visible.

If the whole scene is visible in the view, (i.e., there are no visible scroll bars,) the view's alignment will decide where the scene will be rendered in the view. For example, if the alignment is Qt::AlignCenter, which is default, 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.

new QBrush QtGui.QGraphicsView.BackgroundBrush
getset

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, you can reimplement drawBackground() instead.

By default, this property contains a brush with the Qt::NoBrush pattern.

new QGraphicsView.CacheModeFlag QtGui.QGraphicsView.CacheMode
getset

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 that are slow to render. Texture, gradient and alpha blended backgrounds, for example, can be notibly slow to render; especially with a transformed view. The CacheBackground flag enables caching of the view's background. For example:

QGraphicsView view;

view.setBackgroundBrush(QImage(":/images/backgroundtile.png"));

view.setCacheMode(QGraphicsView::CacheBackground);

The cache is invalidated every time the view is transformed. However, when scrolling, only partial invalidation is required.

By default, nothing is cached.

new DragMode QtGui.QGraphicsView.dragMode
getset

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 (e.g., scrolling the viewport contents using a pointing hand cursor, or selecting multiple items with a rubber band). The default value, NoDrag, does nothing.

This behavior 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().

new IQGraphicsViewSignals QtGui.QGraphicsView.Emit
getprotected
new QBrush QtGui.QGraphicsView.ForegroundBrush
getset

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 scene's own foreground, and defines the behavior of drawForeground(). To provide custom foreground drawing for this view, you can reimplement drawForeground() instead.

By default, this property contains a brush with the Qt::NoBrush pattern.

new bool QtGui.QGraphicsView.Interactive
getset

This property holds whether the view allowed scene interaction.

If enabled, this view is set to allow scene interaction. Otherwise, this view will not allow interaction, and any mouse or key events are ignored (i.e., it will act as a read-only view).

By default, this property is true.

bool QtGui.QGraphicsView.IsTransformed
get

Returns true if the view is transformed (i.e., a non-identity transform has been assigned, or the scrollbars are adjusted).

This function was introduced in Qt 4.6.

See also setTransform(), horizontalScrollBar(), and verticalScrollBar().

QMatrix QtGui.QGraphicsView.Matrix
get

Returns the current transformation matrix for the view. If no current transformation is set, the identity matrix is returned.

See also setMatrix(), transform(), rotate(), scale(), shear(), and translate().

new QGraphicsView.OptimizationFlag QtGui.QGraphicsView.OptimizationFlags
getset

This property holds flags that can be used to tune QGraphicsView's performance.

QGraphicsView uses clipping, extra bounding rect adjustments, and certain other aids to improve rendering quality and performance for the common case graphics scene. However, depending on the target platform, the scene, and the viewport in use, some of these operations can degrade performance.

The effect varies from flag to flag; see the OptimizationFlags documentation for details.

By default, no optimization flags are enabled.

This property was introduced in Qt 4.3.

new QPainter.RenderHint QtGui.QGraphicsView.RenderHints
getset

This property holds the default render hints for the view.

These hints are used to initialize QPainter before each visible item is drawn. QPainter uses render hints to toggle rendering features such as antialiasing and smooth pixmap transformation.

QPainter::TextAntialiasing is enabled by default.

Example:

QGraphicsScene scene;

scene.addRect(QRectF(-10, -10, 20, 20));

QGraphicsView view(&scene);

view.setRenderHints(QPainter::Antialiasing | QPainter::SmoothPixmapTransform);

view.show();

new ViewportAnchor QtGui.QGraphicsView.ResizeAnchor
getset

This property holds how the view should position the scene when the view is resized.

QGraphicsView uses this property to decide how to position the scene in the viewport when the viewport widget's size changes. The default behavior, NoAnchor, leaves the scene's position unchanged during a resize; the top-left corner of the view will appear to be anchored while resizing.

Note that the effect of this property is noticeable when only a part of the scene is visible (i.e., when there are scroll bars). Otherwise, if the whole scene fits in the view, QGraphicsScene uses the view alignment to position the scene in the view.

new Qt.ItemSelectionMode QtGui.QGraphicsView.RubberBandSelectionMode
getset

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; all items whose shape intersects with or is contained by the rubber band are selected.

This property was introduced in Qt 4.3.

QGraphicsScene QtGui.QGraphicsView.Scene
getset

Returns a pointer to the scene that is currently visualized in the view. If no scene is currently visualized, 0 is returned.

Sets the current scene to scene. If scene is already being viewed, this function 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.

new QRectF QtGui.QGraphicsView.SceneRect
getset

This property holds the area of the scene visualized by this view.

The scene rectangle defines the extent of the scene, and in the view's case, this means the area of the scene that you can navigate using the scroll bars.

If unset, or if a null QRectF is set, this property has the same value as QGraphicsScene::sceneRect, and it changes with QGraphicsScene::sceneRect. Otherwise, the view's scene rect is unaffected by the scene.

Note that, although the scene supports a virtually unlimited size, the range of the scroll bars will never exceed the range of an integer (INT_MIN, INT_MAX). When the scene is larger than the scroll bars' values, you can choose to use translate() to navigate the scene instead.

By default, this property contains a rectangle at the origin with zero width and height.

Reimplemented from QWidget::sizeHint().

new QMetaObject QtGui.QGraphicsView.StaticMetaObject
staticget
QTransform QtGui.QGraphicsView.Transform
get

Returns the current transformation matrix for the view. If no current transformation is set, the identity matrix is returned.

See also setTransform(), rotate(), scale(), shear(), and translate().

new ViewportAnchor QtGui.QGraphicsView.TransformationAnchor
getset

This property holds how the view should position the scene during transformations.

QGraphicsView uses this property to decide how to position the scene in the viewport when the transformation matrix changes, and the coordinate system of the view is transformed. The default behavior, AnchorViewCenter, ensures that the scene point at the center of the view remains unchanged during transformations (e.g., when rotating, the scene will appear to rotate around the center of the view).

Note that the effect of this property is noticeable when only a part of the scene is visible (i.e., when there are scroll bars). Otherwise, if the whole scene fits in the view, QGraphicsScene uses the view alignment to position the scene in the view.

QTransform QtGui.QGraphicsView.ViewportTransform
get

Returns a matrix that maps viewport coordinates to scene coordinates.

See also mapToScene() and mapFromScene().

new ViewportUpdateMode QtGui.QGraphicsView.viewportUpdateMode
getset

This property holds how the viewport should update its contents.

QGraphicsView uses this property to decide how to update areas of the scene that have been reexposed or changed. Usually you do not need to modify this property, but there are some cases where doing so can improve rendering performance. See the ViewportUpdateMode documentation for specific details.

The default value is MinimalViewportUpdate, where QGraphicsView will update as small an area of the viewport as possible when the contents change.

This property was introduced in Qt 4.3.