QtBase
v6.3.1
|
The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene. More...
#include <qgraphicsproxywidget.h>
Protected Slots | |
QGraphicsProxyWidget * | newProxyWidget (const QWidget *) |
Protected Slots inherited from QGraphicsObject | |
void | updateMicroFocus () |
Friends | |
class | QWidgetPrivate |
class | QGraphicsItem |
Additional Inherited Members | |
Public Slots inherited from QGraphicsWidget | |
bool | close () |
Public Slots inherited from QObject | |
void | deleteLater () |
Signals inherited from QGraphicsWidget | |
void | geometryChanged () |
void | layoutChanged () |
Signals inherited from QGraphicsObject | |
void | parentChanged () |
void | opacityChanged () |
void | visibleChanged () |
void | enabledChanged () |
void | xChanged () |
void | yChanged () |
void | zChanged () |
void | rotationChanged () |
void | scaleChanged () |
void | childrenChanged () |
void | widthChanged () |
void | heightChanged () |
Signals inherited from QObject | |
void | destroyed (QObject *=nullptr) |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
Static Public Member Functions inherited from QGraphicsWidget | |
static void | setTabOrder (QGraphicsWidget *first, QGraphicsWidget *second) |
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) |
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::FunctionPointer< Func2 >::Object *receiver, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection) |
static QMetaObject::Connection ::type | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot) |
static QMetaObject::Connection ::type | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 slot) |
template<typename Func1 , typename Func2 > | |
static std::enable_if< QtPrivate::FunctionPointer< Func2 >::ArgumentCount==-1 &&!std::is_convertible_v< Func2, const char * >, QMetaObject::Connection >::type | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *context, Func2 slot, Qt::ConnectionType type=Qt::AutoConnection) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::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< QObjectData > | d_ptr |
Protected Attributes inherited from QGraphicsItem | |
QScopedPointer< QGraphicsItemPrivate > | d_ptr |
Protected Attributes inherited from QGraphicsLayoutItem | |
QScopedPointer< QGraphicsLayoutItemPrivate > | d_ptr |
Properties inherited from QGraphicsWidget | |
QPalette | palette |
the widget's palette More... | |
QFont | font |
the widgets' font More... | |
Qt::LayoutDirection | layoutDirection |
the layout direction for this widget. More... | |
QSizeF | size |
the size of the widget More... | |
QSizeF | minimumSize |
the minimum size of the widget More... | |
QSizeF | preferredSize |
the preferred size of the widget More... | |
QSizeF | maximumSize |
the maximum size of the widget More... | |
QSizePolicy | sizePolicy |
the size policy for the widget More... | |
Qt::FocusPolicy | focusPolicy |
the way the widget accepts keyboard focus More... | |
Qt::WindowFlags | windowFlags |
the widget's window flags More... | |
QString | windowTitle |
This property holds the window title (caption). More... | |
QRectF | geometry |
the geometry of the widget More... | |
bool | autoFillBackground |
whether the widget background is filled automatically More... | |
QGraphicsLayout * | layout |
The layout of the widget. More... | |
Properties inherited from QGraphicsObject | |
QGraphicsObject * | parent |
the parent of the item More... | |
qreal | opacity |
the opacity of the item More... | |
bool | enabled |
whether the item is enabled or not More... | |
bool | visible |
whether the item is visible or not More... | |
QPointF | pos |
the position of the item More... | |
qreal | x |
the x position of the item More... | |
qreal | y |
the y position of the item More... | |
qreal | z |
the z value of the item More... | |
qreal | rotation |
the rotation of the item in degrees. More... | |
qreal | scale |
the scale of the item. More... | |
QPointF | transformOriginPoint |
the transformation origin More... | |
Properties inherited from QObject | |
QString | objectName |
the name of this object More... | |
Related Functions inherited from QObject | |
template< class T > T | qobject_cast (const QObject *object) |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
Related Functions inherited from QGraphicsItem | |
T | qgraphicsitem_cast (QGraphicsItem *item) |
The QGraphicsProxyWidget class provides a proxy layer for embedding a QWidget in a QGraphicsScene.
\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:
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 52 of file qgraphicsproxywidget.h.
anonymous enum |
Enumerator | |
---|---|
Type |
Definition at line 68 of file qgraphicsproxywidget.h.
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 538 of file qgraphicsproxywidget.cpp.
QGraphicsProxyWidget::~QGraphicsProxyWidget | ( | ) |
Destroys the proxy widget and any embedded widget.
Definition at line 548 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsItem.
Definition at line 1024 of file qgraphicsproxywidget.cpp.
QGraphicsProxyWidget * QGraphicsProxyWidget::createProxyForChildWidget | ( | QWidget * | child | ) |
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.
Definition at line 1616 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsObject.
Definition at line 830 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QObject.
Reimplemented in SubQGraphicsProxyWidget.
Definition at line 941 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsItem.
Definition at line 1384 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsWidget.
Definition at line 1451 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsItem.
Reimplemented in SubQGraphicsProxyWidget.
Definition at line 1428 of file qgraphicsproxywidget.cpp.
\reimp
Reimplemented from QGraphicsWidget.
Definition at line 1227 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsWidget.
Definition at line 1015 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsItem.
Definition at line 1183 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsWidget.
Definition at line 1191 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsWidget.
Definition at line 1205 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsItem.
Definition at line 1504 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsItem.
Definition at line 1470 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsItem.
Definition at line 780 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
|
overrideprotectedvirtual |
\reimp
\reimp
Reimplemented from QGraphicsItem.
Definition at line 1348 of file qgraphicsproxywidget.cpp.
|
protectedslot |
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.
Definition at line 1656 of file qgraphicsproxywidget.cpp.
|
overridevirtual |
\reimp
Implements QGraphicsItem.
Reimplemented in SubQGraphicsProxyWidget, MyProxyWidget, MyProxyWidget, and TestProxy.
Definition at line 1567 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsWidget.
Definition at line 1554 of file qgraphicsproxywidget.cpp.
\reimp
Reimplemented from QGraphicsLayoutItem.
Definition at line 762 of file qgraphicsproxywidget.cpp.
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 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.
Definition at line 590 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QGraphicsWidget.
Definition at line 1007 of file qgraphicsproxywidget.cpp.
|
overrideprotectedvirtual |
\reimp
Implements QGraphicsLayoutItem.
Definition at line 1516 of file qgraphicsproxywidget.cpp.
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.
Definition at line 749 of file qgraphicsproxywidget.cpp.
|
overridevirtual |
\reimp
Reimplemented from QGraphicsWidget.
Definition at line 1235 of file qgraphicsproxywidget.cpp.
QWidget * QGraphicsProxyWidget::widget | ( | ) | const |
Returns a pointer to the embedded widget.
Definition at line 734 of file qgraphicsproxywidget.cpp.
|
friend |
Definition at line 132 of file qgraphicsproxywidget.h.
|
friend |
Definition at line 131 of file qgraphicsproxywidget.h.