Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QGraphicsProxyWidget Class Reference

The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene. More...

#include <qgraphicsproxywidget.h>

+ Inheritance diagram for QGraphicsProxyWidget:
+ Collaboration diagram for QGraphicsProxyWidget:

Public Types

enum  { Type = 12 }
 
- Public Types inherited from QGraphicsWidget
enum  { Type = 11 }
 
- Public Types inherited from QGraphicsItem
enum  GraphicsItemFlag {
  ItemIsMovable = 0x1 , ItemIsSelectable = 0x2 , ItemIsFocusable = 0x4 , ItemClipsToShape = 0x8 ,
  ItemClipsChildrenToShape = 0x10 , ItemIgnoresTransformations = 0x20 , ItemIgnoresParentOpacity = 0x40 , ItemDoesntPropagateOpacityToChildren = 0x80 ,
  ItemStacksBehindParent = 0x100 , ItemUsesExtendedStyleOption = 0x200 , ItemHasNoContents = 0x400 , ItemSendsGeometryChanges = 0x800 ,
  ItemAcceptsInputMethod = 0x1000 , ItemNegativeZStacksBehindParent = 0x2000 , ItemIsPanel = 0x4000 , ItemIsFocusScope = 0x8000 ,
  ItemSendsScenePositionChanges = 0x10000 , ItemStopsClickFocusPropagation = 0x20000 , ItemStopsFocusHandling = 0x40000 , ItemContainsChildrenInShape = 0x80000
}
 This enum describes different flags that you can set on an item to toggle different features in the item's behavior. More...
 
enum  GraphicsItemChange {
  ItemPositionChange , ItemVisibleChange = 2 , ItemEnabledChange , ItemSelectedChange ,
  ItemParentChange , ItemChildAddedChange , ItemChildRemovedChange , ItemTransformChange ,
  ItemPositionHasChanged , ItemTransformHasChanged , ItemSceneChange , ItemVisibleHasChanged ,
  ItemEnabledHasChanged , ItemSelectedHasChanged , ItemParentHasChanged , ItemSceneHasChanged ,
  ItemCursorChange , ItemCursorHasChanged , ItemToolTipChange , ItemToolTipHasChanged ,
  ItemFlagsChange , ItemFlagsHaveChanged , ItemZValueChange , ItemZValueHasChanged ,
  ItemOpacityChange , ItemOpacityHasChanged , ItemScenePositionHasChanged , ItemRotationChange ,
  ItemRotationHasChanged , ItemScaleChange , ItemScaleHasChanged , ItemTransformOriginPointChange ,
  ItemTransformOriginPointHasChanged
}
 This enum describes the state changes that are notified by QGraphicsItem::itemChange(). More...
 
enum  CacheMode { NoCache , ItemCoordinateCache , DeviceCoordinateCache }
 
enum  PanelModality { NonModal , PanelModal , SceneModal }
 
enum  { Type = 1 , UserType = 65536 }
 

Public Member Functions

 QGraphicsProxyWidget (QGraphicsItem *parent=nullptr, Qt::WindowFlags wFlags=Qt::WindowFlags())
 Constructs a new QGraphicsProxy widget.
 
 ~QGraphicsProxyWidget ()
 Destroys the proxy widget and any embedded widget.
 
void setWidget (QWidget *widget)
 Embeds widget into this proxy widget.
 
QWidgetwidget () const
 Returns a pointer to the embedded widget.
 
QRectF subWidgetRect (const QWidget *widget) const
 Returns the rectangle for widget, which must be a descendant of widget(), or widget() itself, in this proxy item's local coordinates.
 
void setGeometry (const QRectF &rect) override
 \reimp
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override
 \reimp
 
int type () const override
 \reimp
 
QGraphicsProxyWidgetcreateProxyForChildWidget (QWidget *child)
 
- Public Member Functions inherited from QGraphicsWidget
 QGraphicsWidget (QGraphicsItem *parent=nullptr, Qt::WindowFlags wFlags=Qt::WindowFlags())
 Constructs a QGraphicsWidget instance.
 
 ~QGraphicsWidget ()
 Destroys the QGraphicsWidget instance.
 
QGraphicsLayoutlayout () const
 Returns this widget's layout, or \nullptr if no layout is currently managing this widget.
 
void setLayout (QGraphicsLayout *layout)
 Sets the layout for this widget to layout.
 
void adjustSize ()
 Adjusts the size of the widget to its effective preferred size hint.
 
Qt::LayoutDirection layoutDirection () const
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void unsetLayoutDirection ()
 
QStylestyle () const
 Returns a pointer to the widget's style.
 
void setStyle (QStyle *style)
 Sets the widget's style to style.
 
QFont font () const
 
void setFont (const QFont &font)
 
QPalette palette () const
 
void setPalette (const QPalette &palette)
 
bool autoFillBackground () const
 
void setAutoFillBackground (bool enabled)
 
void resize (const QSizeF &size)
 
void resize (qreal w, qreal h)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Constructs a resize with the given width (w) and height (h).
 
QSizeF size () const
 
void setGeometry (const QRectF &rect) override
 This virtual function sets the geometry of the QGraphicsLayoutItem to rect, which is in parent coordinates (e.g., the top-left corner of rect is equivalent to the item's position in parent coordinates).
 
void setGeometry (qreal x, qreal y, qreal w, qreal h)
 This convenience function is equivalent to calling setGeometry(QRectF( x, y, w, h)).
 
QRectF rect () const
 Returns the item's local rect as a QRectF.
 
void setContentsMargins (qreal left, qreal top, qreal right, qreal bottom)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Sets the widget's contents margins to left, top, right and bottom.
 
void setContentsMargins (QMarginsF margins)
 
void getContentsMargins (qreal *left, qreal *top, qreal *right, qreal *bottom) const override
 Gets the widget's contents margins.
 
void setWindowFrameMargins (qreal left, qreal top, qreal right, qreal bottom)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. Sets the widget's window frame margins to left, top, right and bottom.
 
void setWindowFrameMargins (QMarginsF margins)
 
void getWindowFrameMargins (qreal *left, qreal *top, qreal *right, qreal *bottom) const
 Gets the widget's window frame margins.
 
void unsetWindowFrameMargins ()
 Resets the window frame margins to the default value, provided by the style.
 
QRectF windowFrameGeometry () const
 Returns the widget's geometry in parent coordinates including any window frame.
 
QRectF windowFrameRect () const
 Returns the widget's local rect including any window frame.
 
Qt::WindowFlags windowFlags () const
 
Qt::WindowType windowType () const
 Returns the widgets window type.
 
void setWindowFlags (Qt::WindowFlags wFlags)
 
bool isActiveWindow () const
 Returns true if this widget's window is in the active window, or if the widget does not have a window but is in an active scene (i.e., a scene that currently has focus).
 
void setWindowTitle (const QString &title)
 
QString windowTitle () const
 
Qt::FocusPolicy focusPolicy () const
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
QGraphicsWidgetfocusWidget () const
 If this widget, a child or descendant of this widget currently has input focus, this function will return a pointer to that widget.
 
int grabShortcut (const QKeySequence &sequence, Qt::ShortcutContext context=Qt::WindowShortcut)
 
void releaseShortcut (int id)
 
void setShortcutEnabled (int id, bool enabled=true)
 
void setShortcutAutoRepeat (int id, bool enabled=true)
 
void addAction (QAction *action)
 
void addActions (const QList< QAction * > &actions)
 
void insertActions (QAction *before, const QList< QAction * > &actions)
 
void insertAction (QAction *before, QAction *action)
 
void removeAction (QAction *action)
 
QList< QAction * > actions () const
 
void setAttribute (Qt::WidgetAttribute attribute, bool on=true)
 If on is true, this function enables attribute; otherwise attribute is disabled.
 
bool testAttribute (Qt::WidgetAttribute attribute) const
 Returns true if attribute is enabled for this widget; otherwise, returns false.
 
int type () const override
 \reimp
 
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr) override
 \reimp
 
virtual void paintWindowFrame (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=nullptr)
 This virtual function is called by QGraphicsScene to draw the window frame for windows using painter, option, and widget, in local coordinates.
 
QRectF boundingRect () const override
 \reimp
 
QPainterPath shape () const override
 \reimp
 
const QObjectListchildren () const
 Returns a list of child objects.
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
bool moveToThread (QThread *thread QT6_DECL_NEW_OVERLOAD_TAIL)
 Changes the thread affinity for this object and its children and returns true on success.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::nanoseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
void killTimer (Qt::TimerId id)
 
template<typename T >
findChild (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (QAnyStringView aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) 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.
 
template<typename T >
findChild (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
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.
 
- Public Member Functions inherited from QGraphicsItem
 QGraphicsItem (QGraphicsItem *parent=nullptr)
 Constructs a QGraphicsItem with the given parent item.
 
virtual ~QGraphicsItem ()
 Destroys the QGraphicsItem and all its children.
 
QGraphicsScenescene () const
 Returns the current scene for the item, or \nullptr if the item is not stored in a scene.
 
QGraphicsItemparentItem () const
 Returns a pointer to this item's parent item.
 
QGraphicsItemtopLevelItem () const
 Returns this item's top-level item.
 
QGraphicsObjectparentObject () const
 
QGraphicsWidgetparentWidget () const
 
QGraphicsWidgettopLevelWidget () const
 
QGraphicsWidgetwindow () const
 
QGraphicsItempanel () const
 
void setParentItem (QGraphicsItem *parent)
 Sets this item's parent item to newParent.
 
QList< QGraphicsItem * > childItems () const
 
bool isWidget () const
 
bool isWindow () const
 
bool isPanel () const
 
QGraphicsObjecttoGraphicsObject ()
 
const QGraphicsObjecttoGraphicsObject () const
 
QGraphicsItemGroupgroup () const
 Returns a pointer to this item's item group, or \nullptr if this item is not member of a group.
 
void setGroup (QGraphicsItemGroup *group)
 Adds this item to the item group group.
 
GraphicsItemFlags flags () const
 Returns this item's flags.
 
void setFlag (GraphicsItemFlag flag, bool enabled=true)
 If enabled is true, the item flag flag is enabled; otherwise, it is disabled.
 
void setFlags (GraphicsItemFlags flags)
 Sets the item flags to flags.
 
CacheMode cacheMode () const
 
void setCacheMode (CacheMode mode, const QSize &cacheSize=QSize())
 
PanelModality panelModality () const
 
void setPanelModality (PanelModality panelModality)
 
bool isBlockedByModalPanel (QGraphicsItem **blockingPanel=nullptr) const
 
QCursor cursor () const
 Returns the current cursor shape for the item.
 
void setCursor (const QCursor &cursor)
 Sets the current cursor shape for the item to cursor.
 
bool hasCursor () const
 Returns true if this item has a cursor set; otherwise, false is returned.
 
void unsetCursor ()
 Clears the cursor from this item.
 
bool isVisible () const
 Returns true if the item is visible; otherwise, false is returned.
 
bool isVisibleTo (const QGraphicsItem *parent) const
 
void setVisible (bool visible)
 If visible is true, the item is made visible.
 
void hide ()
 Hides the item (items are visible by default).
 
void show ()
 Shows the item (items are visible by default).
 
bool isEnabled () const
 Returns true if the item is enabled; otherwise, false is returned.
 
void setEnabled (bool enabled)
 If enabled is true, the item is enabled; otherwise, it is disabled.
 
bool isSelected () const
 Returns true if this item is selected; otherwise, false is returned.
 
void setSelected (bool selected)
 If selected is true and this item is selectable, this item is selected; otherwise, it is unselected.
 
bool acceptDrops () const
 Returns true if this item can accept drag and drop events; otherwise, returns false.
 
void setAcceptDrops (bool on)
 If on is true, this item will accept drag and drop events; otherwise, it is transparent for drag and drop events.
 
qreal opacity () const
 
qreal effectiveOpacity () const
 
void setOpacity (qreal opacity)
 
Qt::MouseButtons acceptedMouseButtons () const
 Returns the mouse buttons that this item accepts mouse events for.
 
void setAcceptedMouseButtons (Qt::MouseButtons buttons)
 Sets the mouse buttons that this item accepts mouse events for.
 
bool acceptHoverEvents () const
 
void setAcceptHoverEvents (bool enabled)
 
bool acceptTouchEvents () const
 
void setAcceptTouchEvents (bool enabled)
 
bool filtersChildEvents () const
 
void setFiltersChildEvents (bool enabled)
 
bool handlesChildEvents () const
 
void setHandlesChildEvents (bool enabled)
 
bool isActive () const
 
void setActive (bool active)
 
bool hasFocus () const
 Returns true if this item is active, and it or its \l{focusProxy()}{focus proxy} has keyboard input focus; otherwise, returns false.
 
void setFocus (Qt::FocusReason focusReason=Qt::OtherFocusReason)
 Gives keyboard input focus to this item.
 
void clearFocus ()
 Takes keyboard input focus from the item.
 
QGraphicsItemfocusProxy () const
 
void setFocusProxy (QGraphicsItem *item)
 
QGraphicsItemfocusItem () const
 
QGraphicsItemfocusScopeItem () const
 
void grabMouse ()
 
void ungrabMouse ()
 
void grabKeyboard ()
 
void ungrabKeyboard ()
 
QPointF pos () const
 Returns the position of the item in parent coordinates.
 
qreal x () const
 This convenience function is equivalent to calling pos().x().
 
void setX (qreal x)
 
qreal y () const
 This convenience function is equivalent to calling pos().y().
 
void setY (qreal y)
 
QPointF scenePos () const
 Returns the item's position in scene coordinates.
 
void setPos (const QPointF &pos)
 Sets the position of the item to pos, which is in parent coordinates.
 
void setPos (qreal x, qreal y)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This convenience function is equivalent to calling setPos(QPointF(x, y)).
 
void moveBy (qreal dx, qreal dy)
 Moves the item by dx points horizontally, and dy point vertically.
 
void ensureVisible (const QRectF &rect=QRectF(), int xmargin=50, int ymargin=50)
 If this item is part of a scene that is viewed by a QGraphicsView, this convenience function will attempt to scroll the view to ensure that rect is visible inside the view's viewport.
 
void ensureVisible (qreal x, qreal y, qreal w, qreal h, int xmargin=50, int ymargin=50)
 This convenience function is equivalent to calling ensureVisible(QRectF(x, y, w, h), xmargin, ymargin).
 
QTransform transform () const
 
QTransform sceneTransform () const
 
QTransform deviceTransform (const QTransform &viewportTransform) const
 
QTransform itemTransform (const QGraphicsItem *other, bool *ok=nullptr) const
 
void setTransform (const QTransform &matrix, bool combine=false)
 
void resetTransform ()
 
void setRotation (qreal angle)
 
qreal rotation () const
 
void setScale (qreal scale)
 
qreal scale () const
 
QList< QGraphicsTransform * > transformations () const
 
void setTransformations (const QList< QGraphicsTransform * > &transformations)
 
QPointF transformOriginPoint () const
 
void setTransformOriginPoint (const QPointF &origin)
 
void setTransformOriginPoint (qreal ax, qreal ay)
 
virtual void advance (int phase)
 This virtual function is called twice for all items by the QGraphicsScene::advance() slot.
 
qreal zValue () const
 Returns the Z-value of the item.
 
void setZValue (qreal z)
 Sets the Z-value of the item to z.
 
void stackBefore (const QGraphicsItem *sibling)
 
QRectF childrenBoundingRect () const
 Returns the bounding rect of this item's descendants (i.e., its children, their children, etc.) in local coordinates.
 
QRectF sceneBoundingRect () const
 Returns the bounding rect of this item in scene coordinates, by combining sceneTransform() with boundingRect().
 
bool isClipped () const
 Returns true if this item is clipped.
 
QPainterPath clipPath () const
 
virtual bool contains (const QPointF &point) const
 Returns true if this item contains point, which is in local coordinates; otherwise, false is returned.
 
virtual bool collidesWithItem (const QGraphicsItem *other, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 Returns true if this item collides with other; otherwise returns false.
 
virtual bool collidesWithPath (const QPainterPath &path, Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 Returns true if this item collides with path.
 
QList< QGraphicsItem * > collidingItems (Qt::ItemSelectionMode mode=Qt::IntersectsItemShape) const
 Returns a list of all items that collide with this item.
 
bool isObscured (const QRectF &rect=QRectF()) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool isObscured (qreal x, qreal y, qreal w, qreal h) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
virtual bool isObscuredBy (const QGraphicsItem *item) const
 Returns true if this item's bounding rect is completely obscured by the opaque shape of item.
 
virtual QPainterPath opaqueArea () const
 This virtual function returns a shape representing the area where this item is opaque.
 
QRegion boundingRegion (const QTransform &itemToDeviceTransform) const
 
qreal boundingRegionGranularity () const
 
void setBoundingRegionGranularity (qreal granularity)
 
void update (const QRectF &rect=QRectF())
 Schedules a redraw of the area covered by rect in this item.
 
void update (qreal x, qreal y, qreal width, qreal height)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.This convenience function is equivalent to calling update(QRectF(x, y, width, height)).
 
void scroll (qreal dx, qreal dy, const QRectF &rect=QRectF())
 
QPointF mapToItem (const QGraphicsItem *item, const QPointF &point) const
 Maps the point point, which is in this item's coordinate system, to item's coordinate system, and returns the mapped coordinate.
 
QPointF mapToParent (const QPointF &point) const
 Maps the point point, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped coordinate.
 
QPointF mapToScene (const QPointF &point) const
 Maps the point point, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped coordinate.
 
QPolygonF mapToItem (const QGraphicsItem *item, const QRectF &rect) const
 Maps the rectangle rect, which is in this item's coordinate system, to item's coordinate system, and returns the mapped rectangle as a polygon.
 
QPolygonF mapToParent (const QRectF &rect) const
 Maps the rectangle rect, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped rectangle as a polygon.
 
QPolygonF mapToScene (const QRectF &rect) const
 Maps the rectangle rect, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped rectangle as a polygon.
 
QRectF mapRectToItem (const QGraphicsItem *item, const QRectF &rect) const
 
QRectF mapRectToParent (const QRectF &rect) const
 
QRectF mapRectToScene (const QRectF &rect) const
 
QPolygonF mapToItem (const QGraphicsItem *item, const QPolygonF &polygon) const
 Maps the polygon polygon, which is in this item's coordinate system, to item's coordinate system, and returns the mapped polygon.
 
QPolygonF mapToParent (const QPolygonF &polygon) const
 Maps the polygon polygon, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped polygon.
 
QPolygonF mapToScene (const QPolygonF &polygon) const
 Maps the polygon polygon, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped polygon.
 
QPainterPath mapToItem (const QGraphicsItem *item, const QPainterPath &path) const
 Maps the path path, which is in this item's coordinate system, to item's coordinate system, and returns the mapped path.
 
QPainterPath mapToParent (const QPainterPath &path) const
 Maps the path path, which is in this item's coordinate system, to its parent's coordinate system, and returns the mapped path.
 
QPainterPath mapToScene (const QPainterPath &path) const
 Maps the path path, which is in this item's coordinate system, to the scene's coordinate system, and returns the mapped path.
 
QPointF mapFromItem (const QGraphicsItem *item, const QPointF &point) const
 Maps the point point, which is in item's coordinate system, to this item's coordinate system, and returns the mapped coordinate.
 
QPointF mapFromParent (const QPointF &point) const
 Maps the point point, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped coordinate.
 
QPointF mapFromScene (const QPointF &point) const
 Maps the point point, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped coordinate.
 
QPolygonF mapFromItem (const QGraphicsItem *item, const QRectF &rect) const
 Maps the rectangle rect, which is in item's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon.
 
QPolygonF mapFromParent (const QRectF &rect) const
 Maps the rectangle rect, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon.
 
QPolygonF mapFromScene (const QRectF &rect) const
 Maps the rectangle rect, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped rectangle as a polygon.
 
QRectF mapRectFromItem (const QGraphicsItem *item, const QRectF &rect) const
 
QRectF mapRectFromParent (const QRectF &rect) const
 
QRectF mapRectFromScene (const QRectF &rect) const
 
QPolygonF mapFromItem (const QGraphicsItem *item, const QPolygonF &polygon) const
 Maps the polygon polygon, which is in item's coordinate system, to this item's coordinate system, and returns the mapped polygon.
 
QPolygonF mapFromParent (const QPolygonF &polygon) const
 Maps the polygon polygon, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped polygon.
 
QPolygonF mapFromScene (const QPolygonF &polygon) const
 Maps the polygon polygon, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped polygon.
 
QPainterPath mapFromItem (const QGraphicsItem *item, const QPainterPath &path) const
 Maps the path path, which is in item's coordinate system, to this item's coordinate system, and returns the mapped path.
 
QPainterPath mapFromParent (const QPainterPath &path) const
 Maps the path path, which is in this item's parent's coordinate system, to this item's coordinate system, and returns the mapped path.
 
QPainterPath mapFromScene (const QPainterPath &path) const
 Maps the path path, which is in this item's scene's coordinate system, to this item's coordinate system, and returns the mapped path.
 
QPointF mapToItem (const QGraphicsItem *item, qreal x, qreal 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 convenience function is equivalent to calling mapToItem(item, QPointF(x, y)).
 
QPointF mapToParent (qreal x, qreal 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 convenience function is equivalent to calling mapToParent(QPointF(x, y)).
 
QPointF mapToScene (qreal x, qreal 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 convenience function is equivalent to calling mapToScene(QPointF(x, y)).
 
QPolygonF mapToItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const
 
QPolygonF mapToParent (qreal x, qreal y, qreal w, qreal h) const
 
QPolygonF mapToScene (qreal x, qreal y, qreal w, qreal h) const
 
QRectF mapRectToItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const
 
QRectF mapRectToParent (qreal x, qreal y, qreal w, qreal h) const
 
QRectF mapRectToScene (qreal x, qreal y, qreal w, qreal h) const
 
QPointF mapFromItem (const QGraphicsItem *item, qreal x, qreal 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 convenience function is equivalent to calling mapFromItem(item, QPointF(x, y)).
 
QPointF mapFromParent (qreal x, qreal 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 convenience function is equivalent to calling mapFromParent(QPointF(x, y)).
 
QPointF mapFromScene (qreal x, qreal 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 convenience function is equivalent to calling mapFromScene(QPointF(x, y)).
 
QPolygonF mapFromItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const
 
QPolygonF mapFromParent (qreal x, qreal y, qreal w, qreal h) const
 
QPolygonF mapFromScene (qreal x, qreal y, qreal w, qreal h) const
 
QRectF mapRectFromItem (const QGraphicsItem *item, qreal x, qreal y, qreal w, qreal h) const
 
QRectF mapRectFromParent (qreal x, qreal y, qreal w, qreal h) const
 
QRectF mapRectFromScene (qreal x, qreal y, qreal w, qreal h) const
 
bool isAncestorOf (const QGraphicsItem *child) const
 Returns true if this item is an ancestor of child (i.e., if this item is child's parent, or one of child's parent's ancestors).
 
QGraphicsItemcommonAncestorItem (const QGraphicsItem *other) const
 
bool isUnderMouse () const
 
QVariant data (int key) const
 Returns this item's custom data for the key key as a QVariant.
 
void setData (int key, const QVariant &value)
 Sets this item's custom data for the key key to value.
 
Qt::InputMethodHints inputMethodHints () const
 Returns the current input method hints of this item.
 
void setInputMethodHints (Qt::InputMethodHints hints)
 Sets the current input method hints of this item to hints.
 
void installSceneEventFilter (QGraphicsItem *filterItem)
 Installs an event filter for this item on filterItem, causing all events for this item to first pass through filterItem's sceneEventFilter() function.
 
void removeSceneEventFilter (QGraphicsItem *filterItem)
 Removes an event filter on this item from filterItem.
 
- Public Member Functions inherited from QGraphicsLayoutItem
 QGraphicsLayoutItem (QGraphicsLayoutItem *parent=nullptr, bool isLayout=false)
 Constructs the QGraphicsLayoutItem object.
 
virtual ~QGraphicsLayoutItem ()
 Destroys the QGraphicsLayoutItem object.
 
void setSizePolicy (const QSizePolicy &policy)
 Sets the size policy to policy.
 
void setSizePolicy (QSizePolicy::Policy hPolicy, QSizePolicy::Policy vPolicy, QSizePolicy::ControlType controlType=QSizePolicy::DefaultType)
 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 equivalent to calling setSizePolicy(QSizePolicy(hPolicy, vPolicy, controlType)).
 
QSizePolicy sizePolicy () const
 Returns the current size policy.
 
void setMinimumSize (const QSizeF &size)
 Sets the minimum size to size.
 
void setMinimumSize (qreal w, qreal h)
 This convenience function is equivalent to calling setMinimumSize(QSizeF(w, h)).
 
QSizeF minimumSize () const
 Returns the minimum size.
 
void setMinimumWidth (qreal width)
 Sets the minimum width to width.
 
qreal minimumWidth () const
 Returns the minimum width.
 
void setMinimumHeight (qreal height)
 Sets the minimum height to height.
 
qreal minimumHeight () const
 Returns the minimum height.
 
void setPreferredSize (const QSizeF &size)
 Sets the preferred size to size.
 
void setPreferredSize (qreal w, qreal h)
 This convenience function is equivalent to calling setPreferredSize(QSizeF(w, h)).
 
QSizeF preferredSize () const
 Returns the preferred size.
 
void setPreferredWidth (qreal width)
 Sets the preferred width to width.
 
qreal preferredWidth () const
 Returns the preferred width.
 
void setPreferredHeight (qreal height)
 Sets the preferred height to height.
 
qreal preferredHeight () const
 Returns the preferred height.
 
void setMaximumSize (const QSizeF &size)
 Sets the maximum size to size.
 
void setMaximumSize (qreal w, qreal h)
 This convenience function is equivalent to calling setMaximumSize(QSizeF(w, h)).
 
QSizeF maximumSize () const
 Returns the maximum size.
 
void setMaximumWidth (qreal width)
 Sets the maximum width to width.
 
qreal maximumWidth () const
 Returns the maximum width.
 
void setMaximumHeight (qreal height)
 Sets the maximum height to height.
 
qreal maximumHeight () const
 Returns the maximum height.
 
QRectF geometry () const
 Returns the item's geometry (e.g., position and size) as a QRectF.
 
QRectF contentsRect () const
 Returns the contents rect in local coordinates.
 
QSizeF effectiveSizeHint (Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const
 Returns the effective size hint for this QGraphicsLayoutItem.
 
virtual bool isEmpty () const
 
QGraphicsLayoutItemparentLayoutItem () const
 Returns the parent of this QGraphicsLayoutItem, or \nullptr if there is no parent, or if the parent does not inherit from QGraphicsLayoutItem (QGraphicsLayoutItem is often used through multiple inheritance with QObject-derived classes).
 
void setParentLayoutItem (QGraphicsLayoutItem *parent)
 Sets the parent of this QGraphicsLayoutItem to parent.
 
bool isLayout () const
 Returns true if this QGraphicsLayoutItem is a layout (e.g., is inherited by an object that arranges other QGraphicsLayoutItem objects); otherwise returns false.
 
QGraphicsItemgraphicsItem () const
 Returns the QGraphicsItem that this layout item represents.
 
bool ownedByLayout () const
 

Protected Slots

QGraphicsProxyWidgetnewProxyWidget (const QWidget *)
 
- Protected Slots inherited from QGraphicsObject
void updateMicroFocus ()
 Updates the item's micro focus.
 

Protected Member Functions

QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 \reimp
 
bool event (QEvent *event) override
 \reimp
 
bool eventFilter (QObject *object, QEvent *event) override
 \reimp
 
void showEvent (QShowEvent *event) override
 \reimp
 
void hideEvent (QHideEvent *event) override
 \reimp
 
void contextMenuEvent (QGraphicsSceneContextMenuEvent *event) override
 \reimp
 
void hoverEnterEvent (QGraphicsSceneHoverEvent *event) override
 \reimp
 
void hoverLeaveEvent (QGraphicsSceneHoverEvent *event) override
 \reimp
 
void hoverMoveEvent (QGraphicsSceneHoverEvent *event) override
 \reimp
 
void grabMouseEvent (QEvent *event) override
 \reimp
 
void ungrabMouseEvent (QEvent *event) override
 \reimp
 
void mouseMoveEvent (QGraphicsSceneMouseEvent *event) override
 \reimp
 
void mousePressEvent (QGraphicsSceneMouseEvent *event) override
 \reimp
 
void mouseReleaseEvent (QGraphicsSceneMouseEvent *event) override
 \reimp
 
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event) override
 \reimp
 
void keyPressEvent (QKeyEvent *event) override
 \reimp
 
void keyReleaseEvent (QKeyEvent *event) override
 \reimp
 
void focusInEvent (QFocusEvent *event) override
 \reimp
 
void focusOutEvent (QFocusEvent *event) override
 \reimp
 
bool focusNextPrevChild (bool next) override
 \reimp
 
QVariant inputMethodQuery (Qt::InputMethodQuery query) const override
 \reimp
 
void inputMethodEvent (QInputMethodEvent *event) override
 \reimp
 
QSizeF sizeHint (Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const override
 \reimp
 
void resizeEvent (QGraphicsSceneResizeEvent *event) override
 \reimp
 
- Protected Member Functions inherited from QGraphicsWidget
virtual void initStyleOption (QStyleOption *option) const
 Populates a style option object for this widget based on its current state, and stores the output in option.
 
QSizeF sizeHint (Qt::SizeHint which, const QSizeF &constraint=QSizeF()) const override
 \reimp
 
void updateGeometry () override
 If this widget is currently managed by a layout, this function notifies the layout that the widget's size hints have changed and the layout may need to resize and reposition the widget accordingly.
 
QVariant itemChange (GraphicsItemChange change, const QVariant &value) override
 \reimp
 
virtual QVariant propertyChange (const QString &propertyName, const QVariant &value)
 
bool sceneEvent (QEvent *event) override
 QGraphicsWidget's implementation of sceneEvent() simply passes event to QGraphicsWidget::event().
 
virtual bool windowFrameEvent (QEvent *e)
 This event handler, for event, receives events for the window frame if this widget is a window.
 
virtual Qt::WindowFrameSection windowFrameSectionAt (const QPointF &pos) const
 
bool event (QEvent *event) override
 \reimp
 
virtual void changeEvent (QEvent *event)
 This event handler can be reimplemented to handle state changes.
 
virtual void closeEvent (QCloseEvent *event)
 This event handler, for event, can be reimplemented in a subclass to receive widget close events.
 
void focusInEvent (QFocusEvent *event) override
 \reimp
 
void focusOutEvent (QFocusEvent *event) override
 \reimp
 
virtual void moveEvent (QGraphicsSceneMoveEvent *event)
 This event handler, for \l{QEvent::GraphicsSceneMove}{GraphicsSceneMove} events, is delivered after the widget has moved (e.g., its local position has changed).
 
virtual void polishEvent ()
 This event is delivered to the item by the scene at some point after it has been constructed, but before it is shown or otherwise accessed through the scene.
 
virtual void grabKeyboardEvent (QEvent *event)
 This event handler, for event, can be reimplemented in a subclass to receive notifications for QEvent::GrabKeyboard events.
 
virtual void ungrabKeyboardEvent (QEvent *event)
 This event handler, for event, can be reimplemented in a subclass to receive notifications for QEvent::UngrabKeyboard events.
 
 QGraphicsWidget (QGraphicsWidgetPrivate &, QGraphicsItem *parent, Qt::WindowFlags wFlags=Qt::WindowFlags())
 
- Protected Member Functions inherited from QGraphicsObject
 QGraphicsObject (QGraphicsItemPrivate &dd, QGraphicsItem *parent)
 Constructs a QGraphicsObject with parent.
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Member Functions inherited from QGraphicsItem
void updateMicroFocus ()
 Updates the item's micro focus.
 
virtual bool sceneEventFilter (QGraphicsItem *watched, QEvent *event)
 Filters events for the item watched.
 
virtual void dragEnterEvent (QGraphicsSceneDragDropEvent *event)
 This event handler, for event event, can be reimplemented to receive drag enter events for this item.
 
virtual void dragLeaveEvent (QGraphicsSceneDragDropEvent *event)
 This event handler, for event event, can be reimplemented to receive drag leave events for this item.
 
virtual void dragMoveEvent (QGraphicsSceneDragDropEvent *event)
 This event handler, for event event, can be reimplemented to receive drag move events for this item.
 
virtual void dropEvent (QGraphicsSceneDragDropEvent *event)
 This event handler, for event event, can be reimplemented to receive drop events for this item.
 
virtual void wheelEvent (QGraphicsSceneWheelEvent *event)
 This event handler, for event event, can be reimplemented to receive wheel events for this item.
 
virtual bool supportsExtension (Extension extension) const
 
virtual void setExtension (Extension extension, const QVariant &variant)
 
virtual QVariant extension (const QVariant &variant) const
 
 QGraphicsItem (QGraphicsItemPrivate &dd, QGraphicsItem *parent)
 
void addToIndex ()
 
void removeFromIndex ()
 
void prepareGeometryChange ()
 Prepares the item for a geometry change.
 
- Protected Member Functions inherited from QGraphicsLayoutItem
void setGraphicsItem (QGraphicsItem *item)
 If the QGraphicsLayoutItem represents a QGraphicsItem, and it wants to take advantage of the automatic reparenting capabilities of QGraphicsLayout it should set this value.
 
void setOwnedByLayout (bool ownedByLayout)
 
 QGraphicsLayoutItem (QGraphicsLayoutItemPrivate &dd)
 

Friends

class QWidgetPrivate
 
class QGraphicsItem
 

Additional Inherited Members

- Public Slots inherited from QGraphicsWidget
bool close ()
 Call this function to close the widget.
 
- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- Signals inherited from QGraphicsWidget
void geometryChanged ()
 This signal gets emitted whenever the geometry is changed in setGeometry().
 
void layoutChanged ()
 This signal gets emitted whenever the layout of the item changes.
 
- Signals inherited from QGraphicsObject
void parentChanged ()
 This signal gets emitted whenever the parent of the item changes.
 
void opacityChanged ()
 This signal gets emitted whenever the opacity of the item changes.
 
void visibleChanged ()
 This signal gets emitted whenever the visibility of the item changes.
 
void enabledChanged ()
 This signal gets emitted whenever the item gets enabled or disabled.
 
void xChanged ()
 This signal gets emitted whenever the x position of the item changes.
 
void yChanged ()
 This signal gets emitted whenever the y position of the item changes.
 
void zChanged ()
 This signal gets emitted whenever the z value of the item changes.
 
void rotationChanged ()
 This signal gets emitted whenever the rotation of the item changes.
 
void scaleChanged ()
 This signal is emitted when the scale of the item changes.
 
void childrenChanged ()
 This signal gets emitted whenever the children list changes.
 
void widthChanged ()
 
void heightChanged ()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 
- Static Public Member Functions inherited from QGraphicsWidget
static void setTabOrder (QGraphicsWidget *first, QGraphicsWidget *second)
 Moves the second widget around the ring of focus widgets so that keyboard focus moves from the first widget to the second widget when the Tab key is pressed.
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Types inherited from QGraphicsItem
enum  Extension { UserExtension = 0x80000000 }
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 
- Protected Attributes inherited from QGraphicsItem
QScopedPointer< QGraphicsItemPrivated_ptr
 
- Protected Attributes inherited from QGraphicsLayoutItem
QScopedPointer< QGraphicsLayoutItemPrivated_ptr
 
- Properties inherited from QGraphicsWidget
QPalette palette
 the widget's palette
 
QFont font
 the widgets' font
 
Qt::LayoutDirection layoutDirection
 the layout direction for this widget.
 
QSizeF size
 the size of the widget
 
QSizeF minimumSize
 the minimum size of the widget
 
QSizeF preferredSize
 the preferred size of the widget
 
QSizeF maximumSize
 the maximum size of the widget
 
QSizePolicy sizePolicy
 the size policy for the widget
 
Qt::FocusPolicy focusPolicy
 the way the widget accepts keyboard focus
 
Qt::WindowFlags windowFlags
 the widget's window flags
 
QString windowTitle
 This property holds the window title (caption).
 
QRectF geometry
 the geometry of the widget
 
bool autoFillBackground
 whether the widget background is filled automatically
 
QGraphicsLayoutlayout
 The layout of the widget.
 
- Properties inherited from QGraphicsObject
QGraphicsObjectparent
 the parent of the item
 
qreal opacity
 the opacity of the item
 
bool enabled
 whether the item is enabled or not
 
bool visible
 whether the item is visible or not
 
QPointF pos
 the position of the item
 
qreal x
 the x position of the item
 
qreal y
 the y position of the item
 
qreal z
 the z value of the item
 
qreal rotation
 the rotation of the item in degrees.
 
qreal scale
 the scale of the item.
 
QPointF transformOriginPoint
 the transformation origin
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Detailed Description

The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene.

Since
4.4

\inmodule QtWidgets

QGraphicsProxyWidget embeds QWidget-based widgets, for example, a QPushButton, QFontComboBox, or even QFileDialog, into QGraphicsScene. It forwards events between the two objects and translates between QWidget's integer-based geometry and QGraphicsWidget's qreal-based geometry. QGraphicsProxyWidget supports all core features of QWidget, including tab focus, keyboard input, Drag & Drop, and popups. You can also embed complex widgets, e.g., widgets with subwidgets.

Example:

int main(int argc, char **argv)
{
QApplication app(argc, argv);
QTabWidget *tabWidget = new QTabWidget;
return app.exec();
}

QGraphicsProxyWidget takes care of automatically embedding popup children of embedded widgets through creating a child proxy for each popup. This means that when an embedded QComboBox shows its popup list, a new QGraphicsProxyWidget is created automatically, embedding the popup, and positioning it correctly. This only works if the popup is child of the embedded widget (for example QToolButton::setMenu() requires the QMenu instance to be child of the QToolButton).

Definition at line 16 of file qgraphicsproxywidget.h.

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
Enumerator
Type 

Definition at line 32 of file qgraphicsproxywidget.h.

Constructor & Destructor Documentation

◆ QGraphicsProxyWidget()

QGraphicsProxyWidget::QGraphicsProxyWidget ( QGraphicsItem * parent = nullptr,
Qt::WindowFlags wFlags = Qt::WindowFlags() )

Constructs a new QGraphicsProxy widget.

parent and wFlags are passed to QGraphicsItem's constructor.

Definition at line 511 of file qgraphicsproxywidget.cpp.

◆ ~QGraphicsProxyWidget()

QGraphicsProxyWidget::~QGraphicsProxyWidget ( )

Destroys the proxy widget and any embedded widget.

Definition at line 521 of file qgraphicsproxywidget.cpp.

Member Function Documentation

◆ contextMenuEvent()

void QGraphicsProxyWidget::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsItem.

Definition at line 997 of file qgraphicsproxywidget.cpp.

◆ createProxyForChildWidget()

QGraphicsProxyWidget * QGraphicsProxyWidget::createProxyForChildWidget ( QWidget * child)
Since
4.5

Creates a proxy widget for the given child of the widget contained in this proxy.

This function makes it possible to acquire proxies for non top-level widgets. For instance, you can embed a dialog, and then transform only one of its widgets.

If the widget is already embedded, return the existing proxy widget.

See also
newProxyWidget(), QGraphicsScene::addWidget()

Definition at line 1589 of file qgraphicsproxywidget.cpp.

◆ event()

bool QGraphicsProxyWidget::event ( QEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsObject.

Definition at line 803 of file qgraphicsproxywidget.cpp.

◆ eventFilter()

bool QGraphicsProxyWidget::eventFilter ( QObject * object,
QEvent * event )
overrideprotectedvirtual

\reimp

Reimplemented from QObject.

Definition at line 914 of file qgraphicsproxywidget.cpp.

◆ focusInEvent()

void QGraphicsProxyWidget::focusInEvent ( QFocusEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsItem.

Definition at line 1357 of file qgraphicsproxywidget.cpp.

◆ focusNextPrevChild()

bool QGraphicsProxyWidget::focusNextPrevChild ( bool next)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsWidget.

Definition at line 1424 of file qgraphicsproxywidget.cpp.

◆ focusOutEvent()

void QGraphicsProxyWidget::focusOutEvent ( QFocusEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsItem.

Definition at line 1401 of file qgraphicsproxywidget.cpp.

◆ grabMouseEvent()

void QGraphicsProxyWidget::grabMouseEvent ( QEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsWidget.

Definition at line 1200 of file qgraphicsproxywidget.cpp.

◆ hideEvent()

void QGraphicsProxyWidget::hideEvent ( QHideEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsWidget.

Definition at line 988 of file qgraphicsproxywidget.cpp.

◆ hoverEnterEvent()

void QGraphicsProxyWidget::hoverEnterEvent ( QGraphicsSceneHoverEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsItem.

Definition at line 1156 of file qgraphicsproxywidget.cpp.

◆ hoverLeaveEvent()

void QGraphicsProxyWidget::hoverLeaveEvent ( QGraphicsSceneHoverEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsWidget.

Definition at line 1164 of file qgraphicsproxywidget.cpp.

◆ hoverMoveEvent()

void QGraphicsProxyWidget::hoverMoveEvent ( QGraphicsSceneHoverEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsWidget.

Definition at line 1178 of file qgraphicsproxywidget.cpp.

◆ inputMethodEvent()

void QGraphicsProxyWidget::inputMethodEvent ( QInputMethodEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsItem.

Definition at line 1477 of file qgraphicsproxywidget.cpp.

◆ inputMethodQuery()

QVariant QGraphicsProxyWidget::inputMethodQuery ( Qt::InputMethodQuery query) const
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsItem.

Definition at line 1443 of file qgraphicsproxywidget.cpp.

◆ itemChange()

QVariant QGraphicsProxyWidget::itemChange ( GraphicsItemChange change,
const QVariant & value )
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsItem.

Reimplemented in qdesigner_internal::ZoomProxyWidget.

Definition at line 753 of file qgraphicsproxywidget.cpp.

◆ keyPressEvent()

void QGraphicsProxyWidget::keyPressEvent ( QKeyEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsItem.

Definition at line 1333 of file qgraphicsproxywidget.cpp.

◆ keyReleaseEvent()

void QGraphicsProxyWidget::keyReleaseEvent ( QKeyEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsItem.

Definition at line 1345 of file qgraphicsproxywidget.cpp.

◆ mouseDoubleClickEvent()

void QGraphicsProxyWidget::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsItem.

Definition at line 1242 of file qgraphicsproxywidget.cpp.

◆ mouseMoveEvent()

void QGraphicsProxyWidget::mouseMoveEvent ( QGraphicsSceneMouseEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsItem.

Definition at line 1218 of file qgraphicsproxywidget.cpp.

◆ mousePressEvent()

void QGraphicsProxyWidget::mousePressEvent ( QGraphicsSceneMouseEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsItem.

Definition at line 1230 of file qgraphicsproxywidget.cpp.

◆ mouseReleaseEvent()

void QGraphicsProxyWidget::mouseReleaseEvent ( QGraphicsSceneMouseEvent * event)
overrideprotectedvirtual

\reimp

\reimp

Reimplemented from QGraphicsItem.

Definition at line 1321 of file qgraphicsproxywidget.cpp.

◆ newProxyWidget

QGraphicsProxyWidget * QGraphicsProxyWidget::newProxyWidget ( const QWidget * child)
protectedslot
Since
4.5

Creates a proxy widget for the given child of the widget contained in this proxy.

You should not call this function directly; use QGraphicsProxyWidget::createProxyForChildWidget() instead.

This function is a fake virtual slot that you can reimplement in your subclass in order to control how new proxy widgets are created. The default implementation returns a proxy created with the QGraphicsProxyWidget() constructor with this proxy widget as the parent.

See also
createProxyForChildWidget()

Definition at line 1629 of file qgraphicsproxywidget.cpp.

◆ paint()

void QGraphicsProxyWidget::paint ( QPainter * painter,
const QStyleOptionGraphicsItem * option,
QWidget * widget )
overridevirtual

\reimp

Implements QGraphicsItem.

Definition at line 1540 of file qgraphicsproxywidget.cpp.

◆ resizeEvent()

void QGraphicsProxyWidget::resizeEvent ( QGraphicsSceneResizeEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsWidget.

Definition at line 1527 of file qgraphicsproxywidget.cpp.

◆ setGeometry()

void QGraphicsProxyWidget::setGeometry ( const QRectF & rect)
overridevirtual

\reimp

Reimplemented from QGraphicsLayoutItem.

Definition at line 735 of file qgraphicsproxywidget.cpp.

◆ setWidget()

void QGraphicsProxyWidget::setWidget ( QWidget * widget)

Embeds widget into this proxy widget.

The embedded widget must reside exclusively either inside or outside of Graphics View. You cannot embed a widget as long as it is visible elsewhere in the UI, at the same time.

widget must be a top-level widget whose parent is \nullptr.

When the widget is embedded, its state (e.g., visible, enabled, geometry, size hints) is copied into the proxy widget. If the embedded widget is explicitly hidden or disabled, the proxy widget will become explicitly hidden or disabled after embedding is complete. The class documentation has a full overview over the shared state.

QGraphicsProxyWidget's window flags determine whether the widget, after embedding, will be given window decorations or not.

After this function returns, QGraphicsProxyWidget will keep its state synchronized with that of widget whenever possible.

If a widget is already embedded by this proxy when this function is called, that widget will first be automatically unembedded. Passing \nullptr for the widget argument will only unembed the widget, and the ownership of the currently embedded widget will be passed on to the caller. Every child widget that are embedded will also be embedded and their proxy widget destroyed.

Note that widgets with the Qt::WA_PaintOnScreen widget attribute set and widgets that wrap an external application or controller cannot be embedded. Examples are QOpenGLWidget and QAxWidget.

See also
widget()

Definition at line 563 of file qgraphicsproxywidget.cpp.

◆ showEvent()

void QGraphicsProxyWidget::showEvent ( QShowEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsWidget.

Definition at line 980 of file qgraphicsproxywidget.cpp.

◆ sizeHint()

QSizeF QGraphicsProxyWidget::sizeHint ( Qt::SizeHint which,
const QSizeF & constraint = QSizeF() ) const
overrideprotectedvirtual

\reimp

Implements QGraphicsLayoutItem.

Definition at line 1489 of file qgraphicsproxywidget.cpp.

◆ subWidgetRect()

QRectF QGraphicsProxyWidget::subWidgetRect ( const QWidget * widget) const

Returns the rectangle for widget, which must be a descendant of widget(), or widget() itself, in this proxy item's local coordinates.

If no widget is embedded, widget is \nullptr, or widget is not a descendant of the embedded widget, this function returns an empty QRectF.

See also
widget()

Definition at line 722 of file qgraphicsproxywidget.cpp.

◆ type()

int QGraphicsProxyWidget::type ( ) const
overridevirtual

\reimp

Reimplemented from QGraphicsItem.

Definition at line 1570 of file qgraphicsproxywidget.cpp.

◆ ungrabMouseEvent()

void QGraphicsProxyWidget::ungrabMouseEvent ( QEvent * event)
overrideprotectedvirtual

\reimp

Reimplemented from QGraphicsWidget.

Definition at line 1208 of file qgraphicsproxywidget.cpp.

◆ widget()

QWidget * QGraphicsProxyWidget::widget ( ) const

Returns a pointer to the embedded widget.

See also
setWidget()

Definition at line 707 of file qgraphicsproxywidget.cpp.

Friends And Related Symbol Documentation

◆ QGraphicsItem

friend class QGraphicsItem
friend

Definition at line 96 of file qgraphicsproxywidget.h.

◆ QWidgetPrivate

friend class QWidgetPrivate
friend

Definition at line 95 of file qgraphicsproxywidget.h.


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