Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY:
    java.lang.Object
      com.trolltech.qt.internal.QSignalEmitterInternal
          com.trolltech.qt.QSignalEmitter
              com.trolltech.qt.QtJambiObject
                  com.trolltech.qt.core.QObject
                      com.trolltech.qt.gui.QGraphicsWidget
All Implemented Interfaces: QGraphicsItemInterface, QGraphicsLayoutItemInterface, QtJambiInterface Direct Known Subclasses: QGraphicsProxyWidget
    public class QGraphicsWidget
extends QObject implements QGraphicsItemInterface, QGraphicsLayoutItemInterface The `QGraphicsWidget` class is the base class for all widget items in a `QGraphicsScene`. `QGraphicsWidget` is an extended base item that provides extra functionality over `QGraphicsItem`. It is similar to `QWidget` in many ways: Provides a `palette`, a `font` and a `style()`. Has a defined `geometry()`. Supports layouts with `setLayout()` and `layout()`. Unlike `QGraphicsItem`, `QGraphicsWidget` is not an abstract class; you can create instances of a `QGraphicsWidget` without having to subclass it. This approach is useful for widgets that only serve the purpose of organizing child widgets into a layout. `QGraphicsWidget` can be used as a base item for your own custom item if you require advanced input focus handling, e.g., tab focus and activation, or layouts. Since `QGraphicsWidget` resembles `QWidget` and has similar API, it is easier to port a widget from `QWidget` to `QGraphicsWidget`, instead of `QGraphicsItem`. Note:`QWidget`-based widgets can be directly embedded into a `QGraphicsScene` using `QGraphicsProxyWidget`. Noticeable differences between `QGraphicsWidget` and `QWidget` are:
`QGraphicsWidget` | `QWidget`
--- | ---
Coordinates and geometry are defined with qreals (doubles or floats, depending on the platform). | `QWidget` uses integer geometry (`QPoint`, `QRect`).
The widget is already visible by default; you do not have to call `show()` to display the widget. | `QWidget` is hidden by default until you call `show()`.
A subset of widget attributes are supported. | All widget attributes are supported.
A top-level item's style defaults to QGraphicsScene::style | A top-level widget's style defaults to QApplication::style
Graphics View provides a custom drag and drop framework, different from `QWidget`. | Standard drag and drop framework.
Widget items do not support modality. | Full modality support.
`QGraphicsWidget` supports a subset of Qt's widget attributes, (`Qt::WidgetAttribute` ), as shown in the table below. Any attributes not listed in this table are unsupported, or otherwise unused.
Widget Attribute | Usage
--- | ---
`Qt::WA_SetLayoutDirection` | Set by `setLayoutDirection()`, cleared by `unsetLayoutDirection()`. You can test this attribute to check if the widget has been explicitly assigned a `layoutDirection`. If the attribute is not set, the `layoutDirection()` is inherited.
`Qt::WA_RightToLeft` | Toggled by `setLayoutDirection()`. Inherited from the parent/scene. If set, the widget's layout will order horizontally arranged widgets from right to left.
`Qt::WA_SetStyle` | Set and cleared by `setStyle()`. If this attribute is set, the widget has been explicitly assigned a style. If it is unset, the widget will use the scene's or the application's style.
`Qt::WA_Resized` | Set by `setGeometry()` and `resize()`.
Although `QGraphicsWidget` inherits from both `QObject` and `QGraphicsItem`, you should use the functions provided by `QGraphicsItem`, not`QObject`, to manage the relationships between parent and child items. These functions control the stacking order of items as well as their ownership. Note: The `QObject::parent()` should always return 0 for QGraphicsWidgets, but this policy is not strictly defined. See also: `QGraphicsProxyWidget`, `QGraphicsItem`, and Widgets and Layouts.
Constructor Detail
### QGraphicsWidget
    public QGraphicsWidget(QGraphicsItemInterface parent,
                           Qt.WindowType[] wFlags)
Constructs a `QGraphicsWidget` instance. The optional `parent` argument is passed to `QGraphicsItem`'s constructor. The optional `wFlags` argument specifies the widget's window flags (e.g., whether the widget should be a window, a tool, a popup, etc). ### QGraphicsWidget
    public QGraphicsWidget(QGraphicsItemInterface parent)
Constructs a `QGraphicsWidget` instance. The optional `parent` argument is passed to `QGraphicsItem`'s constructor. The optional `wFlags` argument specifies the widget's window flags (e.g., whether the widget should be a window, a tool, a popup, etc). ### QGraphicsWidget
    public QGraphicsWidget()
Constructs a `QGraphicsWidget` instance. The optional `parent` argument is passed to `QGraphicsItem`'s constructor. The optional `wFlags` argument specifies the widget's window flags (e.g., whether the widget should be a window, a tool, a popup, etc). ### QGraphicsWidget
    public QGraphicsWidget(QGraphicsItemInterface parent,
                           Qt.WindowFlags wFlags)
Constructs a `QGraphicsWidget` instance. The optional `parent` argument is passed to `QGraphicsItem`'s constructor. The optional `wFlags` argument specifies the widget's window flags (e.g., whether the widget should be a window, a tool, a popup, etc).
Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: