Qt 4.8
Public Types | Signals | Public Functions | Protected Functions | Private Slots | Properties | List of all members
QDeclarativeView Class Reference

The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface. More...

#include <qdeclarativeview.h>

Inheritance diagram for QDeclarativeView:
QGraphicsView QAbstractScrollArea QFrame QWidget QObject QPaintDevice QmlApplicationViewer

Public Types

enum  ResizeMode { SizeViewToRootObject, SizeRootObjectToView }
 This enum specifies how to resize the view. More...
 
enum  Status { Null, Ready, Loading, Error }
 Specifies the loading status of the QDeclarativeView. More...
 
- Public Types inherited from QGraphicsView
enum  CacheModeFlag { CacheNone = 0x0, CacheBackground = 0x1 }
 This enum describes the flags that you can set for a QGraphicsView's cache mode. More...
 
enum  DragMode { NoDrag, ScrollHandDrag, RubberBandDrag }
 This enum describes the default action for the view when pressing and dragging the mouse over the viewport. More...
 
enum  OptimizationFlag { DontClipPainter = 0x1, DontSavePainterState = 0x2, DontAdjustForAntialiasing = 0x4, IndirectPainting = 0x8 }
 This enum describes flags that you can enable to improve rendering performance in QGraphicsView. More...
 
enum  ViewportAnchor { NoAnchor, AnchorViewCenter, AnchorUnderMouse }
 This enums describe the possible anchors that QGraphicsView can use when the user resizes the view or when the view is transformed. More...
 
enum  ViewportUpdateMode {
  FullViewportUpdate, MinimalViewportUpdate, SmartViewportUpdate, NoViewportUpdate,
  BoundingRectViewportUpdate
}
 This enum describes how QGraphicsView updates its viewport when the scene contents change or are exposed. More...
 
- Public Types inherited from QFrame
enum  Shadow { Plain = 0x0010, Raised = 0x0020, Sunken = 0x0030 }
 This enum type defines the types of shadow that are used to give a 3D effect to frames. More...
 
enum  Shape {
  NoFrame = 0, Box = 0x0001, Panel = 0x0002, WinPanel = 0x0003,
  HLine = 0x0004, VLine = 0x0005, StyledPanel = 0x0006
}
 This enum type defines the shapes of frame available. More...
 
enum  StyleMask { Shadow_Mask = 0x00f0, Shape_Mask = 0x000f }
 This enum defines two constants that can be used to extract the two components of frameStyle(): More...
 
- Public Types inherited from QWidget
enum  RenderFlag { DrawWindowBackground = 0x1, DrawChildren = 0x2, IgnoreMask = 0x4 }
 This enum describes how to render the widget when calling QWidget::render(). More...
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric {
  PdmWidth = 1, PdmHeight, PdmWidthMM, PdmHeightMM,
  PdmNumColors, PdmDepth, PdmDpiX, PdmDpiY,
  PdmPhysicalDpiX, PdmPhysicalDpiY
}
 

Signals

void sceneResized (QSize size)
 This signal is emitted when the view is resized to size. More...
 
void statusChanged (QDeclarativeView::Status)
 This signal is emitted when the component's current status changes. More...
 
- Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
 This signal is emitted when the widget's contextMenuPolicy is Qt::CustomContextMenu, and the user has requested a context menu on the widget. More...
 
- Signals inherited from QObject
void destroyed (QObject *=0)
 This signal is emitted immediately before the object obj is destroyed, and can not be blocked. More...
 

Public Functions

QDeclarativeEngineengine () const
 Returns a pointer to the QDeclarativeEngine used for instantiating QML Components. More...
 
QList< QDeclarativeErrorerrors () const
 Return the list of errors that occurred during the last compile or create operation. More...
 
QSize initialSize () const
 Returns the initial size of the root object. More...
 
 QDeclarativeView (QWidget *parent=0)
 Constructs a QDeclarativeView with the given parent. More...
 
 QDeclarativeView (const QUrl &source, QWidget *parent=0)
 Constructs a QDeclarativeView with the given QML source and parent. More...
 
ResizeMode resizeMode () const
 
QDeclarativeContextrootContext () const
 This function returns the root of the context hierarchy. More...
 
QGraphicsObjectrootObject () const
 Returns the view's root QGraphicsObject {item}. More...
 
void setResizeMode (ResizeMode)
 
void setSource (const QUrl &)
 Sets the source to the url, loads the QML component and instantiates it. More...
 
QSize sizeHint () const
 Preferred size follows the root object geometry. More...
 
QUrl source () const
 
Status status () const
 
virtual ~QDeclarativeView ()
 Destroys the view. More...
 
- Public Functions inherited from QGraphicsView
Qt::Alignment alignment () const
 
QBrush backgroundBrush () const
 
CacheMode cacheMode () const
 
void centerOn (const QPointF &pos)
 Scrolls the contents of the viewport to ensure that the scene coordinate pos, is centered in the view. More...
 
void centerOn (qreal x, qreal y)
 This function is provided for convenience. More...
 
void centerOn (const QGraphicsItem *item)
 Scrolls the contents of the viewport to ensure that item is centered in the view. More...
 
DragMode dragMode () const
 
void ensureVisible (const 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. More...
 
void ensureVisible (qreal x, qreal y, qreal w, qreal h, int xmargin=50, int ymargin=50)
 This function is provided for convenience. More...
 
void ensureVisible (const QGraphicsItem *item, int xmargin=50, int ymargin=50)
 Scrolls the contents of the viewport so that the center of item item is visible, with margins specified in pixels by xmargin and ymargin. More...
 
void fitInView (const QRectF &rect, Qt::AspectRatioMode aspectRadioMode=Qt::IgnoreAspectRatio)
 Scales the view matrix and scrolls the scroll bars to ensure that the scene rectangle rect fits inside the viewport. More...
 
void fitInView (qreal x, qreal y, qreal w, qreal h, Qt::AspectRatioMode aspectRadioMode=Qt::IgnoreAspectRatio)
 
void fitInView (const QGraphicsItem *item, Qt::AspectRatioMode aspectRadioMode=Qt::IgnoreAspectRatio)
 Ensures that item fits tightly inside the view, scaling the view according to aspectRatioMode. More...
 
QBrush foregroundBrush () const
 
QVariant inputMethodQuery (Qt::InputMethodQuery query) const
 Reimplemented Function More...
 
bool isInteractive () const
 
bool isTransformed () const
 Returns true if the view is transformed (i. More...
 
QGraphicsItemitemAt (const QPoint &pos) const
 Returns the item at position pos, which is in viewport coordinates. More...
 
QGraphicsItemitemAt (int x, int y) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This function is provided for convenience. More...
 
QList< QGraphicsItem * > items () const
 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). More...
 
QList< QGraphicsItem * > items (const QPoint &pos) const
 Returns a list of all the items at the position pos in the view. More...
 
QList< QGraphicsItem * > items (int x, int y) const
 This function is provided for convenience. More...
 
QList< QGraphicsItem * > items (const QRect &rect, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 Returns a list of all the items that, depending on mode, are either contained by or intersect with rect. More...
 
QList< QGraphicsItem * > items (int x, int y, int w, int h, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 
QList< QGraphicsItem * > items (const QPolygon &polygon, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 Returns a list of all the items that, depending on mode, are either contained by or intersect with polygon. More...
 
QList< QGraphicsItem * > items (const QPainterPath &path, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 Returns a list of all the items that, depending on mode, are either contained by or intersect with path. More...
 
QPoint mapFromScene (const QPointF &point) const
 Returns the scene coordinate point to viewport coordinates. More...
 
QPolygon mapFromScene (const QRectF &rect) const
 Returns the scene rectangle rect to a viewport coordinate polygon. More...
 
QPolygon mapFromScene (const QPolygonF &polygon) const
 Returns the scene coordinate polygon polygon to a viewport coordinate polygon. More...
 
QPainterPath mapFromScene (const QPainterPath &path) const
 Returns the scene coordinate painter path path to a viewport coordinate painter path. More...
 
QPoint mapFromScene (qreal x, qreal y) const
 This function is provided for convenience. More...
 
QPolygon mapFromScene (qreal x, qreal y, qreal w, qreal h) const
 This function is provided for convenience. More...
 
QPointF mapToScene (const QPoint &point) const
 Returns the viewport coordinate point mapped to scene coordinates. More...
 
QPolygonF mapToScene (const QRect &rect) const
 Returns the viewport rectangle rect mapped to a scene coordinate polygon. More...
 
QPolygonF mapToScene (const QPolygon &polygon) const
 Returns the viewport polygon polygon mapped to a scene coordinate polygon. More...
 
QPainterPath mapToScene (const QPainterPath &path) const
 Returns the viewport painter path path mapped to a scene coordinate painter path. More...
 
QPointF mapToScene (int x, int y) const
 This function is provided for convenience. More...
 
QPolygonF mapToScene (int x, int y, int w, int h) const
 This function is provided for convenience. More...
 
QMatrix matrix () const
 Returns the current transformation matrix for the view. More...
 
OptimizationFlags optimizationFlags () const
 
 QGraphicsView (QWidget *parent=0)
 Constructs a QGraphicsView. More...
 
 QGraphicsView (QGraphicsScene *scene, QWidget *parent=0)
 Constructs a QGraphicsView and sets the visualized scene to scene. More...
 
void render (QPainter *painter, const QRectF &target=QRectF(), const QRect &source=QRect(), Qt::AspectRatioMode aspectRatioMode=Qt::KeepAspectRatio)
 Renders the source rect, which is in view coordinates, from the scene into target, which is in paint device coordinates, using painter. More...
 
QPainter::RenderHints renderHints () const
 
void resetCachedContent ()
 Resets any cached content. More...
 
void resetMatrix ()
 Resets the view transformation matrix to the identity matrix. More...
 
void resetTransform ()
 Resets the view transformation to the identity matrix. More...
 
ViewportAnchor resizeAnchor () const
 
void rotate (qreal angle)
 Rotates the current view transformation angle degrees clockwise. More...
 
Qt::ItemSelectionMode rubberBandSelectionMode () const
 
void scale (qreal sx, qreal sy)
 Scales the current view transformation by (sx, sy). More...
 
QGraphicsScenescene () const
 Returns a pointer to the scene that is currently visualized in the view. More...
 
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)
 Sets the view's current transformation matrix to matrix. More...
 
void setOptimizationFlag (OptimizationFlag flag, bool enabled=true)
 Enables flag if enabled is true; otherwise disables flag. More...
 
void setOptimizationFlags (OptimizationFlags flags)
 
void setRenderHint (QPainter::RenderHint hint, bool enabled=true)
 If enabled is true, the render hint hint is enabled; otherwise it is disabled. More...
 
void setRenderHints (QPainter::RenderHints hints)
 
void setResizeAnchor (ViewportAnchor anchor)
 
void setRubberBandSelectionMode (Qt::ItemSelectionMode mode)
 
void setScene (QGraphicsScene *scene)
 Sets the current scene to scene. More...
 
void setSceneRect (const QRectF &rect)
 
void setSceneRect (qreal x, qreal y, qreal w, qreal h)
 
void setTransform (const QTransform &matrix, bool combine=false)
 Sets the view's current transformation matrix to matrix. More...
 
void setTransformationAnchor (ViewportAnchor anchor)
 
void setViewportUpdateMode (ViewportUpdateMode mode)
 
void shear (qreal sh, qreal sv)
 Shears the current view transformation by (sh, sv). More...
 
QSize sizeHint () const
 Reimplemented Function More...
 
QTransform transform () const
 Returns the current transformation matrix for the view. More...
 
ViewportAnchor transformationAnchor () const
 
void translate (qreal dx, qreal dy)
 Translates the current view transformation by (dx, dy). More...
 
QTransform viewportTransform () const
 Returns a matrix that maps viewport coordinates to scene coordinates. More...
 
ViewportUpdateMode viewportUpdateMode () const
 
 ~QGraphicsView ()
 Destructs the QGraphicsView object. More...
 
- Public Functions inherited from QAbstractScrollArea
void addScrollBarWidget (QWidget *widget, Qt::Alignment alignment)
 Adds widget as a scroll bar widget in the location specified by alignment. More...
 
QWidgetcornerWidget () const
 Returns the widget in the corner between the two scroll bars. More...
 
QScrollBarhorizontalScrollBar () const
 Returns the horizontal scroll bar. More...
 
Qt::ScrollBarPolicy horizontalScrollBarPolicy () const
 
QSize maximumViewportSize () const
 Returns the size of the viewport as if the scroll bars had no valid scrolling range. More...
 
QSize minimumSizeHint () const
 Reimplemented Function More...
 
 QAbstractScrollArea (QWidget *parent=0)
 Constructs a viewport. More...
 
QWidgetList scrollBarWidgets (Qt::Alignment alignment)
 Returns a list of the currently set scroll bar widgets. More...
 
void setCornerWidget (QWidget *widget)
 Sets the widget in the corner between the two scroll bars to be widget. More...
 
void setHorizontalScrollBar (QScrollBar *scrollbar)
 Replaces the existing horizontal scroll bar with scrollBar, and sets all the former scroll bar's slider properties on the new scroll bar. More...
 
void setHorizontalScrollBarPolicy (Qt::ScrollBarPolicy)
 
void setVerticalScrollBar (QScrollBar *scrollbar)
 Replaces the existing vertical scroll bar with scrollBar, and sets all the former scroll bar's slider properties on the new scroll bar. More...
 
void setVerticalScrollBarPolicy (Qt::ScrollBarPolicy)
 
void setViewport (QWidget *widget)
 Sets the viewport to be the given widget. More...
 
QSize sizeHint () const
 Reimplemented Function More...
 
QScrollBarverticalScrollBar () const
 Returns the vertical scroll bar. More...
 
Qt::ScrollBarPolicy verticalScrollBarPolicy () const
 
QWidgetviewport () const
 Returns the viewport widget. More...
 
 ~QAbstractScrollArea ()
 Destroys the viewport. More...
 
- Public Functions inherited from QFrame
QRect frameRect () const
 
Shadow frameShadow () const
 
Shape frameShape () const
 
int frameStyle () const
 Returns the frame style. More...
 
int frameWidth () const
 
int lineWidth () const
 
int midLineWidth () const
 
 QFrame (QWidget *parent=0, Qt::WindowFlags f=0)
 Constructs a frame widget with frame style NoFrame and a 1-pixel frame width. More...
 
void setFrameRect (const QRect &)
 em>Reimplemented Function More...
 
void setFrameShadow (Shadow)
 
void setFrameShape (Shape)
 
void setFrameStyle (int)
 Sets the frame style to style. More...
 
void setLineWidth (int)
 
void setMidLineWidth (int)
 
QSize sizeHint () const
 em>Reimplemented Function More...
 
 ~QFrame ()
 Destroys the frame. More...
 
- Public Functions inherited from QWidget
bool acceptDrops () const
 
QString accessibleDescription () const
 
QString accessibleName () const
 
QList< QAction * > actions () const
 Returns the (possibly empty) list of this widget's actions. More...
 
void activateWindow ()
 Sets the top-level widget containing this widget to be the active window. More...
 
void addAction (QAction *action)
 Appends the action action to this widget's list of actions. More...
 
void addActions (QList< QAction *> actions)
 Appends the actions actions to this widget's list of actions. More...
 
void adjustSize ()
 Adjusts the size of the widget to fit its contents. More...
 
bool autoFillBackground () const
 
QPalette::ColorRole backgroundRole () const
 Returns the background role of the widget. More...
 
QSize baseSize () const
 
QWidgetchildAt (int x, int y) const
 Returns the visible child widget at the position ({x}, {y}) in the widget's coordinate system. More...
 
QWidgetchildAt (const QPoint &p) const
 Returns the visible child widget at point p in the widget's own coordinate system. More...
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void clearFocus ()
 Takes keyboard input focus from the widget. More...
 
void clearMask ()
 Removes any mask set by setMask(). More...
 
QMargins contentsMargins () const
 The contentsMargins function returns the widget's contents margins. More...
 
QRect contentsRect () const
 Returns the area inside the widget's margins. More...
 
Qt::ContextMenuPolicy contextMenuPolicy () const
 
void createWinId ()
 
QCursor cursor () const
 
int devType () const
 
WId effectiveWinId () const
 Returns the effective window system identifier of the widget, i. More...
 
void ensurePolished () const
 Ensures that the widget has been polished by QStyle (i.e., has a proper font and palette). More...
 
Qt::FocusPolicy focusPolicy () const
 
QWidgetfocusProxy () const
 Returns the focus proxy, or 0 if there is no focus proxy. More...
 
QWidgetfocusWidget () const
 Returns the last child of this widget that setFocus had been called on. More...
 
const QFontfont () const
 
QFontInfo fontInfo () const
 Returns the font info for the widget's current font. More...
 
QFontMetrics fontMetrics () const
 Returns the font metrics for the widget's current font. More...
 
QPalette::ColorRole foregroundRole () const
 Returns the foreground role. More...
 
QRect frameGeometry () const
 
QSize frameSize () const
 
const QRectgeometry () const
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 Returns the widget's contents margins for left, top, right, and bottom. More...
 
HDC getDC () const
 Returns the window system handle of the widget, for low-level access. More...
 
void grabGesture (Qt::GestureType type, Qt::GestureFlags flags=Qt::GestureFlags())
 Subscribes the widget to a given gesture with specific flags. More...
 
void grabKeyboard ()
 Grabs the keyboard input. More...
 
void grabMouse ()
 Grabs the mouse input. More...
 
void grabMouse (const QCursor &)
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 Adds a shortcut to Qt's shortcut system that watches for the given key sequence in the given context. More...
 
QGraphicsEffectgraphicsEffect () const
 The graphicsEffect function returns a pointer to the widget's graphics effect. More...
 
QGraphicsProxyWidgetgraphicsProxyWidget () const
 Returns the proxy widget for the corresponding embedded widget in a graphics view; otherwise returns 0. More...
 
bool hasFocus () const
 
bool hasMouseTracking () const
 
int height () const
 
virtual int heightForWidth (int) const
 Returns the preferred height for this widget, given the width w. More...
 
QInputContextinputContext ()
 This function returns the QInputContext for this widget. More...
 
Qt::InputMethodHints inputMethodHints () const
 
void insertAction (QAction *before, QAction *action)
 Inserts the action action to this widget's list of actions, before the action before. More...
 
void insertActions (QAction *before, QList< QAction *> actions)
 Inserts the actions actions to this widget's list of actions, before the action before. More...
 
WId internalWinId () const
 Returns the window system identifier of the widget, or 0 if the widget is not created yet. More...
 
bool isActiveWindow () const
 
bool isAncestorOf (const QWidget *child) const
 Returns true if this widget is a parent, (or grandparent and so on to any level), of the given child, and both widgets are within the same window; otherwise returns false. More...
 
bool isEnabled () const
 
bool isEnabledTo (QWidget *) const
 Returns true if this widget would become enabled if ancestor is enabled; otherwise returns false. More...
 
bool isEnabledToTLW () const
 This function is deprecated. More...
 
bool isFullScreen () const
 
bool isHidden () const
 Returns true if the widget is hidden, otherwise returns false. More...
 
bool isLeftToRight () const
 
bool isMaximized () const
 
bool isMinimized () const
 
bool isModal () const
 
bool isRightToLeft () const
 
bool isTopLevel () const
 Use isWindow() instead. More...
 
bool isVisible () const
 
bool isVisibleTo (QWidget *) const
 Returns true if this widget would become visible if ancestor is shown; otherwise returns false. More...
 
bool isWindow () const
 Returns true if the widget is an independent window, otherwise returns false. More...
 
bool isWindowModified () const
 
QLayoutlayout () const
 Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed. More...
 
Qt::LayoutDirection layoutDirection () const
 
QLocale locale () const
 
Qt::HANDLE macCGHandle () const
 Returns the CoreGraphics handle of the widget. More...
 
Qt::HANDLE macQDHandle () const
 Returns the QuickDraw handle of the widget. More...
 
QPoint mapFrom (QWidget *, const QPoint &) const
 Translates the widget coordinate pos from the coordinate system of parent to this widget's coordinate system. More...
 
QPoint mapFromGlobal (const QPoint &) const
 Translates the global screen coordinate pos to widget coordinates. More...
 
QPoint mapFromParent (const QPoint &) const
 Translates the parent widget coordinate pos to widget coordinates. More...
 
QPoint mapTo (QWidget *, const QPoint &) const
 Translates the widget coordinate pos to the coordinate system of parent. More...
 
QPoint mapToGlobal (const QPoint &) const
 Translates the widget coordinate pos to global screen coordinates. More...
 
QPoint mapToParent (const QPoint &) const
 Translates the widget coordinate pos to a coordinate in the parent widget. More...
 
QRegion mask () const
 Returns the mask currently set on a widget. More...
 
int maximumHeight () const
 
QSize maximumSize () const
 
int maximumWidth () const
 
int minimumHeight () const
 
QSize minimumSize () const
 
int minimumWidth () const
 
void move (int x, int y)
 This corresponds to move(QPoint(x, y)). More...
 
void move (const QPoint &)
 
QWidgetnativeParentWidget () const
 Returns the native parent for this widget, i. More...
 
QWidgetnextInFocusChain () const
 Returns the next widget in this widget's focus chain. More...
 
QRect normalGeometry () const
 
void overrideWindowFlags (Qt::WindowFlags type)
 Sets the window flags for the widget to flags, without telling the window system. More...
 
void overrideWindowState (Qt::WindowStates state)
 
QPaintEnginepaintEngine () const
 Returns the widget's paint engine. More...
 
const QPalettepalette () const
 
QWidgetparentWidget () const
 Returns the parent of this widget, or 0 if it does not have any parent widget. More...
 
QPoint pos () const
 
QWidgetpreviousInFocusChain () const
 The previousInFocusChain function returns the previous widget in this widget's focus chain. More...
 
 QWidget (QWidget *parent=0, Qt::WindowFlags f=0)
 Constructs a widget which is a child of parent, with widget flags set to f. More...
 
QRect rect () const
 
void releaseDC (HDC) const
 Releases the HDC hdc acquired by a previous call to getDC(). More...
 
void releaseKeyboard ()
 Releases the keyboard grab. More...
 
void releaseMouse ()
 Releases the mouse grab. More...
 
void releaseShortcut (int id)
 Removes the shortcut with the given id from Qt's shortcut system. More...
 
void removeAction (QAction *action)
 Removes the action action from this widget's list of actions. More...
 
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
 Renders the sourceRegion of this widget into the target using renderFlags to determine how to render. More...
 
void render (QPainter *painter, const QPoint &targetOffset=QPoint(), const QRegion &sourceRegion=QRegion(), RenderFlags renderFlags=RenderFlags(DrawWindowBackground|DrawChildren))
 Renders the widget into the painter's QPainter::device(). More...
 
void repaint (int x, int y, int w, int h)
 This version repaints a rectangle (x, y, w, h) inside the widget. More...
 
void repaint (const QRect &)
 This version repaints a rectangle rect inside the widget. More...
 
void repaint (const QRegion &)
 This version repaints a region rgn inside the widget. More...
 
void resize (int w, int h)
 This corresponds to resize(QSize(w, h)). More...
 
void resize (const QSize &)
 
bool restoreGeometry (const QByteArray &geometry)
 Restores the geometry and state top-level widgets stored in the byte array geometry. More...
 
QByteArray saveGeometry () const
 Saves the current geometry and state for top-level widgets. More...
 
void scroll (int dx, int dy)
 Scrolls the widget including its children dx pixels to the right and dy downward. More...
 
void scroll (int dx, int dy, const QRect &)
 This version only scrolls r and does not move the children of the widget. More...
 
void setAcceptDrops (bool on)
 
void setAccessibleDescription (const QString &description)
 
void setAccessibleName (const QString &name)
 
void setAttribute (Qt::WidgetAttribute, bool on=true)
 Sets the attribute attribute on this widget if on is true; otherwise clears the attribute. More...
 
void setAutoFillBackground (bool enabled)
 
void setBackgroundRole (QPalette::ColorRole)
 Sets the background role of the widget to role. More...
 
void setBaseSize (const QSize &)
 
void setBaseSize (int basew, int baseh)
 This corresponds to setBaseSize(QSize(basew, baseh)). More...
 
void setContentsMargins (int left, int top, int right, int bottom)
 Sets the margins around the contents of the widget to have the sizes left, top, right, and bottom. More...
 
void setContentsMargins (const QMargins &margins)
 The setContentsMargins function sets the margins around the widget's contents. More...
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void setCursor (const QCursor &)
 
void setFixedHeight (int h)
 Sets both the minimum and maximum heights of the widget to h without changing the widths. More...
 
void setFixedSize (const QSize &)
 Sets both the minimum and maximum sizes of the widget to s, thereby preventing it from ever growing or shrinking. More...
 
void setFixedSize (int w, int h)
 Sets the width of the widget to w and the height to h. More...
 
void setFixedWidth (int w)
 Sets both the minimum and maximum width of the widget to w without changing the heights. More...
 
void setFocus (Qt::FocusReason reason)
 Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window. More...
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
void setFocusProxy (QWidget *)
 Sets the widget's focus proxy to widget w. More...
 
void setFont (const QFont &)
 Use the single-argument overload instead. More...
 
void setForegroundRole (QPalette::ColorRole)
 Sets the foreground role of the widget to role. More...
 
void setGeometry (int x, int y, int w, int h)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This corresponds to setGeometry(QRect(x, y, w, h)). More...
 
void setGeometry (const QRect &)
 
void setGraphicsEffect (QGraphicsEffect *effect)
 The setGraphicsEffect function is for setting the widget's graphics effect. More...
 
void setInputContext (QInputContext *)
 This function sets the input context context on this widget. More...
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
void setLayout (QLayout *)
 Sets the layout manager for this widget to layout. More...
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setLocale (const QLocale &locale)
 
void setMask (const QBitmap &)
 Causes only the pixels of the widget for which bitmap has a corresponding 1 bit to be visible. More...
 
void setMask (const QRegion &)
 Causes only the parts of the widget which overlap region to be visible. More...
 
void setMaximumHeight (int maxh)
 
void setMaximumSize (const QSize &)
 
void setMaximumSize (int maxw, int maxh)
 This function corresponds to setMaximumSize(QSize(maxw, maxh)). More...
 
void setMaximumWidth (int maxw)
 
void setMinimumHeight (int minh)
 
void setMinimumSize (const QSize &)
 
void setMinimumSize (int minw, int minh)
 This function corresponds to setMinimumSize(QSize(minw, minh)). More...
 
void setMinimumWidth (int minw)
 
void setMouseTracking (bool enable)
 
void setPalette (const QPalette &)
 Use the single-argument overload instead. More...
 
void setParent (QWidget *parent)
 Sets the parent of the widget to parent, and resets the window flags. More...
 
void setParent (QWidget *parent, Qt::WindowFlags f)
 This function also takes widget flags, f as an argument. More...
 
void setShortcutAutoRepeat (int id, bool enable=true)
 If enable is true, auto repeat of the shortcut with the given id is enabled; otherwise it is disabled. More...
 
void setShortcutEnabled (int id, bool enable=true)
 If enable is true, the shortcut with the given id is enabled; otherwise the shortcut is disabled. More...
 
void setSizeIncrement (const QSize &)
 
void setSizeIncrement (int w, int h)
 Sets the x (width) size increment to w and the y (height) size increment to h. More...
 
void setSizePolicy (QSizePolicy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 Sets the size policy of the widget to horizontal and vertical, with standard stretch and no height-for-width. More...
 
void setStatusTip (const QString &)
 
void setStyle (QStyle *)
 Sets the widget's GUI style to style. More...
 
void setToolTip (const QString &)
 
void setUpdatesEnabled (bool enable)
 
void setupUi (QWidget *widget)
 Sets up the user interface for the specified widget. More...
 
void setWhatsThis (const QString &)
 
void setWindowFilePath (const QString &filePath)
 
void setWindowFlags (Qt::WindowFlags type)
 
void setWindowIcon (const QIcon &icon)
 
void setWindowIconText (const QString &)
 
void setWindowModality (Qt::WindowModality windowModality)
 
void setWindowOpacity (qreal level)
 
void setWindowRole (const QString &)
 Sets the window's role to role. More...
 
void setWindowState (Qt::WindowStates state)
 Sets the window state to windowState. More...
 
void setWindowSurface (QWindowSurface *surface)
 Sets the window surface to be the surface specified. More...
 
QSize size () const
 
QSize sizeIncrement () const
 
QSizePolicy sizePolicy () const
 
void stackUnder (QWidget *)
 Places the widget under w in the parent widget's stack. More...
 
QString statusTip () const
 
QStylestyle () const
 
QString styleSheet () const
 
bool testAttribute (Qt::WidgetAttribute) const
 Returns true if attribute attribute is set on this widget; otherwise returns false. More...
 
QString toolTip () const
 
QWidgettopLevelWidget () const
 
bool underMouse () const
 Returns true if the widget is under the mouse cursor; otherwise returns false. More...
 
void ungrabGesture (Qt::GestureType type)
 Unsubscribes the widget from a given gesture type. More...
 
void unsetCursor ()
 
void unsetLayoutDirection ()
 
void unsetLocale ()
 
void update (int x, int y, int w, int h)
 This version updates a rectangle (x, y, w, h) inside the widget. More...
 
void update (const QRect &)
 This version updates a rectangle rect inside the widget. More...
 
void update (const QRegion &)
 This version repaints a region rgn inside the widget. More...
 
void updateGeometry ()
 Notifies the layout system that this widget has changed and may need to change geometry. More...
 
bool updatesEnabled () const
 
QRegion visibleRegion () const
 Returns the unobscured region where paint events can occur. More...
 
QString whatsThis () const
 
int width () const
 
QWidgetwindow () const
 Returns the window for this widget, i.e. More...
 
QString windowFilePath () const
 
Qt::WindowFlags windowFlags () const
 Window flags are a combination of a type (e. More...
 
QIcon windowIcon () const
 
QString windowIconText () const
 
Qt::WindowModality windowModality () const
 
qreal windowOpacity () const
 
QString windowRole () const
 Returns the window's role, or an empty string. More...
 
Qt::WindowStates windowState () const
 Returns the current window state. More...
 
QWindowSurfacewindowSurface () const
 Returns the QWindowSurface this widget will be drawn into. More...
 
QString windowTitle () const
 
Qt::WindowType windowType () const
 Returns the window type of this widget. More...
 
WId winId () const
 Returns the window system identifier of the widget. More...
 
int x () const
 
const QX11Infox11Info () const
 Returns information about the configuration of the X display used to display the widget. More...
 
Qt::HANDLE x11PictureHandle () const
 Returns the X11 Picture handle of the widget for XRender support. More...
 
int y () const
 
 ~QWidget ()
 Destroys the widget. More...
 
- Public Functions inherited from QObject
bool blockSignals (bool b)
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). More...
 
const QObjectListchildren () const
 Returns a list of child objects. More...
 
bool connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=0, const QObject *receiver=0, const char *member=0)
 
bool disconnect (const QObject *receiver, const char *member=0)
 
void dumpObjectInfo ()
 Dumps information about signal connections, etc. More...
 
void dumpObjectTree ()
 Dumps a tree of children to the debug output. More...
 
QList< QByteArraydynamicPropertyNames () const
 Returns the names of all properties that were dynamically added to the object using setProperty(). More...
 
template<typename T >
findChild (const QString &aName=QString()) const
 Returns the child of this object that can be cast into type T and that is called name, or 0 if there is no such object. More...
 
template<typename T >
QList< T > findChildren (const QString &aName=QString()) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. More...
 
template<typename T >
QList< T > findChildren (const QRegExp &re) const
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false. More...
 
void installEventFilter (QObject *)
 Installs an event filter filterObj on this object. More...
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false. More...
 
void killTimer (int id)
 Kills the timer with timer identifier, id. More...
 
virtual const QMetaObjectmetaObject () const
 Returns a pointer to the meta-object of this object. More...
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children. More...
 
QString objectName () const
 
QObjectparent () const
 Returns a pointer to the parent object. More...
 
QVariant property (const char *name) const
 Returns the value of the object's name property. More...
 
Q_INVOKABLE QObject (QObject *parent=0)
 Constructs an object with parent object parent. More...
 
void removeEventFilter (QObject *)
 Removes an event filter object obj from this object. More...
 
void setObjectName (const QString &name)
 
void setParent (QObject *)
 Makes the object a child of parent. More...
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value. More...
 
void setUserData (uint id, QObjectUserData *data)
 
bool signalsBlocked () const
 Returns true if signals are blocked; otherwise returns false. More...
 
int startTimer (int interval)
 Starts a timer and returns a timer identifier, or returns zero if it could not start a timer. More...
 
QThreadthread () const
 Returns the thread in which the object lives. More...
 
QObjectUserDatauserData (uint id) const
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects. More...
 
- Public Functions inherited from QPaintDevice
int colorCount () const
 
int depth () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
QT_DEPRECATED int numColors () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int width () const
 
int widthMM () const
 
virtual ~QPaintDevice ()
 

Protected Functions

virtual bool eventFilter (QObject *watched, QEvent *e)
 
virtual void paintEvent (QPaintEvent *event)
 
virtual void resizeEvent (QResizeEvent *)
 This function handles the QResizeEvent {resize event} e. More...
 
virtual void setRootObject (QObject *obj)
 
virtual void timerEvent (QTimerEvent *)
 If the QTimerEvent {timer event} e is this view's resize timer, sceneResized() is emitted. More...
 
- Protected Functions inherited from QGraphicsView
void contextMenuEvent (QContextMenuEvent *event)
 Reimplemented Function More...
 
void dragEnterEvent (QDragEnterEvent *event)
 Reimplemented Function More...
 
void dragLeaveEvent (QDragLeaveEvent *event)
 Reimplemented Function More...
 
void dragMoveEvent (QDragMoveEvent *event)
 Reimplemented Function More...
 
virtual void drawBackground (QPainter *painter, const QRectF &rect)
 Draws the background of the scene using painter, before any items and the foreground are drawn. More...
 
virtual void drawForeground (QPainter *painter, const QRectF &rect)
 Draws the foreground of the scene using painter, after the background and all items are drawn. More...
 
virtual void drawItems (QPainter *painter, int numItems, QGraphicsItem *items[], const QStyleOptionGraphicsItem options[])
 Draws the items items in the scene using painter, after the background and before the foreground are drawn. More...
 
void dropEvent (QDropEvent *event)
 Reimplemented Function More...
 
bool event (QEvent *event)
 Reimplemented Function More...
 
void focusInEvent (QFocusEvent *event)
 Reimplemented Function More...
 
bool focusNextPrevChild (bool next)
 Reimplemented Function More...
 
void focusOutEvent (QFocusEvent *event)
 Reimplemented Function More...
 
void inputMethodEvent (QInputMethodEvent *event)
 Reimplemented Function More...
 
void keyPressEvent (QKeyEvent *event)
 Reimplemented Function More...
 
void keyReleaseEvent (QKeyEvent *event)
 Reimplemented Function More...
 
void mouseDoubleClickEvent (QMouseEvent *event)
 Reimplemented Function More...
 
void mouseMoveEvent (QMouseEvent *event)
 Reimplemented Function More...
 
void mousePressEvent (QMouseEvent *event)
 Reimplemented Function More...
 
void mouseReleaseEvent (QMouseEvent *event)
 Reimplemented Function More...
 
void paintEvent (QPaintEvent *event)
 Reimplemented Function More...
 
 QGraphicsView (QGraphicsViewPrivate &, QWidget *parent=0)
 
void resizeEvent (QResizeEvent *event)
 Reimplemented Function More...
 
void scrollContentsBy (int dx, int dy)
 Reimplemented Function More...
 
void showEvent (QShowEvent *event)
 Reimplemented Function More...
 
bool viewportEvent (QEvent *event)
 Reimplemented Function More...
 
void wheelEvent (QWheelEvent *event)
 Reimplemented Function More...
 
- Protected Functions inherited from QAbstractScrollArea
void contextMenuEvent (QContextMenuEvent *)
 This event handler can be reimplemented in a subclass to receive context menu events for the viewport() widget. More...
 
void dragEnterEvent (QDragEnterEvent *)
 This event handler can be reimplemented in a subclass to receive drag enter events (passed in event), for the viewport() widget. More...
 
void dragLeaveEvent (QDragLeaveEvent *)
 This event handler can be reimplemented in a subclass to receive drag leave events (passed in event), for the viewport() widget. More...
 
void dragMoveEvent (QDragMoveEvent *)
 This event handler can be reimplemented in a subclass to receive drag move events (passed in event), for the viewport() widget. More...
 
void dropEvent (QDropEvent *)
 This event handler can be reimplemented in a subclass to receive drop events (passed in event), for the viewport() widget. More...
 
bool event (QEvent *)
 Reimplemented Function More...
 
void keyPressEvent (QKeyEvent *)
 This function is called with key event e when key presses occur. More...
 
void mouseDoubleClickEvent (QMouseEvent *)
 This event handler can be reimplemented in a subclass to receive mouse double click events for the viewport() widget. More...
 
void mouseMoveEvent (QMouseEvent *)
 This event handler can be reimplemented in a subclass to receive mouse move events for the viewport() widget. More...
 
void mousePressEvent (QMouseEvent *)
 This event handler can be reimplemented in a subclass to receive mouse press events for the viewport() widget. More...
 
void mouseReleaseEvent (QMouseEvent *)
 This event handler can be reimplemented in a subclass to receive mouse release events for the viewport() widget. More...
 
void paintEvent (QPaintEvent *)
 This event handler can be reimplemented in a subclass to receive paint events (passed in event), for the viewport() widget. More...
 
 QAbstractScrollArea (QAbstractScrollAreaPrivate &dd, QWidget *parent=0)
 Creates a new QAbstractScrollAreaPrivate, dd with the given parent. More...
 
void resizeEvent (QResizeEvent *)
 This event handler can be reimplemented in a subclass to receive resize events (passed in event), for the viewport() widget. More...
 
void setViewportMargins (int left, int top, int right, int bottom)
 Sets the margins around the scrolling area to left, top, right and bottom. More...
 
void setViewportMargins (const QMargins &margins)
 Sets margins around the scrolling area. More...
 
void wheelEvent (QWheelEvent *)
 This event handler can be reimplemented in a subclass to receive wheel events for the viewport() widget. More...
 
- Protected Functions inherited from QFrame
void changeEvent (QEvent *)
 This event handler can be reimplemented to handle state changes. More...
 
void drawFrame (QPainter *)
 em>Reimplemented Function More...
 
bool event (QEvent *e)
 Reimplemented Function More...
 
void paintEvent (QPaintEvent *)
 This event handler can be reimplemented in a subclass to receive paint events passed in event. More...
 
 QFrame (QFramePrivate &dd, QWidget *parent=0, Qt::WindowFlags f=0)
 
- Protected Functions inherited from QWidget
virtual void actionEvent (QActionEvent *)
 This event handler is called with the given event whenever the widget's actions are changed. More...
 
virtual void closeEvent (QCloseEvent *)
 This event handler is called with the given event when Qt receives a window close request for a top-level widget from the window system. More...
 
void create (WId=0, bool initializeWindow=true, bool destroyOldWindow=true)
 Creates a new widget window if window is 0, otherwise sets the widget's window to window. More...
 
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
 Frees up window system resources. More...
 
virtual void enabledChange (bool)
 
virtual void enterEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive widget enter events which are passed in the event parameter. More...
 
bool focusNextChild ()
 Finds a new widget to give the keyboard focus to, as appropriate for Tab, and returns true if it can find a new widget, or false if it can't. More...
 
bool focusPreviousChild ()
 Finds a new widget to give the keyboard focus to, as appropriate for Shift+Tab, and returns true if it can find a new widget, or false if it can't. More...
 
virtual void fontChange (const QFont &)
 
virtual void hideEvent (QHideEvent *)
 This event handler can be reimplemented in a subclass to receive widget hide events. More...
 
virtual void languageChange ()
 
virtual void leaveEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive widget leave events which are passed in the event parameter. More...
 
virtual bool macEvent (EventHandlerCallRef, EventRef)
 This special event handler can be reimplemented in a subclass to receive native Macintosh events. More...
 
int metric (PaintDeviceMetric) const
 Internal implementation of the virtual QPaintDevice::metric() function. More...
 
virtual void moveEvent (QMoveEvent *)
 This event handler can be reimplemented in a subclass to receive widget move events which are passed in the event parameter. More...
 
virtual void paletteChange (const QPalette &)
 
 QWidget (QWidgetPrivate &d, QWidget *parent, Qt::WindowFlags f)
 
virtual bool qwsEvent (QWSEvent *)
 This special event handler can be reimplemented in a subclass to receive native Qt for Embedded Linux events which are passed in the event parameter. More...
 
void resetInputContext ()
 This function can be called on the widget that currently has focus to reset the input method operating on it. More...
 
virtual void styleChange (QStyle &)
 
virtual void tabletEvent (QTabletEvent *)
 This event handler, for event event, can be reimplemented in a subclass to receive tablet events for the widget. More...
 
virtual void windowActivationChange (bool)
 
virtual bool winEvent (MSG *message, long *result)
 This special event handler can be reimplemented in a subclass to receive native Windows events which are passed in the message parameter. More...
 
virtual bool x11Event (XEvent *)
 This special event handler can be reimplemented in a subclass to receive native X11 events passed in the event parameter. More...
 
- Protected Functions inherited from QObject
virtual void childEvent (QChildEvent *)
 This event handler can be reimplemented in a subclass to receive child events. More...
 
virtual void connectNotify (const char *signal)
 This virtual function is called when something has been connected to signal in this object. More...
 
virtual void customEvent (QEvent *)
 This event handler can be reimplemented in a subclass to receive custom events. More...
 
virtual void disconnectNotify (const char *signal)
 This virtual function is called when something has been disconnected from signal in this object. More...
 
 QObject (QObjectPrivate &dd, QObject *parent=0)
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal. More...
 
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns 0. More...
 
int senderSignalIndex () const
 
- Protected Functions inherited from QPaintDevice
 QPaintDevice ()
 

Private Slots

void continueExecute ()
 

Properties

ResizeMode resizeMode
 whether the view should resize the canvas contents More...
 
QUrl source
 The URL of the source of the QML component. More...
 
Status status
 The component's current status. More...
 

Additional Inherited Members

- Public Slots inherited from QGraphicsView
void invalidateScene (const QRectF &rect=QRectF(), QGraphicsScene::SceneLayers layers=QGraphicsScene::AllLayers)
 Invalidates and schedules a redraw of layers inside rect. More...
 
void updateScene (const QList< QRectF > &rects)
 Schedules an update of the scene rectangles rects. More...
 
void updateSceneRect (const QRectF &rect)
 Notifies QGraphicsView that the scene's scene rect has changed. More...
 
- Public Slots inherited from QWidget
bool close ()
 Closes this widget. More...
 
void hide ()
 Hides the widget. More...
 
void lower ()
 Lowers the widget to the bottom of the parent widget's stack. More...
 
void raise ()
 Raises this widget to the top of the parent widget's stack. More...
 
void repaint ()
 Repaints the widget directly by calling paintEvent() immediately, unless updates are disabled or the widget is hidden. More...
 
void setDisabled (bool)
 Disables widget input events if disable is true; otherwise enables input events. More...
 
void setEnabled (bool)
 
void setFocus ()
 Gives the keyboard input focus to this widget (or its focus proxy) if this widget or one of its parents is the active window. More...
 
void setHidden (bool hidden)
 Convenience function, equivalent to setVisible(!hidden). More...
 
QT_MOC_COMPAT void setShown (bool shown)
 Use setVisible(shown) instead. More...
 
void setStyleSheet (const QString &styleSheet)
 
virtual void setVisible (bool visible)
 
void setWindowModified (bool)
 
void setWindowTitle (const QString &)
 
void show ()
 Shows the widget and its child widgets. More...
 
void showFullScreen ()
 Shows the widget in full-screen mode. More...
 
void showMaximized ()
 Shows the widget maximized. More...
 
void showMinimized ()
 Shows the widget minimized, as an icon. More...
 
void showNormal ()
 Restores the widget after it has been maximized or minimized. More...
 
void update ()
 Updates the widget unless updates are disabled or the widget is hidden. More...
 
- Public Slots inherited from QObject
void deleteLater ()
 Schedules this object for deletion. More...
 
- Static Public Functions inherited from QWidget
static QWidgetfind (WId)
 Returns a pointer to the widget with window identifer/handle id. More...
 
static QWidgetkeyboardGrabber ()
 Returns the widget that is currently grabbing the keyboard input. More...
 
static QWidgetmouseGrabber ()
 Returns the widget that is currently grabbing the mouse input. More...
 
static void setTabOrder (QWidget *, QWidget *)
 Puts the second widget after the first widget in the focus order. More...
 
- Static Public Functions inherited from QObject
static bool connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 Creates a connection of the given type from the signal in the sender object to the method in the receiver object. More...
 
static bool connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 Disconnects signal in object sender from method in object receiver. More...
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static uint registerUserData ()
 
static QString tr (const char *sourceText, const char *comment=0, int n=-1)
 
static QString trUtf8 (const char *sourceText, const char *comment=0, int n=-1)
 
- Static Public Functions inherited from QPaintDevice
static QWSDisplayqwsDisplay ()
 
- Static Public Variables inherited from QObject
static const QMetaObject staticMetaObject
 This variable stores the meta-object for the class. More...
 
- Protected Slots inherited from QGraphicsView
void setupViewport (QWidget *widget)
 This slot is called by QAbstractScrollArea after setViewport() has been called. More...
 
- Protected Slots inherited from QAbstractScrollArea
void setupViewport (QWidget *viewport)
 This slot is called by QAbstractScrollArea after setViewport(viewport) has been called. More...
 
- Protected Slots inherited from QWidget
void updateMicroFocus ()
 Updates the widget's micro focus. More...
 
- Protected Variables inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Protected Variables inherited from QPaintDevice
ushort painters
 
- Static Protected Variables inherited from QObject
static const QMetaObject staticQtMetaObject
 

Detailed Description

The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface.

Since
4.7

QDeclarativeItem objects can be placed on a standard QGraphicsScene and displayed with QGraphicsView. QDeclarativeView is a QGraphicsView subclass provided as a convenience for displaying QML files, and connecting between QML and C++ Qt objects.

QDeclarativeView provides:

Typical usage:

view->setSource(QUrl::fromLocalFile("myqmlfile.qml"));
view->show();

Since QDeclarativeView is a QWidget-based class, it can be used to display QML interfaces within QWidget-based GUI applications that do not use the Graphics View framework.

To receive errors related to loading and executing QML with QDeclarativeView, you can connect to the statusChanged() signal and monitor for QDeclarativeView::Error. The errors are available via QDeclarativeView::errors().

If you're using your own QGraphicsScene-based scene with QDeclarativeView, remember to enable scene's sticky focus mode and to set itemIndexMethod to QGraphicsScene::NoIndex.

See also
{Integrating QML Code with Existing Qt UI Code}, {Using QML Bindings in C++ Applications}

Definition at line 64 of file qdeclarativeview.h.

Enumerations

◆ ResizeMode

This enum specifies how to resize the view.

  • SizeViewToRootObject The view resizes with the root item in the QML.
  • SizeRootObjectToView The view will automatically resize the root item to the size of the view.
Enumerator
SizeViewToRootObject 
SizeRootObjectToView 

Definition at line 84 of file qdeclarativeview.h.

◆ Status

Specifies the loading status of the QDeclarativeView.

Enumerator
Null 
Ready 
Loading 
Error 

Definition at line 88 of file qdeclarativeview.h.

Constructors and Destructors

◆ QDeclarativeView() [1/2]

QDeclarativeView::QDeclarativeView ( QWidget parent = 0)
explicit

Constructs a QDeclarativeView with the given parent.

Definition at line 265 of file qdeclarativeview.cpp.

266  : QGraphicsView(*(new QDeclarativeViewPrivate), parent)
267 {
270  d->init();
271 }
double d
Definition: qnumeric_p.h:62
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482
QGraphicsView(QWidget *parent=0)
Constructs a QGraphicsView.
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198

◆ QDeclarativeView() [2/2]

QDeclarativeView::QDeclarativeView ( const QUrl source,
QWidget parent = 0 
)

Constructs a QDeclarativeView with the given QML source and parent.

Definition at line 278 of file qdeclarativeview.cpp.

279  : QGraphicsView(*(new QDeclarativeViewPrivate), parent)
280 {
283  d->init();
284  setSource(source);
285 }
double d
Definition: qnumeric_p.h:62
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482
QGraphicsView(QWidget *parent=0)
Constructs a QGraphicsView.
void setSource(const QUrl &)
Sets the source to the url, loads the QML component and instantiates it.
void setSizePolicy(QSizePolicy)
Definition: qwidget.cpp:10198

◆ ~QDeclarativeView()

QDeclarativeView::~QDeclarativeView ( )
virtual

Destroys the view.

Definition at line 319 of file qdeclarativeview.cpp.

320 {
322 }
static QDeclarativeInspectorService * instance()

Functions

◆ continueExecute

void QDeclarativeView::continueExecute ( )
privateslot
Warning
This function is not part of the public interface.

Definition at line 562 of file qdeclarativeview.cpp.

563 {
566 
567  if (d->component->isError()) {
568  QList<QDeclarativeError> errorList = d->component->errors();
569  foreach (const QDeclarativeError &error, errorList) {
570  qWarning() << error;
571  }
573  return;
574  }
575 
576  QObject *obj = d->component->create();
577 
578  if(d->component->isError()) {
579  QList<QDeclarativeError> errorList = d->component->errors();
580  foreach (const QDeclarativeError &error, errorList) {
581  qWarning() << error;
582  }
584  return;
585  }
586 
587  setRootObject(obj);
589 }
double d
Definition: qnumeric_p.h:62
Status
Emitted after component "startup" has completed.
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
virtual void setRootObject(QObject *obj)
#define error(msg)
#define SLOT(a)
Definition: qobjectdefs.h:226
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
#define Q_D(Class)
Definition: qglobal.h:2482
#define SIGNAL(a)
Definition: qobjectdefs.h:227
#define emit
Definition: qobjectdefs.h:76
Q_CORE_EXPORT void qWarning(const char *,...)
The QDeclarativeError class encapsulates a QML error.
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
Disconnects signal in object sender from method in object receiver.
Definition: qobject.cpp:2895
Status status() const
void statusChanged(QDeclarativeView::Status)
This signal is emitted when the component&#39;s current status changes.

◆ engine()

QDeclarativeEngine * QDeclarativeView::engine ( ) const

Returns a pointer to the QDeclarativeEngine used for instantiating QML Components.

Definition at line 369 of file qdeclarativeview.cpp.

Referenced by QmlApplicationViewer::addImportPath(), QDeclarativeViewPrivate::init(), main(), and QmlApplicationViewer::QmlApplicationViewer().

370 {
371  Q_D(const QDeclarativeView);
372  return d->engine;
373 }
double d
Definition: qnumeric_p.h:62
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482

◆ errors()

QList< QDeclarativeError > QDeclarativeView::errors ( ) const

Return the list of errors that occurred during the last compile or create operation.

When the status is not Error, an empty list is returned.

Definition at line 434 of file qdeclarativeview.cpp.

435 {
436  Q_D(const QDeclarativeView);
437  if (d->component)
438  return d->component->errors();
439  return QList<QDeclarativeError>();
440 }
double d
Definition: qnumeric_p.h:62
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482

◆ eventFilter()

bool QDeclarativeView::eventFilter ( QObject watched,
QEvent e 
)
protectedvirtual
Warning
This function is not part of the public interface.

Reimplemented from QObject.

Definition at line 659 of file qdeclarativeview.cpp.

660 {
662  if (watched == d->root && d->resizeMode == SizeViewToRootObject) {
663  if (d->graphicsWidgetRoot) {
664  if (e->type() == QEvent::GraphicsSceneResize) {
665  d->updateSize();
666  }
667  }
668  }
669  return QGraphicsView::eventFilter(watched, e);
670 }
double d
Definition: qnumeric_p.h:62
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482
virtual bool eventFilter(QObject *, QEvent *)
Filters events if this object has been installed as an event filter for the watched object...
Definition: qobject.cpp:1375
Type type() const
Returns the event type.
Definition: qcoreevent.h:303

◆ initialSize()

QSize QDeclarativeView::initialSize ( ) const

Returns the initial size of the root object.

Definition at line 693 of file qdeclarativeview.cpp.

694 {
695  Q_D(const QDeclarativeView);
696  return d->initialSize;
697 }
double d
Definition: qnumeric_p.h:62
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482

◆ paintEvent()

void QDeclarativeView::paintEvent ( QPaintEvent event)
protectedvirtual
Warning
This function is not part of the public interface.

Reimplemented from QWidget.

Definition at line 736 of file qdeclarativeview.cpp.

737 {
739 
742 
743  int time = 0;
744  if (frameRateDebug())
745  time = d->frameTimer.restart();
746 
748 
750 
751  if (frameRateDebug())
752  qDebug() << "paintEvent:" << d->frameTimer.elapsed() << "time since last frame:" << time;
753 
754 #if QT_SHOW_DECLARATIVEVIEW_FPS
755  static QTime timer;
756  static int frames;
757 
758  if (frames == 0) {
759  timer.start();
760  } else if (timer.elapsed() > 5000) {
761  qreal avgtime = timer.elapsed() / (qreal) frames;
762  qDebug("Average time per frame: %f ms (%i fps)", avgtime, int(1000 / avgtime));
763  timer.start();
764  frames = 0;
765  }
766  ++frames;
767  scene()->update();
768 #endif
769 
770 }
double d
Definition: qnumeric_p.h:62
double qreal
Definition: qglobal.h:1193
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
static void addEvent(EventType)
void start()
Sets this time to the current time.
Definition: qdatetime.cpp:2070
EventLoopTimerRef timer
#define Q_D(Class)
Definition: qglobal.h:2482
Q_CORE_EXPORT void qDebug(const char *,...)
The QTime class provides clock time functions.
Definition: qdatetime.h:148
void update(qreal x, qreal y, qreal w, qreal h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
static void endRange(RangeType)
static void startRange(RangeType)
int elapsed() const
Returns the number of milliseconds that have elapsed since the last time start() or restart() was cal...
Definition: qdatetime.cpp:2123
void paintEvent(QPaintEvent *event)
Reimplemented Function
QGraphicsScene * scene() const
Returns a pointer to the scene that is currently visualized in the view.

◆ resizeEvent()

void QDeclarativeView::resizeEvent ( QResizeEvent e)
protectedvirtual

This function handles the QResizeEvent {resize event} e.

Warning
This function is not part of the public interface.

Reimplemented from QWidget.

Definition at line 716 of file qdeclarativeview.cpp.

717 {
719  if (d->resizeMode == SizeRootObjectToView) {
720  d->updateSize();
721  }
722  if (d->declarativeItemRoot) {
723  setSceneRect(QRectF(0, 0, d->declarativeItemRoot->width(), d->declarativeItemRoot->height()));
724  } else if (d->root) {
725  setSceneRect(d->root->boundingRect());
726  } else {
727  setSceneRect(rect());
728  }
729  emit sceneResized(e->size());
731 }
double d
Definition: qnumeric_p.h:62
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482
The QRectF class defines a rectangle in the plane using floating point precision. ...
Definition: qrect.h:511
void resizeEvent(QResizeEvent *event)
Reimplemented Function
#define emit
Definition: qobjectdefs.h:76
QRect rect() const
void setSceneRect(const QRectF &rect)
const QSize & size() const
Returns the new size of the widget.
Definition: qevent.h:355
void sceneResized(QSize size)
This signal is emitted when the view is resized to size.

◆ resizeMode()

ResizeMode QDeclarativeView::resizeMode ( ) const

◆ rootContext()

QDeclarativeContext * QDeclarativeView::rootContext ( ) const

This function returns the root of the context hierarchy.

Each QML component is instantiated in a QDeclarativeContext. QDeclarativeContext's are essential for passing data to QML components. In QML, contexts are arranged hierarchically and this hierarchy is managed by the QDeclarativeEngine.

Definition at line 382 of file qdeclarativeview.cpp.

383 {
384  Q_D(const QDeclarativeView);
385  return d->engine->rootContext();
386 }
double d
Definition: qnumeric_p.h:62
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482

◆ rootObject()

QGraphicsObject * QDeclarativeView::rootObject ( ) const

Returns the view's root QGraphicsObject {item}.

Definition at line 702 of file qdeclarativeview.cpp.

703 {
704  Q_D(const QDeclarativeView);
705  return d->root;
706 }
double d
Definition: qnumeric_p.h:62
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482

◆ sceneResized

void QDeclarativeView::sceneResized ( QSize  size)
signal

This signal is emitted when the view is resized to size.

Referenced by resizeEvent().

◆ setResizeMode()

void QDeclarativeView::setResizeMode ( ResizeMode  mode)

Definition at line 460 of file qdeclarativeview.cpp.

Referenced by QmlApplicationViewer::QmlApplicationViewer().

461 {
463  if (d->resizeMode == mode)
464  return;
465 
466  if (d->declarativeItemRoot) {
467  if (d->resizeMode == SizeViewToRootObject) {
469  static_cast<QDeclarativeItemPrivate *>(QGraphicsItemPrivate::get(d->declarativeItemRoot));
471  }
472  } else if (d->graphicsWidgetRoot) {
473  if (d->resizeMode == QDeclarativeView::SizeViewToRootObject) {
474  d->graphicsWidgetRoot->removeEventFilter(this);
475  }
476  }
477 
478  d->resizeMode = mode;
479  if (d->root) {
480  d->initResize();
481  }
482 }
double d
Definition: qnumeric_p.h:62
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482
void removeItemChangeListener(QDeclarativeItemChangeListener *, ChangeTypes types)
static const QGraphicsItemPrivate * get(const QGraphicsItem *item)

◆ setRootObject()

void QDeclarativeView::setRootObject ( QObject obj)
protectedvirtual
Warning
This function is not part of the public interface.

Definition at line 594 of file qdeclarativeview.cpp.

Referenced by continueExecute().

595 {
597  if (d->root == obj || !scene())
598  return;
599  if (QDeclarativeItem *declarativeItem = qobject_cast<QDeclarativeItem *>(obj)) {
600  scene()->addItem(declarativeItem);
601  d->root = declarativeItem;
602  d->declarativeItemRoot = declarativeItem;
603  } else if (QGraphicsObject *graphicsObject = qobject_cast<QGraphicsObject *>(obj)) {
604  scene()->addItem(graphicsObject);
605  d->root = graphicsObject;
606  if (graphicsObject->isWidget()) {
607  d->graphicsWidgetRoot = static_cast<QGraphicsWidget*>(graphicsObject);
608  } else {
609  qWarning() << "QDeclarativeView::resizeMode is not honored for components of type QGraphicsObject";
610  }
611  } else if (obj) {
612  qWarning() << "QDeclarativeView only supports loading of root objects that derive from QGraphicsObject";
613  if (QWidget* widget = qobject_cast<QWidget *>(obj)) {
616  if (layout() && layout()->count()) {
617  // Hide the QGraphicsView in GV mode.
618  QLayoutItem *item = layout()->itemAt(0);
619  if (item->widget())
620  item->widget()->hide();
621  }
622  widget->setParent(this);
623  if (isVisible()) {
624  widget->setVisible(true);
625  }
626  resize(widget->size());
627  }
628  }
629 
630  if (d->root) {
631  d->initialSize = d->rootObjectSize();
632  if (d->initialSize != size()) {
633  if (!(parentWidget() && parentWidget()->layout())) {
634  resize(d->initialSize);
635  }
636  }
637  d->initResize();
638  }
639 }
double d
Definition: qnumeric_p.h:62
QWidget * parentWidget() const
Returns the parent of this widget, or 0 if it does not have any parent widget.
Definition: qwidget.h:1035
virtual QLayoutItem * itemAt(int index) const =0
Must be implemented in subclasses to return the layout item at index.
void setParent(QWidget *parent)
Sets the parent of the widget to parent, and resets the window flags.
Definition: qwidget.cpp:10479
QSize size() const
QPointer< QWidget > widget
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
bool isVisible() const
Definition: qwidget.h:1005
The QWidget class is the base class of all user interface objects.
Definition: qwidget.h:150
void addItem(QGraphicsItem *item)
Adds or moves the item and all its childen to this scene.
#define Q_D(Class)
Definition: qglobal.h:2482
The QLayoutItem class provides an abstract item that a QLayout manipulates.
Definition: qlayoutitem.h:64
The QDeclarativeItem class provides the most basic of all visual items in QML.
Q_CORE_EXPORT void qWarning(const char *,...)
QSize size
the size of the widget excluding any window frame
Definition: qwidget.h:165
virtual void setVisible(bool visible)
Definition: qwidget.cpp:7991
void hide()
Hides the widget.
Definition: qwidget.h:501
void resize(int w, int h)
This corresponds to resize(QSize(w, h)).
Definition: qwidget.h:1014
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
Definition: qwidget.cpp:11087
QWidget * window() const
Returns the window for this widget, i.e.
Definition: qwidget.cpp:4492
virtual QWidget * widget()
If this item is a QWidget, it is returned as a QWidget; otherwise 0 is returned.
QLayout * layout() const
Returns the layout manager that is installed on this widget, or 0 if no layout manager is installed...
Definition: qwidget.cpp:10073
The QGraphicsObject class provides a base class for all graphics items that require signals...
QGraphicsScene * scene() const
Returns a pointer to the scene that is currently visualized in the view.
The QGraphicsWidget class is the base class for all widget items in a QGraphicsScene.

◆ setSource()

void QDeclarativeView::setSource ( const QUrl url)

Sets the source to the url, loads the QML component and instantiates it.

Ensure that the URL provided is full and correct, in particular, use QUrl::fromLocalFile() when loading a file from the local filesystem.

Calling this methods multiple times with the same url will result in the QML being reloaded.

Definition at line 347 of file qdeclarativeview.cpp.

Referenced by QDeclarativeView(), and QmlApplicationViewer::setMainQmlFile().

348 {
350  d->source = url;
351  d->execute();
352 }
double d
Definition: qnumeric_p.h:62
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482

◆ sizeHint()

QSize QDeclarativeView::sizeHint ( ) const
virtual

Preferred size follows the root object geometry.

Warning
This function is not part of the public interface.

Reimplemented from QWidget.

Definition at line 679 of file qdeclarativeview.cpp.

680 {
681  Q_D(const QDeclarativeView);
682  QSize rootObjectSize = d->rootObjectSize();
683  if (rootObjectSize.isEmpty()) {
684  return size();
685  } else {
686  return rootObjectSize;
687  }
688 }
double d
Definition: qnumeric_p.h:62
QSize size() const
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482
The QSize class defines the size of a two-dimensional object using integer point precision.
Definition: qsize.h:53
bool isEmpty() const
Returns true if either of the width and height is less than or equal to 0; otherwise returns false...
Definition: qsize.h:120

◆ source()

QUrl QDeclarativeView::source ( ) const

Referenced by setSource().

◆ status()

Status QDeclarativeView::status ( ) const

Referenced by continueExecute(), and rootContext().

◆ statusChanged

void QDeclarativeView::statusChanged ( QDeclarativeView::Status  status)
signal

This signal is emitted when the component's current status changes.

Referenced by continueExecute().

◆ timerEvent()

void QDeclarativeView::timerEvent ( QTimerEvent e)
protectedvirtual

If the QTimerEvent {timer event} e is this view's resize timer, sceneResized() is emitted.

Warning
This function is not part of the public interface.

Reimplemented from QObject.

Definition at line 649 of file qdeclarativeview.cpp.

650 {
652  if (!e || e->timerId() == d->resizetimer.timerId()) {
653  d->updateSize();
654  d->resizetimer.stop();
655  }
656 }
double d
Definition: qnumeric_p.h:62
The QDeclarativeView class provides a widget for displaying a Qt Declarative user interface...
#define Q_D(Class)
Definition: qglobal.h:2482
int timerId() const
Returns the unique timer identifier, which is the same identifier as returned from QObject::startTime...
Definition: qcoreevent.h:346

Properties

◆ resizeMode

QDeclarativeView::ResizeMode QDeclarativeView::resizeMode
private

whether the view should resize the canvas contents

If this property is set to SizeViewToRootObject (the default), the view resizes with the root item in the QML.

If this property is set to SizeRootObjectToView, the view will automatically resize the root item.

Regardless of this property, the sizeHint of the view is the initial size of the root item. Note though that since QML may load dynamically, that size may change.

Definition at line 67 of file qdeclarativeview.h.

◆ source

QUrl QDeclarativeView::source
private

The URL of the source of the QML component.

Returns the source URL, if set.

Changing this property causes the QML component to be reloaded.

Ensure that the URL provided is full and correct, in particular, use QUrl::fromLocalFile() when loading a file from the local filesystem.

See also
{Network Transparency}{Loading Resources in QML}
setSource()

Definition at line 69 of file qdeclarativeview.h.

◆ status

QDeclarativeView::Status QDeclarativeView::status
private

The component's current status.

Definition at line 68 of file qdeclarativeview.h.


The documentation for this class was generated from the following files: